1 /* @file startup_efm32gg.S
\r
2 * @brief startup file for Silicon Labs EFM32GG devices.
\r
3 * For use with GCC for ARM Embedded Processors
\r
8 /* Copyright (c) 2011 - 2014 ARM LIMITED
\r
10 All rights reserved.
\r
11 Redistribution and use in source and binary forms, with or without
\r
12 modification, are permitted provided that the following conditions are met:
\r
13 - Redistributions of source code must retain the above copyright
\r
14 notice, this list of conditions and the following disclaimer.
\r
15 - Redistributions in binary form must reproduce the above copyright
\r
16 notice, this list of conditions and the following disclaimer in the
\r
17 documentation and/or other materials provided with the distribution.
\r
18 - Neither the name of ARM nor the names of its contributors may be used
\r
19 to endorse or promote products derived from this software without
\r
20 specific prior written permission.
\r
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
23 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
25 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
\r
26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
\r
27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
\r
28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
\r
29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
\r
30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
\r
31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
32 POSSIBILITY OF SUCH DAMAGE.
\r
33 ---------------------------------------------------------------------------*/
\r
40 .equ Stack_Size, __STACK_SIZE
\r
42 .equ Stack_Size, 0x00000400
\r
48 .size __StackLimit, . - __StackLimit
\r
50 .size __StackTop, . - __StackTop
\r
55 .equ Heap_Size, __HEAP_SIZE
\r
57 .equ Heap_Size, 0x00000C00
\r
65 .size __HeapBase, . - __HeapBase
\r
67 .size __HeapLimit, . - __HeapLimit
\r
73 .long __StackTop /* Top of Stack */
\r
74 .long Reset_Handler /* Reset Handler */
\r
75 .long NMI_Handler /* NMI Handler */
\r
76 .long HardFault_Handler /* Hard Fault Handler */
\r
77 .long MemManage_Handler /* MPU Fault Handler */
\r
78 .long BusFault_Handler /* Bus Fault Handler */
\r
79 .long UsageFault_Handler /* Usage Fault Handler */
\r
80 .long Default_Handler /* Reserved */
\r
81 .long Default_Handler /* Reserved */
\r
82 .long Default_Handler /* Reserved */
\r
83 .long Default_Handler /* Reserved */
\r
84 .long SVC_Handler /* SVCall Handler */
\r
85 .long DebugMon_Handler /* Debug Monitor Handler */
\r
86 .long Default_Handler /* Reserved */
\r
87 .long PendSV_Handler /* PendSV Handler */
\r
88 .long SysTick_Handler /* SysTick Handler */
\r
90 /* External interrupts */
\r
91 .long DMA_IRQHandler /* 0 - DMA */
\r
92 .long GPIO_EVEN_IRQHandler /* 1 - GPIO_EVEN */
\r
93 .long TIMER0_IRQHandler /* 2 - TIMER0 */
\r
94 .long USART0_RX_IRQHandler /* 3 - USART0_RX */
\r
95 .long USART0_TX_IRQHandler /* 4 - USART0_TX */
\r
96 .long USB_IRQHandler /* 5 - USB */
\r
97 .long ACMP0_IRQHandler /* 6 - ACMP0 */
\r
98 .long ADC0_IRQHandler /* 7 - ADC0 */
\r
99 .long DAC0_IRQHandler /* 8 - DAC0 */
\r
100 .long I2C0_IRQHandler /* 9 - I2C0 */
\r
101 .long I2C1_IRQHandler /* 10 - I2C1 */
\r
102 .long GPIO_ODD_IRQHandler /* 11 - GPIO_ODD */
\r
103 .long TIMER1_IRQHandler /* 12 - TIMER1 */
\r
104 .long TIMER2_IRQHandler /* 13 - TIMER2 */
\r
105 .long TIMER3_IRQHandler /* 14 - TIMER3 */
\r
106 .long USART1_RX_IRQHandler /* 15 - USART1_RX */
\r
107 .long USART1_TX_IRQHandler /* 16 - USART1_TX */
\r
108 .long LESENSE_IRQHandler /* 17 - LESENSE */
\r
109 .long USART2_RX_IRQHandler /* 18 - USART2_RX */
\r
110 .long USART2_TX_IRQHandler /* 19 - USART2_TX */
\r
111 .long UART0_RX_IRQHandler /* 20 - UART0_RX */
\r
112 .long UART0_TX_IRQHandler /* 21 - UART0_TX */
\r
113 .long UART1_RX_IRQHandler /* 22 - UART1_RX */
\r
114 .long UART1_TX_IRQHandler /* 23 - UART1_TX */
\r
115 .long LEUART0_IRQHandler /* 24 - LEUART0 */
\r
116 .long LEUART1_IRQHandler /* 25 - LEUART1 */
\r
117 .long LETIMER0_IRQHandler /* 26 - LETIMER0 */
\r
118 .long PCNT0_IRQHandler /* 27 - PCNT0 */
\r
119 .long PCNT1_IRQHandler /* 28 - PCNT1 */
\r
120 .long PCNT2_IRQHandler /* 29 - PCNT2 */
\r
121 .long RTC_IRQHandler /* 30 - RTC */
\r
122 .long BURTC_IRQHandler /* 31 - BURTC */
\r
123 .long CMU_IRQHandler /* 32 - CMU */
\r
124 .long VCMP_IRQHandler /* 33 - VCMP */
\r
125 .long LCD_IRQHandler /* 34 - LCD */
\r
126 .long MSC_IRQHandler /* 35 - MSC */
\r
127 .long AES_IRQHandler /* 36 - AES */
\r
128 .long EBI_IRQHandler /* 37 - EBI */
\r
129 .long EMU_IRQHandler /* 38 - EMU */
\r
132 .size __Vectors, . - __Vectors
\r
138 .globl Reset_Handler
\r
139 .type Reset_Handler, %function
\r
141 #ifndef __NO_SYSTEM_INIT
\r
142 ldr r0, =SystemInit
\r
146 /* Firstly it copies data from read only memory to RAM. There are two schemes
\r
147 * to copy. One can copy more than one sections. Another can only copy
\r
148 * one section. The former scheme needs more instructions and read-only
\r
149 * data to implement than the latter.
\r
150 * Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes. */
\r
152 #ifdef __STARTUP_COPY_MULTIPLE
\r
153 /* Multiple sections scheme.
\r
155 * Between symbol address __copy_table_start__ and __copy_table_end__,
\r
156 * there are array of triplets, each of which specify:
\r
157 * offset 0: LMA of start of a section to copy from
\r
158 * offset 4: VMA of start of a section to copy to
\r
159 * offset 8: size of the section to copy. Must be multiply of 4
\r
161 * All addresses must be aligned to 4 bytes boundary.
\r
163 ldr r4, =__copy_table_start__
\r
164 ldr r5, =__copy_table_end__
\r
185 /* Single section scheme.
\r
187 * The ranges of copy from/to are specified by following symbols
\r
188 * __etext: LMA of start of the section to copy from. Usually end of text
\r
189 * __data_start__: VMA of start of the section to copy to
\r
190 * __data_end__: VMA of end of the section to copy to
\r
192 * All addresses must be aligned to 4 bytes boundary.
\r
195 ldr r2, =__data_start__
\r
196 ldr r3, =__data_end__
\r
204 #endif /*__STARTUP_COPY_MULTIPLE */
\r
206 /* This part of work usually is done in C library startup code. Otherwise,
\r
207 * define this macro to enable it in this startup.
\r
209 * There are two schemes too. One can clear multiple BSS sections. Another
\r
210 * can only clear one section. The former is more size expensive than the
\r
213 * Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former.
\r
214 * Otherwise efine macro __STARTUP_CLEAR_BSS to choose the later.
\r
216 #ifdef __STARTUP_CLEAR_BSS_MULTIPLE
\r
217 /* Multiple sections scheme.
\r
219 * Between symbol address __copy_table_start__ and __copy_table_end__,
\r
220 * there are array of tuples specifying:
\r
221 * offset 0: Start of a BSS section
\r
222 * offset 4: Size of this BSS section. Must be multiply of 4
\r
224 ldr r3, =__zero_table_start__
\r
225 ldr r4, =__zero_table_end__
\r
242 #elif defined (__STARTUP_CLEAR_BSS)
\r
243 /* Single BSS section scheme.
\r
245 * The BSS section is specified by following symbols
\r
246 * __bss_start__: start of the BSS section.
\r
247 * __bss_end__: end of the BSS section.
\r
249 * Both addresses must be aligned to 4 bytes boundary.
\r
251 ldr r1, =__bss_start__
\r
252 ldr r2, =__bss_end__
\r
260 #endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */
\r
263 #define __START _start
\r
268 .size Reset_Handler, . - Reset_Handler
\r
272 .weak Default_Handler
\r
273 .type Default_Handler, %function
\r
276 .size Default_Handler, . - Default_Handler
\r
278 /* Macro to define default handlers. Default handler
\r
279 * will be weak symbol and just dead loops. They can be
\r
280 * overwritten by other handlers */
\r
281 .macro def_irq_handler handler_name
\r
282 .weak \handler_name
\r
283 .set \handler_name, Default_Handler
\r
286 def_irq_handler NMI_Handler
\r
287 def_irq_handler HardFault_Handler
\r
288 def_irq_handler MemManage_Handler
\r
289 def_irq_handler BusFault_Handler
\r
290 def_irq_handler UsageFault_Handler
\r
291 def_irq_handler SVC_Handler
\r
292 def_irq_handler DebugMon_Handler
\r
293 def_irq_handler PendSV_Handler
\r
294 def_irq_handler SysTick_Handler
\r
296 def_irq_handler DMA_IRQHandler
\r
297 def_irq_handler GPIO_EVEN_IRQHandler
\r
298 def_irq_handler TIMER0_IRQHandler
\r
299 def_irq_handler USART0_RX_IRQHandler
\r
300 def_irq_handler USART0_TX_IRQHandler
\r
301 def_irq_handler USB_IRQHandler
\r
302 def_irq_handler ACMP0_IRQHandler
\r
303 def_irq_handler ADC0_IRQHandler
\r
304 def_irq_handler DAC0_IRQHandler
\r
305 def_irq_handler I2C0_IRQHandler
\r
306 def_irq_handler I2C1_IRQHandler
\r
307 def_irq_handler GPIO_ODD_IRQHandler
\r
308 def_irq_handler TIMER1_IRQHandler
\r
309 def_irq_handler TIMER2_IRQHandler
\r
310 def_irq_handler TIMER3_IRQHandler
\r
311 def_irq_handler USART1_RX_IRQHandler
\r
312 def_irq_handler USART1_TX_IRQHandler
\r
313 def_irq_handler LESENSE_IRQHandler
\r
314 def_irq_handler USART2_RX_IRQHandler
\r
315 def_irq_handler USART2_TX_IRQHandler
\r
316 def_irq_handler UART0_RX_IRQHandler
\r
317 def_irq_handler UART0_TX_IRQHandler
\r
318 def_irq_handler UART1_RX_IRQHandler
\r
319 def_irq_handler UART1_TX_IRQHandler
\r
320 def_irq_handler LEUART0_IRQHandler
\r
321 def_irq_handler LEUART1_IRQHandler
\r
322 def_irq_handler LETIMER0_IRQHandler
\r
323 def_irq_handler PCNT0_IRQHandler
\r
324 def_irq_handler PCNT1_IRQHandler
\r
325 def_irq_handler PCNT2_IRQHandler
\r
326 def_irq_handler RTC_IRQHandler
\r
327 def_irq_handler BURTC_IRQHandler
\r
328 def_irq_handler CMU_IRQHandler
\r
329 def_irq_handler VCMP_IRQHandler
\r
330 def_irq_handler LCD_IRQHandler
\r
331 def_irq_handler MSC_IRQHandler
\r
332 def_irq_handler AES_IRQHandler
\r
333 def_irq_handler EBI_IRQHandler
\r
334 def_irq_handler EMU_IRQHandler
\r