xref: /nrf52832-nimble/nordic/nrfx/mdk/iar_startup_nrf51.s (revision 150812a83cab50279bd772ef6db1bfaf255f2c5b)
1; Copyright (c) 2009-2018 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     0                         ; Reserved
75        DCD     0                         ; Reserved
76        DCD     0                         ; Reserved
77        DCD     0                         ; Reserved
78        DCD     0                         ; Reserved
79        DCD     0                         ; Reserved
80        DCD     0                         ; Reserved
81        DCD     SVC_Handler
82        DCD     0                         ; Reserved
83        DCD     0                         ; Reserved
84        DCD     PendSV_Handler
85        DCD     SysTick_Handler
86
87        ; External Interrupts
88        DCD     POWER_CLOCK_IRQHandler
89        DCD     RADIO_IRQHandler
90        DCD     UART0_IRQHandler
91        DCD     SPI0_TWI0_IRQHandler
92        DCD     SPI1_TWI1_IRQHandler
93        DCD     0                         ; Reserved
94        DCD     GPIOTE_IRQHandler
95        DCD     ADC_IRQHandler
96        DCD     TIMER0_IRQHandler
97        DCD     TIMER1_IRQHandler
98        DCD     TIMER2_IRQHandler
99        DCD     RTC0_IRQHandler
100        DCD     TEMP_IRQHandler
101        DCD     RNG_IRQHandler
102        DCD     ECB_IRQHandler
103        DCD     CCM_AAR_IRQHandler
104        DCD     WDT_IRQHandler
105        DCD     RTC1_IRQHandler
106        DCD     QDEC_IRQHandler
107        DCD     LPCOMP_IRQHandler
108        DCD     SWI0_IRQHandler
109        DCD     SWI1_IRQHandler
110        DCD     SWI2_IRQHandler
111        DCD     SWI3_IRQHandler
112        DCD     SWI4_IRQHandler
113        DCD     SWI5_IRQHandler
114        DCD     0                         ; Reserved
115        DCD     0                         ; Reserved
116        DCD     0                         ; Reserved
117        DCD     0                         ; Reserved
118        DCD     0                         ; Reserved
119        DCD     0                         ; Reserved
120
121__Vectors_End
122__Vectors                           EQU   __vector_table
123__Vectors_Size                      EQU   __Vectors_End - __Vectors
124
125NRF_POWER_RAMON_ADDRESS              EQU   0x40000524  ; NRF_POWER->RAMON address
126NRF_POWER_RAMONB_ADDRESS             EQU   0x40000554  ; NRF_POWER->RAMONB address
127NRF_POWER_RAMONx_RAMxON_ONMODE_Msk   EQU   0x3         ; All RAM blocks on in onmode bit mask
128
129; Default handlers.
130        THUMB
131
132        PUBWEAK Reset_Handler
133        SECTION .text:CODE:REORDER:NOROOT(2)
134Reset_Handler
135        MOVS    R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk
136
137        LDR     R0, =NRF_POWER_RAMON_ADDRESS
138        LDR     R2, [R0]
139        ORRS    R2, R2, R1
140        STR     R2, [R0]
141
142        LDR     R0, =NRF_POWER_RAMONB_ADDRESS
143        LDR     R2, [R0]
144        ORRS    R2, R2, R1
145        STR     R2, [R0]
146
147        LDR     R0, =SystemInit
148        BLX     R0
149        LDR     R0, =__iar_program_start
150        BX      R0
151
152        ; Dummy exception handlers
153
154
155        PUBWEAK NMI_Handler
156        SECTION .text:CODE:REORDER:NOROOT(1)
157NMI_Handler
158        B .
159
160        PUBWEAK HardFault_Handler
161        SECTION .text:CODE:REORDER:NOROOT(1)
162HardFault_Handler
163        B .
164
165        PUBWEAK SVC_Handler
166        SECTION .text:CODE:REORDER:NOROOT(1)
167SVC_Handler
168        B .
169
170        PUBWEAK PendSV_Handler
171        SECTION .text:CODE:REORDER:NOROOT(1)
172PendSV_Handler
173        B .
174
175        PUBWEAK SysTick_Handler
176        SECTION .text:CODE:REORDER:NOROOT(1)
177SysTick_Handler
178        B .
179
180
181       ; Dummy interrupt handlers
182
183        PUBWEAK  POWER_CLOCK_IRQHandler
184        SECTION .text:CODE:REORDER:NOROOT(1)
185POWER_CLOCK_IRQHandler
186        B .
187
188        PUBWEAK  RADIO_IRQHandler
189        SECTION .text:CODE:REORDER:NOROOT(1)
190RADIO_IRQHandler
191        B .
192
193        PUBWEAK  UART0_IRQHandler
194        SECTION .text:CODE:REORDER:NOROOT(1)
195UART0_IRQHandler
196        B .
197
198        PUBWEAK  SPI0_TWI0_IRQHandler
199        SECTION .text:CODE:REORDER:NOROOT(1)
200SPI0_TWI0_IRQHandler
201        B .
202
203        PUBWEAK  SPI1_TWI1_IRQHandler
204        SECTION .text:CODE:REORDER:NOROOT(1)
205SPI1_TWI1_IRQHandler
206        B .
207
208        PUBWEAK  GPIOTE_IRQHandler
209        SECTION .text:CODE:REORDER:NOROOT(1)
210GPIOTE_IRQHandler
211        B .
212
213        PUBWEAK  ADC_IRQHandler
214        SECTION .text:CODE:REORDER:NOROOT(1)
215ADC_IRQHandler
216        B .
217
218        PUBWEAK  TIMER0_IRQHandler
219        SECTION .text:CODE:REORDER:NOROOT(1)
220TIMER0_IRQHandler
221        B .
222
223        PUBWEAK  TIMER1_IRQHandler
224        SECTION .text:CODE:REORDER:NOROOT(1)
225TIMER1_IRQHandler
226        B .
227
228        PUBWEAK  TIMER2_IRQHandler
229        SECTION .text:CODE:REORDER:NOROOT(1)
230TIMER2_IRQHandler
231        B .
232
233        PUBWEAK  RTC0_IRQHandler
234        SECTION .text:CODE:REORDER:NOROOT(1)
235RTC0_IRQHandler
236        B .
237
238        PUBWEAK  TEMP_IRQHandler
239        SECTION .text:CODE:REORDER:NOROOT(1)
240TEMP_IRQHandler
241        B .
242
243        PUBWEAK  RNG_IRQHandler
244        SECTION .text:CODE:REORDER:NOROOT(1)
245RNG_IRQHandler
246        B .
247
248        PUBWEAK  ECB_IRQHandler
249        SECTION .text:CODE:REORDER:NOROOT(1)
250ECB_IRQHandler
251        B .
252
253        PUBWEAK  CCM_AAR_IRQHandler
254        SECTION .text:CODE:REORDER:NOROOT(1)
255CCM_AAR_IRQHandler
256        B .
257
258        PUBWEAK  WDT_IRQHandler
259        SECTION .text:CODE:REORDER:NOROOT(1)
260WDT_IRQHandler
261        B .
262
263        PUBWEAK  RTC1_IRQHandler
264        SECTION .text:CODE:REORDER:NOROOT(1)
265RTC1_IRQHandler
266        B .
267
268        PUBWEAK  QDEC_IRQHandler
269        SECTION .text:CODE:REORDER:NOROOT(1)
270QDEC_IRQHandler
271        B .
272
273        PUBWEAK  LPCOMP_IRQHandler
274        SECTION .text:CODE:REORDER:NOROOT(1)
275LPCOMP_IRQHandler
276        B .
277
278        PUBWEAK  SWI0_IRQHandler
279        SECTION .text:CODE:REORDER:NOROOT(1)
280SWI0_IRQHandler
281        B .
282
283        PUBWEAK  SWI1_IRQHandler
284        SECTION .text:CODE:REORDER:NOROOT(1)
285SWI1_IRQHandler
286        B .
287
288        PUBWEAK  SWI2_IRQHandler
289        SECTION .text:CODE:REORDER:NOROOT(1)
290SWI2_IRQHandler
291        B .
292
293        PUBWEAK  SWI3_IRQHandler
294        SECTION .text:CODE:REORDER:NOROOT(1)
295SWI3_IRQHandler
296        B .
297
298        PUBWEAK  SWI4_IRQHandler
299        SECTION .text:CODE:REORDER:NOROOT(1)
300SWI4_IRQHandler
301        B .
302
303        PUBWEAK  SWI5_IRQHandler
304        SECTION .text:CODE:REORDER:NOROOT(1)
305SWI5_IRQHandler
306        B .
307
308        END
309
310
311