1; Copyright (c) 2009-2020 ARM Limited. All rights reserved.
2;
3;     SPDX-License-Identifier: Apache-2.0
4;
5; Licensed under the Apache License, Version 2.0 (the License); you may
6; not use this file except in compliance with the License.
7; You may obtain a copy of the License at
8;
9;     www.apache.org/licenses/LICENSE-2.0
10;
11; Unless required by applicable law or agreed to in writing, software
12; distributed under the License is distributed on an AS IS BASIS, WITHOUT
13; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14; See the License for the specific language governing permissions and
15; limitations under the License.
16;
17; NOTICE: This file has been modified by Nordic Semiconductor ASA.
18
19; The modules in this file are included in the libraries, and may be replaced
20; by any user-defined modules that define the PUBLIC symbol _program_start or
21; a user defined start symbol.
22; To override the cstartup defined in the library, simply add your modified
23; version to the workbench project.
24;
25; The vector table is normally located at address 0.
26; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
27; The name "__vector_table" has special meaning for C-SPY:
28; it is where the SP start value is found, and the NVIC vector
29; table register (VTOR) is initialized to this address if != 0.
30
31        MODULE  ?cstartup
32
33#if defined(__STARTUP_CONFIG)
34
35        #include "startup_config.h"
36
37        #ifndef __STARTUP_CONFIG_STACK_ALIGNEMENT
38        #define __STARTUP_CONFIG_STACK_ALIGNEMENT 3
39        #endif
40
41        SECTION CSTACK:DATA:NOROOT(__STARTUP_CONFIG_STACK_ALIGNEMENT)
42        DS8 __STARTUP_CONFIG_STACK_SIZE
43
44        SECTION HEAP:DATA:NOROOT(3)
45        DS8 __STARTUP_CONFIG_HEAP_SIZE
46
47#else
48
49        ;; Stack size default : Defined in *.icf (linker file). Can be modified inside EW.
50        ;; Heap size default : Defined in *.icf (linker file). Can be modified inside EW.
51
52        ;; Forward declaration of sections.
53        SECTION CSTACK:DATA:NOROOT(3)
54
55#endif
56
57
58        SECTION .intvec:CODE:NOROOT(2)
59
60        EXTERN  __iar_program_start
61        EXTERN  SystemInit
62        PUBLIC  __vector_table
63        PUBLIC  __Vectors
64        PUBLIC  __Vectors_End
65        PUBLIC  __Vectors_Size
66
67        DATA
68
69__vector_table
70        DCD     sfe(CSTACK)
71        DCD     Reset_Handler
72        DCD     NMI_Handler
73        DCD     HardFault_Handler
74        DCD     MemoryManagement_Handler
75        DCD     BusFault_Handler
76        DCD     UsageFault_Handler
77        DCD     SecureFault_Handler
78        DCD     0                         ; Reserved
79        DCD     0                         ; Reserved
80        DCD     0                         ; Reserved
81        DCD     SVC_Handler
82        DCD     DebugMon_Handler
83        DCD     0                         ; Reserved
84        DCD     PendSV_Handler
85        DCD     SysTick_Handler
86
87        ; External Interrupts
88        DCD     FPU_IRQHandler
89        DCD     CACHE_IRQHandler
90        DCD     0                         ; Reserved
91        DCD     SPU_IRQHandler
92        DCD     0                         ; Reserved
93        DCD     CLOCK_POWER_IRQHandler
94        DCD     0                         ; Reserved
95        DCD     0                         ; Reserved
96        DCD     SPIM0_SPIS0_TWIM0_TWIS0_UARTE0_IRQHandler
97        DCD     SPIM1_SPIS1_TWIM1_TWIS1_UARTE1_IRQHandler
98        DCD     SPIM4_IRQHandler
99        DCD     SPIM2_SPIS2_TWIM2_TWIS2_UARTE2_IRQHandler
100        DCD     SPIM3_SPIS3_TWIM3_TWIS3_UARTE3_IRQHandler
101        DCD     GPIOTE0_IRQHandler
102        DCD     SAADC_IRQHandler
103        DCD     TIMER0_IRQHandler
104        DCD     TIMER1_IRQHandler
105        DCD     TIMER2_IRQHandler
106        DCD     0                         ; Reserved
107        DCD     0                         ; Reserved
108        DCD     RTC0_IRQHandler
109        DCD     RTC1_IRQHandler
110        DCD     0                         ; Reserved
111        DCD     0                         ; Reserved
112        DCD     WDT0_IRQHandler
113        DCD     WDT1_IRQHandler
114        DCD     COMP_LPCOMP_IRQHandler
115        DCD     EGU0_IRQHandler
116        DCD     EGU1_IRQHandler
117        DCD     EGU2_IRQHandler
118        DCD     EGU3_IRQHandler
119        DCD     EGU4_IRQHandler
120        DCD     EGU5_IRQHandler
121        DCD     PWM0_IRQHandler
122        DCD     PWM1_IRQHandler
123        DCD     PWM2_IRQHandler
124        DCD     PWM3_IRQHandler
125        DCD     0                         ; Reserved
126        DCD     PDM0_IRQHandler
127        DCD     0                         ; Reserved
128        DCD     I2S0_IRQHandler
129        DCD     0                         ; Reserved
130        DCD     IPC_IRQHandler
131        DCD     QSPI_IRQHandler
132        DCD     0                         ; Reserved
133        DCD     NFCT_IRQHandler
134        DCD     0                         ; Reserved
135        DCD     GPIOTE1_IRQHandler
136        DCD     0                         ; Reserved
137        DCD     0                         ; Reserved
138        DCD     0                         ; Reserved
139        DCD     QDEC0_IRQHandler
140        DCD     QDEC1_IRQHandler
141        DCD     0                         ; Reserved
142        DCD     USBD_IRQHandler
143        DCD     USBREGULATOR_IRQHandler
144        DCD     0                         ; Reserved
145        DCD     KMU_IRQHandler
146        DCD     0                         ; Reserved
147        DCD     0                         ; Reserved
148        DCD     0                         ; Reserved
149        DCD     0                         ; Reserved
150        DCD     0                         ; Reserved
151        DCD     0                         ; Reserved
152        DCD     0                         ; Reserved
153        DCD     0                         ; Reserved
154        DCD     0                         ; Reserved
155        DCD     0                         ; Reserved
156        DCD     CRYPTOCELL_IRQHandler
157        DCD     0                         ; Reserved
158        DCD     0                         ; Reserved
159        DCD     0                         ; Reserved
160        DCD     0                         ; Reserved
161        DCD     0                         ; Reserved
162        DCD     0                         ; Reserved
163        DCD     0                         ; Reserved
164        DCD     0                         ; Reserved
165        DCD     0                         ; Reserved
166        DCD     0                         ; Reserved
167        DCD     0                         ; Reserved
168        DCD     0                         ; Reserved
169        DCD     0                         ; Reserved
170        DCD     0                         ; Reserved
171        DCD     0                         ; Reserved
172        DCD     0                         ; Reserved
173        DCD     0                         ; Reserved
174        DCD     0                         ; Reserved
175        DCD     0                         ; Reserved
176        DCD     0                         ; Reserved
177        DCD     0                         ; Reserved
178        DCD     0                         ; Reserved
179        DCD     0                         ; Reserved
180        DCD     0                         ; Reserved
181        DCD     0                         ; Reserved
182        DCD     0                         ; Reserved
183        DCD     0                         ; Reserved
184        DCD     0                         ; Reserved
185        DCD     0                         ; Reserved
186        DCD     0                         ; Reserved
187        DCD     0                         ; Reserved
188        DCD     0                         ; Reserved
189        DCD     0                         ; Reserved
190        DCD     0                         ; Reserved
191        DCD     0                         ; Reserved
192        DCD     0                         ; Reserved
193        DCD     0                         ; Reserved
194        DCD     0                         ; Reserved
195        DCD     0                         ; Reserved
196        DCD     0                         ; Reserved
197        DCD     0                         ; Reserved
198        DCD     0                         ; Reserved
199        DCD     0                         ; Reserved
200        DCD     0                         ; Reserved
201        DCD     0                         ; Reserved
202        DCD     0                         ; Reserved
203        DCD     0                         ; Reserved
204        DCD     0                         ; Reserved
205        DCD     0                         ; Reserved
206        DCD     0                         ; Reserved
207        DCD     0                         ; Reserved
208        DCD     0                         ; Reserved
209        DCD     0                         ; Reserved
210        DCD     0                         ; Reserved
211        DCD     0                         ; Reserved
212        DCD     0                         ; Reserved
213        DCD     0                         ; Reserved
214        DCD     0                         ; Reserved
215        DCD     0                         ; Reserved
216        DCD     0                         ; Reserved
217        DCD     0                         ; Reserved
218        DCD     0                         ; Reserved
219        DCD     0                         ; Reserved
220        DCD     0                         ; Reserved
221        DCD     0                         ; Reserved
222        DCD     0                         ; Reserved
223        DCD     0                         ; Reserved
224        DCD     0                         ; Reserved
225        DCD     0                         ; Reserved
226        DCD     0                         ; Reserved
227        DCD     0                         ; Reserved
228        DCD     0                         ; Reserved
229        DCD     0                         ; Reserved
230        DCD     0                         ; Reserved
231        DCD     0                         ; Reserved
232        DCD     0                         ; Reserved
233        DCD     0                         ; Reserved
234        DCD     0                         ; Reserved
235        DCD     0                         ; Reserved
236        DCD     0                         ; Reserved
237        DCD     0                         ; Reserved
238        DCD     0                         ; Reserved
239        DCD     0                         ; Reserved
240        DCD     0                         ; Reserved
241        DCD     0                         ; Reserved
242        DCD     0                         ; Reserved
243        DCD     0                         ; Reserved
244        DCD     0                         ; Reserved
245        DCD     0                         ; Reserved
246        DCD     0                         ; Reserved
247        DCD     0                         ; Reserved
248        DCD     0                         ; Reserved
249        DCD     0                         ; Reserved
250        DCD     0                         ; Reserved
251        DCD     0                         ; Reserved
252        DCD     0                         ; Reserved
253        DCD     0                         ; Reserved
254        DCD     0                         ; Reserved
255        DCD     0                         ; Reserved
256        DCD     0                         ; Reserved
257        DCD     0                         ; Reserved
258        DCD     0                         ; Reserved
259        DCD     0                         ; Reserved
260        DCD     0                         ; Reserved
261        DCD     0                         ; Reserved
262        DCD     0                         ; Reserved
263        DCD     0                         ; Reserved
264        DCD     0                         ; Reserved
265        DCD     0                         ; Reserved
266        DCD     0                         ; Reserved
267        DCD     0                         ; Reserved
268        DCD     0                         ; Reserved
269        DCD     0                         ; Reserved
270        DCD     0                         ; Reserved
271        DCD     0                         ; Reserved
272        DCD     0                         ; Reserved
273        DCD     0                         ; Reserved
274        DCD     0                         ; Reserved
275        DCD     0                         ; Reserved
276        DCD     0                         ; Reserved
277        DCD     0                         ; Reserved
278        DCD     0                         ; Reserved
279        DCD     0                         ; Reserved
280        DCD     0                         ; Reserved
281        DCD     0                         ; Reserved
282        DCD     0                         ; Reserved
283        DCD     0                         ; Reserved
284        DCD     0                         ; Reserved
285        DCD     0                         ; Reserved
286        DCD     0                         ; Reserved
287        DCD     0                         ; Reserved
288        DCD     0                         ; Reserved
289        DCD     0                         ; Reserved
290        DCD     0                         ; Reserved
291        DCD     0                         ; Reserved
292        DCD     0                         ; Reserved
293        DCD     0                         ; Reserved
294        DCD     0                         ; Reserved
295        DCD     0                         ; Reserved
296        DCD     0                         ; Reserved
297        DCD     0                         ; Reserved
298        DCD     0                         ; Reserved
299        DCD     0                         ; Reserved
300        DCD     0                         ; Reserved
301        DCD     0                         ; Reserved
302        DCD     0                         ; Reserved
303        DCD     0                         ; Reserved
304        DCD     0                         ; Reserved
305        DCD     0                         ; Reserved
306        DCD     0                         ; Reserved
307        DCD     0                         ; Reserved
308        DCD     0                         ; Reserved
309        DCD     0                         ; Reserved
310        DCD     0                         ; Reserved
311        DCD     0                         ; Reserved
312        DCD     0                         ; Reserved
313        DCD     0                         ; Reserved
314        DCD     0                         ; Reserved
315        DCD     0                         ; Reserved
316        DCD     0                         ; Reserved
317        DCD     0                         ; Reserved
318        DCD     0                         ; Reserved
319        DCD     0                         ; Reserved
320        DCD     0                         ; Reserved
321        DCD     0                         ; Reserved
322        DCD     0                         ; Reserved
323        DCD     0                         ; Reserved
324        DCD     0                         ; Reserved
325        DCD     0                         ; Reserved
326        DCD     0                         ; Reserved
327        DCD     0                         ; Reserved
328
329__Vectors_End
330__Vectors                           EQU   __vector_table
331__Vectors_Size                      EQU   __Vectors_End - __Vectors
332
333
334; Default handlers.
335        THUMB
336
337        PUBWEAK Reset_Handler
338        SECTION .text:CODE:REORDER:NOROOT(2)
339Reset_Handler
340
341        LDR     R0, =SystemInit
342        BLX     R0
343        LDR     R0, =__iar_program_start
344        BX      R0
345
346        ; Dummy exception handlers
347
348
349        PUBWEAK NMI_Handler
350        SECTION .text:CODE:REORDER:NOROOT(1)
351NMI_Handler
352        B .
353
354        PUBWEAK HardFault_Handler
355        SECTION .text:CODE:REORDER:NOROOT(1)
356HardFault_Handler
357        B .
358
359        PUBWEAK MemoryManagement_Handler
360        SECTION .text:CODE:REORDER:NOROOT(1)
361MemoryManagement_Handler
362        B .
363
364        PUBWEAK BusFault_Handler
365        SECTION .text:CODE:REORDER:NOROOT(1)
366BusFault_Handler
367        B .
368
369        PUBWEAK UsageFault_Handler
370        SECTION .text:CODE:REORDER:NOROOT(1)
371UsageFault_Handler
372        B .
373
374        PUBWEAK SecureFault_Handler
375        SECTION .text:CODE:REORDER:NOROOT(1)
376SecureFault_Handler
377        B .
378
379        PUBWEAK SVC_Handler
380        SECTION .text:CODE:REORDER:NOROOT(1)
381SVC_Handler
382        B .
383
384        PUBWEAK DebugMon_Handler
385        SECTION .text:CODE:REORDER:NOROOT(1)
386DebugMon_Handler
387        B .
388
389        PUBWEAK PendSV_Handler
390        SECTION .text:CODE:REORDER:NOROOT(1)
391PendSV_Handler
392        B .
393
394        PUBWEAK SysTick_Handler
395        SECTION .text:CODE:REORDER:NOROOT(1)
396SysTick_Handler
397        B .
398
399
400       ; Dummy interrupt handlers
401
402        PUBWEAK  FPU_IRQHandler
403        SECTION .text:CODE:REORDER:NOROOT(1)
404FPU_IRQHandler
405        B .
406
407        PUBWEAK  CACHE_IRQHandler
408        SECTION .text:CODE:REORDER:NOROOT(1)
409CACHE_IRQHandler
410        B .
411
412        PUBWEAK  SPU_IRQHandler
413        SECTION .text:CODE:REORDER:NOROOT(1)
414SPU_IRQHandler
415        B .
416
417        PUBWEAK  CLOCK_POWER_IRQHandler
418        SECTION .text:CODE:REORDER:NOROOT(1)
419CLOCK_POWER_IRQHandler
420        B .
421
422        PUBWEAK  SPIM0_SPIS0_TWIM0_TWIS0_UARTE0_IRQHandler
423        SECTION .text:CODE:REORDER:NOROOT(1)
424SPIM0_SPIS0_TWIM0_TWIS0_UARTE0_IRQHandler
425        B .
426
427        PUBWEAK  SPIM1_SPIS1_TWIM1_TWIS1_UARTE1_IRQHandler
428        SECTION .text:CODE:REORDER:NOROOT(1)
429SPIM1_SPIS1_TWIM1_TWIS1_UARTE1_IRQHandler
430        B .
431
432        PUBWEAK  SPIM4_IRQHandler
433        SECTION .text:CODE:REORDER:NOROOT(1)
434SPIM4_IRQHandler
435        B .
436
437        PUBWEAK  SPIM2_SPIS2_TWIM2_TWIS2_UARTE2_IRQHandler
438        SECTION .text:CODE:REORDER:NOROOT(1)
439SPIM2_SPIS2_TWIM2_TWIS2_UARTE2_IRQHandler
440        B .
441
442        PUBWEAK  SPIM3_SPIS3_TWIM3_TWIS3_UARTE3_IRQHandler
443        SECTION .text:CODE:REORDER:NOROOT(1)
444SPIM3_SPIS3_TWIM3_TWIS3_UARTE3_IRQHandler
445        B .
446
447        PUBWEAK  GPIOTE0_IRQHandler
448        SECTION .text:CODE:REORDER:NOROOT(1)
449GPIOTE0_IRQHandler
450        B .
451
452        PUBWEAK  SAADC_IRQHandler
453        SECTION .text:CODE:REORDER:NOROOT(1)
454SAADC_IRQHandler
455        B .
456
457        PUBWEAK  TIMER0_IRQHandler
458        SECTION .text:CODE:REORDER:NOROOT(1)
459TIMER0_IRQHandler
460        B .
461
462        PUBWEAK  TIMER1_IRQHandler
463        SECTION .text:CODE:REORDER:NOROOT(1)
464TIMER1_IRQHandler
465        B .
466
467        PUBWEAK  TIMER2_IRQHandler
468        SECTION .text:CODE:REORDER:NOROOT(1)
469TIMER2_IRQHandler
470        B .
471
472        PUBWEAK  RTC0_IRQHandler
473        SECTION .text:CODE:REORDER:NOROOT(1)
474RTC0_IRQHandler
475        B .
476
477        PUBWEAK  RTC1_IRQHandler
478        SECTION .text:CODE:REORDER:NOROOT(1)
479RTC1_IRQHandler
480        B .
481
482        PUBWEAK  WDT0_IRQHandler
483        SECTION .text:CODE:REORDER:NOROOT(1)
484WDT0_IRQHandler
485        B .
486
487        PUBWEAK  WDT1_IRQHandler
488        SECTION .text:CODE:REORDER:NOROOT(1)
489WDT1_IRQHandler
490        B .
491
492        PUBWEAK  COMP_LPCOMP_IRQHandler
493        SECTION .text:CODE:REORDER:NOROOT(1)
494COMP_LPCOMP_IRQHandler
495        B .
496
497        PUBWEAK  EGU0_IRQHandler
498        SECTION .text:CODE:REORDER:NOROOT(1)
499EGU0_IRQHandler
500        B .
501
502        PUBWEAK  EGU1_IRQHandler
503        SECTION .text:CODE:REORDER:NOROOT(1)
504EGU1_IRQHandler
505        B .
506
507        PUBWEAK  EGU2_IRQHandler
508        SECTION .text:CODE:REORDER:NOROOT(1)
509EGU2_IRQHandler
510        B .
511
512        PUBWEAK  EGU3_IRQHandler
513        SECTION .text:CODE:REORDER:NOROOT(1)
514EGU3_IRQHandler
515        B .
516
517        PUBWEAK  EGU4_IRQHandler
518        SECTION .text:CODE:REORDER:NOROOT(1)
519EGU4_IRQHandler
520        B .
521
522        PUBWEAK  EGU5_IRQHandler
523        SECTION .text:CODE:REORDER:NOROOT(1)
524EGU5_IRQHandler
525        B .
526
527        PUBWEAK  PWM0_IRQHandler
528        SECTION .text:CODE:REORDER:NOROOT(1)
529PWM0_IRQHandler
530        B .
531
532        PUBWEAK  PWM1_IRQHandler
533        SECTION .text:CODE:REORDER:NOROOT(1)
534PWM1_IRQHandler
535        B .
536
537        PUBWEAK  PWM2_IRQHandler
538        SECTION .text:CODE:REORDER:NOROOT(1)
539PWM2_IRQHandler
540        B .
541
542        PUBWEAK  PWM3_IRQHandler
543        SECTION .text:CODE:REORDER:NOROOT(1)
544PWM3_IRQHandler
545        B .
546
547        PUBWEAK  PDM0_IRQHandler
548        SECTION .text:CODE:REORDER:NOROOT(1)
549PDM0_IRQHandler
550        B .
551
552        PUBWEAK  I2S0_IRQHandler
553        SECTION .text:CODE:REORDER:NOROOT(1)
554I2S0_IRQHandler
555        B .
556
557        PUBWEAK  IPC_IRQHandler
558        SECTION .text:CODE:REORDER:NOROOT(1)
559IPC_IRQHandler
560        B .
561
562        PUBWEAK  QSPI_IRQHandler
563        SECTION .text:CODE:REORDER:NOROOT(1)
564QSPI_IRQHandler
565        B .
566
567        PUBWEAK  NFCT_IRQHandler
568        SECTION .text:CODE:REORDER:NOROOT(1)
569NFCT_IRQHandler
570        B .
571
572        PUBWEAK  GPIOTE1_IRQHandler
573        SECTION .text:CODE:REORDER:NOROOT(1)
574GPIOTE1_IRQHandler
575        B .
576
577        PUBWEAK  QDEC0_IRQHandler
578        SECTION .text:CODE:REORDER:NOROOT(1)
579QDEC0_IRQHandler
580        B .
581
582        PUBWEAK  QDEC1_IRQHandler
583        SECTION .text:CODE:REORDER:NOROOT(1)
584QDEC1_IRQHandler
585        B .
586
587        PUBWEAK  USBD_IRQHandler
588        SECTION .text:CODE:REORDER:NOROOT(1)
589USBD_IRQHandler
590        B .
591
592        PUBWEAK  USBREGULATOR_IRQHandler
593        SECTION .text:CODE:REORDER:NOROOT(1)
594USBREGULATOR_IRQHandler
595        B .
596
597        PUBWEAK  KMU_IRQHandler
598        SECTION .text:CODE:REORDER:NOROOT(1)
599KMU_IRQHandler
600        B .
601
602        PUBWEAK  CRYPTOCELL_IRQHandler
603        SECTION .text:CODE:REORDER:NOROOT(1)
604CRYPTOCELL_IRQHandler
605        B .
606
607        END
608
609
610