OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_LPC1768_GCC_Rowley/] [LPC1700_Startup.s] - Blame information for rev 615

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 581 jeremybenn
/*****************************************************************************
2
 * Copyright (c) 2009 Rowley Associates Limited.                             *
3
 *                                                                           *
4
 * This file may be distributed under the terms of the License Agreement     *
5
 * provided with this software.                                              *
6
 *                                                                           *
7
 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE   *
8
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *
9
 *****************************************************************************/
10
 
11
/*****************************************************************************
12
 *                           Preprocessor Definitions
13
 *                           ------------------------
14
 *
15
 * STARTUP_FROM_RESET
16
 *
17
 *   If defined, the program will startup from power-on/reset. If not defined
18
 *   the program will just loop endlessly from power-on/reset.
19
 *
20
 *   This definition is not defined by default on this target because the
21
 *   debugger is unable to reset this target and maintain control of it over the
22
 *   JTAG interface. The advantage of doing this is that it allows the debugger
23
 *   to reset the CPU and run programs from a known reset CPU state on each run.
24
 *   It also acts as a safety net if you accidently download a program in FLASH
25
 *   that crashes and prevents the debugger from taking control over JTAG
26
 *   rendering the target unusable over JTAG. The obvious disadvantage of doing
27
 *   this is that your application will not startup without the debugger.
28
 *
29
 *   We advise that on this target you keep STARTUP_FROM_RESET undefined whilst
30
 *   you are developing and only define STARTUP_FROM_RESET when development is
31
 *   complete.A
32
 *
33
 *
34
 * CONFIGURE_USB
35
 *
36
 *   If defined, the USB clock will be configured.
37
 *
38
 *****************************************************************************/
39
 
40
#include <LPC1000.h>
41
 
42
#if OSCILLATOR_CLOCK_FREQUENCY==12000000
43
 
44
#ifdef FULL_SPEED
45
 
46
/* Fosc = 12Mhz, Fcco = 400Mhz, cclk = 100Mhz */
47
#ifndef PLL0CFG_VAL
48
#define PLL0CFG_VAL ((49 << PLL0CFG_MSEL0_BIT) | (2 << PLL0CFG_NSEL0_BIT))
49
#endif
50
 
51
#ifndef CCLKCFG_VAL
52
#define CCLKCFG_VAL 3
53
#endif
54
 
55
#ifndef FLASHCFG_VAL
56
#define FLASHCFG_VAL 0x0000403A
57
#endif
58
 
59
#else
60
 
61
/* Fosc = 12Mhz, Fcco = 288Mhz, cclk = 72Mhz */
62
#ifndef PLL0CFG_VAL
63
#define PLL0CFG_VAL ((11 << PLL0CFG_MSEL0_BIT) | (0 << PLL0CFG_NSEL0_BIT))
64
#endif
65
 
66
#ifndef CCLKCFG_VAL
67
#define CCLKCFG_VAL 3
68
#endif
69
 
70
#ifndef FLASHCFG_VAL
71
#define FLASHCFG_VAL 0x0000303A
72
#endif
73
 
74
#endif
75
 
76
/* Fosc = 12Mhz, Fcco = 192Mhz, usbclk = 48Mhz */
77
#ifndef PLL1CFG_VAL
78
#define PLL1CFG_VAL ((3 << PLL1CFG_MSEL1_BIT) | (1 << PLL1CFG_PSEL1_BIT))
79
#endif
80
 
81
#endif
82
 
83
  .global reset_handler
84
 
85
  .syntax unified
86
 
87
  .section .vectors, "ax"
88
  .code 16
89
  .align 0
90
  .global _vectors
91
 
92
.macro DEFAULT_ISR_HANDLER name=
93
  .thumb_func
94
  .weak \name
95
\name:
96
1: b 1b /* endless loop */
97
.endm
98
 
99
.extern xPortPendSVHandler
100
.extern xPortSysTickHandler
101
.extern vPortSVCHandler
102
.extern vEMAC_ISR;
103
 
104
_vectors:
105
  .word __stack_end__
106
#ifdef STARTUP_FROM_RESET
107
  .word reset_handler
108
#else
109
  .word reset_wait
110
#endif /* STARTUP_FROM_RESET */
111
  .word NMI_Handler
112
  .word HardFault_Handler
113
  .word MemManage_Handler
114
  .word BusFault_Handler
115
  .word UsageFault_Handler
116
  .word 0 // Reserved
117
  .word 0 // Reserved
118
  .word 0 // Reserved
119
  .word 0 // Reserved
120
  .word vPortSVCHandler
121
  .word DebugMon_Handler
122
  .word 0 // Reserved
123
  .word xPortPendSVHandler
124
  .word xPortSysTickHandler
125
  .word WDT_IRQHandler
126
  .word TIMER0_IRQHandler
127
  .word TIMER1_IRQHandler
128
  .word TIMER2_IRQHandler
129
  .word TIMER3_IRQHandler
130
  .word UART0_IRQHandler
131
  .word UART1_IRQHandler
132
  .word UART2_IRQHandler
133
  .word UART3_IRQHandler
134
  .word PWM1_IRQHandler
135
  .word I2C0_IRQHandler
136
  .word I2C1_IRQHandler
137
  .word I2C2_IRQHandler
138
  .word SPI_IRQHandler
139
  .word SSP0_IRQHandler
140
  .word SSP1_IRQHandler
141
  .word PLL0_IRQHandler
142
  .word RTC_IRQHandler
143
  .word EINT0_IRQHandler
144
  .word EINT1_IRQHandler
145
  .word EINT2_IRQHandler
146
  .word EINT3_IRQHandler
147
  .word ADC_IRQHandler
148
  .word BOD_IRQHandler
149
  .word USB_IRQHandler
150
  .word CAN_IRQHandler
151
  .word GPDMA_IRQHandler
152
  .word I2S_IRQHandler
153
  .word vEMAC_ISR
154
  .word RIT_IRQHandler
155
  .word MCPWM_IRQHandler
156
  .word QEI_IRQHandler
157
  .word PLL1_IRQHandler
158
  .word USBACT_IRQHandler
159
  .word CANACT_IRQHandler
160
 
161
  .section .init, "ax"
162
  .thumb_func
163
 
164
  reset_handler:
165
#ifndef __FLASH_BUILD
166
  /* If this is a RAM build, configure vector table offset register to point
167
     to the RAM vector table. */
168
  ldr r0, =0xE000ED08
169
  ldr r1, =_vectors
170
  str r1, [r0]
171
#endif
172
 
173
  ldr r0, =SC_BASE_ADDRESS
174
 
175
  /* Configure PLL0 Multiplier/Divider */
176
  ldr r1, [r0, #PLL0STAT_OFFSET]
177
  tst r1, #PLL0STAT_PLLC0_STAT
178
  beq 1f
179
 
180
  /* Disconnect PLL0 */
181
  ldr r1, =PLL0CON_PLLE0
182
  str r1, [r0, #PLL0CON_OFFSET]
183
  mov r1, #0xAA
184
  str r1, [r0, #PLL0FEED_OFFSET]
185
  mov r1, #0x55
186
  str r1, [r0, #PLL0FEED_OFFSET]
187
1:
188
  /* Disable PLL0 */
189
  ldr r1, =0
190
  str r1, [r0, #PLL0CON_OFFSET]
191
  mov r1, #0xAA
192
  str r1, [r0, #PLL0FEED_OFFSET]
193
  mov r1, #0x55
194
  str r1, [r0, #PLL0FEED_OFFSET]
195
 
196
  /* Enable main oscillator */
197
  ldr r1, [r0, #SCS_OFFSET]
198
  orr r1, r1, #SCS_OSCEN
199
  str r1, [r0, #SCS_OFFSET]
200
1:
201
  ldr r1, [r0, #SCS_OFFSET]
202
  tst r1, #SCS_OSCSTAT
203
  beq 1b
204
 
205
  /* Select main oscillator as the PLL0 clock source */
206
  ldr r1, =1
207
  str r1, [r0, #CLKSRCSEL_OFFSET]
208
 
209
  /* Set PLL0CFG */
210
  ldr r1, =PLL0CFG_VAL
211
  str r1, [r0, #PLL0CFG_OFFSET]
212
  mov r1, #0xAA
213
  str r1, [r0, #PLL0FEED_OFFSET]
214
  mov r1, #0x55
215
  str r1, [r0, #PLL0FEED_OFFSET]
216
 
217
  /* Enable PLL0 */
218
  ldr r1, =PLL0CON_PLLE0
219
  str r1, [r0, #PLL0CON_OFFSET]
220
  mov r1, #0xAA
221
  str r1, [r0, #PLL0FEED_OFFSET]
222
  mov r1, #0x55
223
  str r1, [r0, #PLL0FEED_OFFSET]
224
 
225
#ifdef CCLKCFG_VAL
226
  /* Set the CPU clock divider */
227
  ldr r1, =CCLKCFG_VAL
228
  str r1, [r0, #CCLKCFG_OFFSET]
229
#endif
230
 
231
#ifdef FLASHCFG_VAL
232
  /* Configure the FLASH accelerator */
233
  ldr r1, =FLASHCFG_VAL
234
  str r1, [r0, #FLASHCFG_OFFSET]
235
#endif
236
 
237
  /* Wait for PLL0 to lock */
238
1:
239
  ldr r1, [r0, #PLL0STAT_OFFSET]
240
  tst r1, #PLL0STAT_PLOCK0
241
  beq 1b
242
 
243
  /* PLL0 Locked, connect PLL as clock source */
244
  mov r1, #(PLL0CON_PLLE0 | PLL0CON_PLLC0)
245
  str r1, [r0, #PLL0CON_OFFSET]
246
  mov r1, #0xAA
247
  str r1, [r0, #PLL0FEED_OFFSET]
248
  mov r1, #0x55
249
  str r1, [r0, #PLL0FEED_OFFSET]
250
  /* Wait for PLL0 to connect */
251
1:
252
  ldr r1, [r0, #PLL0STAT_OFFSET]
253
  tst r1, #PLL0STAT_PLLC0_STAT
254
  beq 1b
255
 
256
#ifdef CONFIGURE_USB
257
  /* Configure PLL1 Multiplier/Divider */
258
  ldr r1, [r0, #PLL1STAT_OFFSET]
259
  tst r1, #PLL1STAT_PLLC1_STAT
260
  beq 1f
261
 
262
  /* Disconnect PLL1 */
263
  ldr r1, =PLL1CON_PLLE1
264
  str r1, [r0, #PLL1CON_OFFSET]
265
  mov r1, #0xAA
266
  str r1, [r0, #PLL1FEED_OFFSET]
267
  mov r1, #0x55
268
  str r1, [r0, #PLL1FEED_OFFSET]
269
1:
270
  /* Disable PLL1 */
271
  ldr r1, =0
272
  str r1, [r0, #PLL1CON_OFFSET]
273
  mov r1, #0xAA
274
  str r1, [r0, #PLL1FEED_OFFSET]
275
  mov r1, #0x55
276
  str r1, [r0, #PLL1FEED_OFFSET]
277
 
278
  /* Set PLL1CFG */
279
  ldr r1, =PLL1CFG_VAL
280
  str r1, [r0, #PLL1CFG_OFFSET]
281
  mov r1, #0xAA
282
  str r1, [r0, #PLL1FEED_OFFSET]
283
  mov r1, #0x55
284
  str r1, [r0, #PLL1FEED_OFFSET]
285
 
286
  /* Enable PLL1 */
287
  ldr r1, =PLL1CON_PLLE1
288
  str r1, [r0, #PLL1CON_OFFSET]
289
  mov r1, #0xAA
290
  str r1, [r0, #PLL1FEED_OFFSET]
291
  mov r1, #0x55
292
  str r1, [r0, #PLL1FEED_OFFSET]
293
 
294
  /* Wait for PLL1 to lock */
295
1:
296
  ldr r1, [r0, #PLL1STAT_OFFSET]
297
  tst r1, #PLL1STAT_PLOCK1
298
  beq 1b
299
 
300
  /* PLL1 Locked, connect PLL as clock source */
301
  mov r1, #(PLL1CON_PLLE1 | PLL1CON_PLLC1)
302
  str r1, [r0, #PLL1CON_OFFSET]
303
  mov r1, #0xAA
304
  str r1, [r0, #PLL1FEED_OFFSET]
305
  mov r1, #0x55
306
  str r1, [r0, #PLL1FEED_OFFSET]
307
  /* Wait for PLL1 to connect */
308
1:
309
  ldr r1, [r0, #PLL1STAT_OFFSET]
310
  tst r1, #PLL1STAT_PLLC1_STAT
311
  beq 1b
312
#endif
313
 
314
  b _start
315
 
316
DEFAULT_ISR_HANDLER NMI_Handler
317
DEFAULT_ISR_HANDLER HardFault_Handler
318
DEFAULT_ISR_HANDLER MemManage_Handler
319
DEFAULT_ISR_HANDLER BusFault_Handler
320
DEFAULT_ISR_HANDLER UsageFault_Handler
321
DEFAULT_ISR_HANDLER SVC_Handler
322
DEFAULT_ISR_HANDLER DebugMon_Handler
323
DEFAULT_ISR_HANDLER PendSV_Handler
324
DEFAULT_ISR_HANDLER SysTick_Handler
325
DEFAULT_ISR_HANDLER WDT_IRQHandler
326
DEFAULT_ISR_HANDLER TIMER0_IRQHandler
327
DEFAULT_ISR_HANDLER TIMER1_IRQHandler
328
DEFAULT_ISR_HANDLER TIMER2_IRQHandler
329
DEFAULT_ISR_HANDLER TIMER3_IRQHandler
330
DEFAULT_ISR_HANDLER UART0_IRQHandler
331
DEFAULT_ISR_HANDLER UART1_IRQHandler
332
DEFAULT_ISR_HANDLER UART2_IRQHandler
333
DEFAULT_ISR_HANDLER UART3_IRQHandler
334
DEFAULT_ISR_HANDLER PWM1_IRQHandler
335
DEFAULT_ISR_HANDLER I2C0_IRQHandler
336
DEFAULT_ISR_HANDLER I2C1_IRQHandler
337
DEFAULT_ISR_HANDLER I2C2_IRQHandler
338
DEFAULT_ISR_HANDLER SPI_IRQHandler
339
DEFAULT_ISR_HANDLER SSP0_IRQHandler
340
DEFAULT_ISR_HANDLER SSP1_IRQHandler
341
DEFAULT_ISR_HANDLER PLL0_IRQHandler
342
DEFAULT_ISR_HANDLER RTC_IRQHandler
343
DEFAULT_ISR_HANDLER EINT0_IRQHandler
344
DEFAULT_ISR_HANDLER EINT1_IRQHandler
345
DEFAULT_ISR_HANDLER EINT2_IRQHandler
346
DEFAULT_ISR_HANDLER EINT3_IRQHandler
347
DEFAULT_ISR_HANDLER ADC_IRQHandler
348
DEFAULT_ISR_HANDLER BOD_IRQHandler
349
DEFAULT_ISR_HANDLER USB_IRQHandler
350
DEFAULT_ISR_HANDLER CAN_IRQHandler
351
DEFAULT_ISR_HANDLER GPDMA_IRQHandler
352
DEFAULT_ISR_HANDLER I2S_IRQHandler
353
DEFAULT_ISR_HANDLER ENET_IRQHandler
354
DEFAULT_ISR_HANDLER RIT_IRQHandler
355
DEFAULT_ISR_HANDLER MCPWM_IRQHandler
356
DEFAULT_ISR_HANDLER QEI_IRQHandler
357
DEFAULT_ISR_HANDLER PLL1_IRQHandler
358
DEFAULT_ISR_HANDLER USBACT_IRQHandler
359
DEFAULT_ISR_HANDLER CANACT_IRQHandler
360
 
361
#ifndef STARTUP_FROM_RESET
362
DEFAULT_ISR_HANDLER reset_wait
363
#endif /* STARTUP_FROM_RESET */
364
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.