xref: /nrf52832-nimble/nordic/nrfx/mdk/ses_startup_nrf51.s (revision 150812a83cab50279bd772ef6db1bfaf255f2c5b)
1/***********************************************************************************
2 *                           SEGGER Microcontroller GmbH                           *
3 *                               The Embedded Experts                              *
4 ***********************************************************************************
5 *                                                                                 *
6 *                   (c) 2014 - 2018 SEGGER Microcontroller GmbH                   *
7 *                                                                                 *
8 *                  www.segger.com     Support: [email protected]                 *
9 *                                                                                 *
10 ***********************************************************************************
11 *                                                                                 *
12 *        All rights reserved.                                                     *
13 *                                                                                 *
14 *        Redistribution and use in source and binary forms, with or               *
15 *        without modification, are permitted provided that the following          *
16 *        conditions are met:                                                      *
17 *                                                                                 *
18 *        - Redistributions of source code must retain the above copyright         *
19 *          notice, this list of conditions and the following disclaimer.          *
20 *                                                                                 *
21 *        - Neither the name of SEGGER Microcontroller GmbH                        *
22 *          nor the names of its contributors may be used to endorse or            *
23 *          promote products derived from this software without specific           *
24 *          prior written permission.                                              *
25 *                                                                                 *
26 *        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND                   *
27 *        CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,              *
28 *        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF                 *
29 *        MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE                 *
30 *        DISCLAIMED.                                                              *
31 *        IN NO EVENT SHALL SEGGER Microcontroller GmbH BE LIABLE FOR              *
32 *        ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR                 *
33 *        CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT        *
34 *        OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;          *
35 *        OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF            *
36 *        LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT                *
37 *        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE        *
38 *        USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH         *
39 *        DAMAGE.                                                                  *
40 *                                                                                 *
41 ***********************************************************************************/
42
43/************************************************************************************
44 *                         Preprocessor Definitions                                 *
45 *                         ------------------------                                 *
46 * VECTORS_IN_RAM                                                                   *
47 *                                                                                  *
48 *   If defined, an area of RAM will large enough to store the vector table         *
49 *   will be reserved.                                                              *
50 *                                                                                  *
51 ************************************************************************************/
52
53  .syntax unified
54  .code 16
55
56  .section .init, "ax"
57  .align 0
58
59/************************************************************************************
60 * Default Exception Handlers                                                       *
61 ************************************************************************************/
62
63
64  .thumb_func
65  .weak   NMI_Handler
66NMI_Handler:
67  b     .
68
69  .thumb_func
70  .weak   HardFault_Handler
71HardFault_Handler:
72  b     .
73
74  .thumb_func
75  .weak   SVC_Handler
76SVC_Handler:
77  b     .
78
79  .thumb_func
80  .weak   PendSV_Handler
81PendSV_Handler:
82  b     .
83
84  .thumb_func
85  .weak   SysTick_Handler
86SysTick_Handler:
87  b     .
88
89  .thumb_func
90  .weak   Dummy_Handler
91Dummy_Handler:
92  b     .
93
94/************************************************************************************
95 * Default Interrupt Handlers                                                       *
96 ************************************************************************************/
97
98.weak POWER_CLOCK_IRQHandler
99.thumb_set POWER_CLOCK_IRQHandler, Dummy_Handler
100
101.weak RADIO_IRQHandler
102.thumb_set RADIO_IRQHandler, Dummy_Handler
103
104.weak UART0_IRQHandler
105.thumb_set UART0_IRQHandler, Dummy_Handler
106
107.weak SPI0_TWI0_IRQHandler
108.thumb_set SPI0_TWI0_IRQHandler, Dummy_Handler
109
110.weak SPI1_TWI1_IRQHandler
111.thumb_set SPI1_TWI1_IRQHandler, Dummy_Handler
112
113.weak GPIOTE_IRQHandler
114.thumb_set GPIOTE_IRQHandler, Dummy_Handler
115
116.weak ADC_IRQHandler
117.thumb_set ADC_IRQHandler, Dummy_Handler
118
119.weak TIMER0_IRQHandler
120.thumb_set TIMER0_IRQHandler, Dummy_Handler
121
122.weak TIMER1_IRQHandler
123.thumb_set TIMER1_IRQHandler, Dummy_Handler
124
125.weak TIMER2_IRQHandler
126.thumb_set TIMER2_IRQHandler, Dummy_Handler
127
128.weak RTC0_IRQHandler
129.thumb_set RTC0_IRQHandler, Dummy_Handler
130
131.weak TEMP_IRQHandler
132.thumb_set TEMP_IRQHandler, Dummy_Handler
133
134.weak RNG_IRQHandler
135.thumb_set RNG_IRQHandler, Dummy_Handler
136
137.weak ECB_IRQHandler
138.thumb_set ECB_IRQHandler, Dummy_Handler
139
140.weak CCM_AAR_IRQHandler
141.thumb_set CCM_AAR_IRQHandler, Dummy_Handler
142
143.weak WDT_IRQHandler
144.thumb_set WDT_IRQHandler, Dummy_Handler
145
146.weak RTC1_IRQHandler
147.thumb_set RTC1_IRQHandler, Dummy_Handler
148
149.weak QDEC_IRQHandler
150.thumb_set QDEC_IRQHandler, Dummy_Handler
151
152.weak LPCOMP_IRQHandler
153.thumb_set LPCOMP_IRQHandler, Dummy_Handler
154
155.weak SWI0_IRQHandler
156.thumb_set SWI0_IRQHandler, Dummy_Handler
157
158.weak SWI1_IRQHandler
159.thumb_set SWI1_IRQHandler, Dummy_Handler
160
161.weak SWI2_IRQHandler
162.thumb_set SWI2_IRQHandler, Dummy_Handler
163
164.weak SWI3_IRQHandler
165.thumb_set SWI3_IRQHandler, Dummy_Handler
166
167.weak SWI4_IRQHandler
168.thumb_set SWI4_IRQHandler, Dummy_Handler
169
170.weak SWI5_IRQHandler
171.thumb_set SWI5_IRQHandler, Dummy_Handler
172
173/************************************************************************************
174 * Reset Handler Extensions                                                         *
175 ************************************************************************************/
176
177  .extern Reset_Handler
178  .global nRFInitialize
179  .equ    NRF_POWER_RAMON_ADDRESS,             0x40000524
180  .equ    NRF_POWER_RAMONB_ADDRESS,            0x40000554
181  .equ    NRF_POWER_RAMONx_RAMxON_ONMODE_Msk,  0x3
182
183  .thumb_func
184nRFInitialize:
185  MOVS    R1, #NRF_POWER_RAMONx_RAMxON_ONMODE_Msk
186
187  LDR     R0, =NRF_POWER_RAMON_ADDRESS
188  LDR     R2, [R0]
189  ORRS    R2, R1
190  STR     R2, [R0]
191
192  LDR     R0, =NRF_POWER_RAMONB_ADDRESS
193  LDR     R2, [R0]
194  ORRS    R2, R1
195  STR     R2, [R0]
196  bx lr
197
198
199/************************************************************************************
200 * Vector Table                                                                     *
201 ************************************************************************************/
202
203  .section .vectors, "ax"
204  .align 0
205  .global _vectors
206  .extern __stack_end__
207
208_vectors:
209  .word __stack_end__
210  .word Reset_Handler
211  .word NMI_Handler
212  .word HardFault_Handler
213  .word 0                           /*Reserved */
214  .word 0                           /*Reserved */
215  .word 0                           /*Reserved */
216  .word 0                           /*Reserved */
217  .word 0                           /*Reserved */
218  .word 0                           /*Reserved */
219  .word 0                           /*Reserved */
220  .word SVC_Handler
221  .word 0                           /*Reserved */
222  .word 0                           /*Reserved */
223  .word PendSV_Handler
224  .word SysTick_Handler
225
226/* External Interrupts */
227  .word   POWER_CLOCK_IRQHandler
228  .word   RADIO_IRQHandler
229  .word   UART0_IRQHandler
230  .word   SPI0_TWI0_IRQHandler
231  .word   SPI1_TWI1_IRQHandler
232  .word   0                           /*Reserved */
233  .word   GPIOTE_IRQHandler
234  .word   ADC_IRQHandler
235  .word   TIMER0_IRQHandler
236  .word   TIMER1_IRQHandler
237  .word   TIMER2_IRQHandler
238  .word   RTC0_IRQHandler
239  .word   TEMP_IRQHandler
240  .word   RNG_IRQHandler
241  .word   ECB_IRQHandler
242  .word   CCM_AAR_IRQHandler
243  .word   WDT_IRQHandler
244  .word   RTC1_IRQHandler
245  .word   QDEC_IRQHandler
246  .word   LPCOMP_IRQHandler
247  .word   SWI0_IRQHandler
248  .word   SWI1_IRQHandler
249  .word   SWI2_IRQHandler
250  .word   SWI3_IRQHandler
251  .word   SWI4_IRQHandler
252  .word   SWI5_IRQHandler
253  .word   0                           /*Reserved */
254  .word   0                           /*Reserved */
255  .word   0                           /*Reserved */
256  .word   0                           /*Reserved */
257  .word   0                           /*Reserved */
258  .word   0                           /*Reserved */
259_vectors_end:
260
261#ifdef VECTORS_IN_RAM
262  .section .vectors_ram, "ax"
263  .align 0
264  .global _vectors_ram
265
266_vectors_ram:
267  .space _vectors_end - _vectors, 0
268#endif
269