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
92 .long DMA_IRQHandler /* 0 - DMA */
\r
93 .long GPIO_EVEN_IRQHandler /* 1 - GPIO_EVEN */
\r
94 .long TIMER0_IRQHandler /* 2 - TIMER0 */
\r
95 .long USART0_RX_IRQHandler /* 3 - USART0_RX */
\r
96 .long USART0_TX_IRQHandler /* 4 - USART0_TX */
\r
97 .long USB_IRQHandler /* 5 - USB */
\r
98 .long ACMP0_IRQHandler /* 6 - ACMP0 */
\r
99 .long ADC0_IRQHandler /* 7 - ADC0 */
\r
100 .long DAC0_IRQHandler /* 8 - DAC0 */
\r
101 .long I2C0_IRQHandler /* 9 - I2C0 */
\r
102 .long I2C1_IRQHandler /* 10 - I2C1 */
\r
103 .long GPIO_ODD_IRQHandler /* 11 - GPIO_ODD */
\r
104 .long TIMER1_IRQHandler /* 12 - TIMER1 */
\r
105 .long TIMER2_IRQHandler /* 13 - TIMER2 */
\r
106 .long TIMER3_IRQHandler /* 14 - TIMER3 */
\r
107 .long USART1_RX_IRQHandler /* 15 - USART1_RX */
\r
108 .long USART1_TX_IRQHandler /* 16 - USART1_TX */
\r
109 .long LESENSE_IRQHandler /* 17 - LESENSE */
\r
110 .long USART2_RX_IRQHandler /* 18 - USART2_RX */
\r
111 .long USART2_TX_IRQHandler /* 19 - USART2_TX */
\r
112 .long UART0_RX_IRQHandler /* 20 - UART0_RX */
\r
113 .long UART0_TX_IRQHandler /* 21 - UART0_TX */
\r
114 .long UART1_RX_IRQHandler /* 22 - UART1_RX */
\r
115 .long UART1_TX_IRQHandler /* 23 - UART1_TX */
\r
116 .long LEUART0_IRQHandler /* 24 - LEUART0 */
\r
117 .long LEUART1_IRQHandler /* 25 - LEUART1 */
\r
118 .long LETIMER0_IRQHandler /* 26 - LETIMER0 */
\r
119 .long PCNT0_IRQHandler /* 27 - PCNT0 */
\r
120 .long PCNT1_IRQHandler /* 28 - PCNT1 */
\r
121 .long PCNT2_IRQHandler /* 29 - PCNT2 */
\r
122 .long RTC_IRQHandler /* 30 - RTC */
\r
123 .long BURTC_IRQHandler /* 31 - BURTC */
\r
124 .long CMU_IRQHandler /* 32 - CMU */
\r
125 .long VCMP_IRQHandler /* 33 - VCMP */
\r
126 .long LCD_IRQHandler /* 34 - LCD */
\r
127 .long MSC_IRQHandler /* 35 - MSC */
\r
128 .long AES_IRQHandler /* 36 - AES */
\r
129 .long EBI_IRQHandler /* 37 - EBI */
\r
130 .long EMU_IRQHandler /* 38 - EMU */
\r
133 .size __Vectors, . - __Vectors
\r
139 .globl Reset_Handler
\r
140 .type Reset_Handler, %function
\r
142 #ifndef __NO_SYSTEM_INIT
\r
143 ldr r0, =SystemInit
\r
147 /* Firstly it copies data from read only memory to RAM. There are two schemes
\r
148 * to copy. One can copy more than one sections. Another can only copy
\r
149 * one section. The former scheme needs more instructions and read-only
\r
150 * data to implement than the latter.
\r
151 * Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes. */
\r
153 #ifdef __STARTUP_COPY_MULTIPLE
\r
154 /* Multiple sections scheme.
\r
156 * Between symbol address __copy_table_start__ and __copy_table_end__,
\r
157 * there are array of triplets, each of which specify:
\r
158 * offset 0: LMA of start of a section to copy from
\r
159 * offset 4: VMA of start of a section to copy to
\r
160 * offset 8: size of the section to copy. Must be multiply of 4
\r
162 * All addresses must be aligned to 4 bytes boundary.
\r
164 ldr r4, =__copy_table_start__
\r
165 ldr r5, =__copy_table_end__
\r
186 /* Single section scheme.
\r
188 * The ranges of copy from/to are specified by following symbols
\r
189 * __etext: LMA of start of the section to copy from. Usually end of text
\r
190 * __data_start__: VMA of start of the section to copy to
\r
191 * __data_end__: VMA of end of the section to copy to
\r
193 * All addresses must be aligned to 4 bytes boundary.
\r
196 ldr r2, =__data_start__
\r
197 ldr r3, =__data_end__
\r
205 #endif /*__STARTUP_COPY_MULTIPLE */
\r
207 /* This part of work usually is done in C library startup code. Otherwise,
\r
208 * define this macro to enable it in this startup.
\r
210 * There are two schemes too. One can clear multiple BSS sections. Another
\r
211 * can only clear one section. The former is more size expensive than the
\r
214 * Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former.
\r
215 * Otherwise efine macro __STARTUP_CLEAR_BSS to choose the later.
\r
217 #ifdef __STARTUP_CLEAR_BSS_MULTIPLE
\r
218 /* Multiple sections scheme.
\r
220 * Between symbol address __copy_table_start__ and __copy_table_end__,
\r
221 * there are array of tuples specifying:
\r
222 * offset 0: Start of a BSS section
\r
223 * offset 4: Size of this BSS section. Must be multiply of 4
\r
225 ldr r3, =__zero_table_start__
\r
226 ldr r4, =__zero_table_end__
\r
243 #elif defined (__STARTUP_CLEAR_BSS)
\r
244 /* Single BSS section scheme.
\r
246 * The BSS section is specified by following symbols
\r
247 * __bss_start__: start of the BSS section.
\r
248 * __bss_end__: end of the BSS section.
\r
250 * Both addresses must be aligned to 4 bytes boundary.
\r
252 ldr r1, =__bss_start__
\r
253 ldr r2, =__bss_end__
\r
261 #endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */
\r
264 #define __START _start
\r
269 .size Reset_Handler, . - Reset_Handler
\r
273 .weak Default_Handler
\r
274 .type Default_Handler, %function
\r
277 .size Default_Handler, . - Default_Handler
\r
279 /* Macro to define default handlers. Default handler
\r
280 * will be weak symbol and just dead loops. They can be
\r
281 * overwritten by other handlers */
\r
282 .macro def_irq_handler handler_name
\r
283 .weak \handler_name
\r
284 .set \handler_name, Default_Handler
\r
287 def_irq_handler NMI_Handler
\r
288 def_irq_handler HardFault_Handler
\r
289 def_irq_handler MemManage_Handler
\r
290 def_irq_handler BusFault_Handler
\r
291 def_irq_handler UsageFault_Handler
\r
292 def_irq_handler SVC_Handler
\r
293 def_irq_handler DebugMon_Handler
\r
294 def_irq_handler PendSV_Handler
\r
295 def_irq_handler SysTick_Handler
\r
297 def_irq_handler DMA_IRQHandler
\r
298 def_irq_handler GPIO_EVEN_IRQHandler
\r
299 def_irq_handler TIMER0_IRQHandler
\r
300 def_irq_handler USART0_RX_IRQHandler
\r
301 def_irq_handler USART0_TX_IRQHandler
\r
302 def_irq_handler USB_IRQHandler
\r
303 def_irq_handler ACMP0_IRQHandler
\r
304 def_irq_handler ADC0_IRQHandler
\r
305 def_irq_handler DAC0_IRQHandler
\r
306 def_irq_handler I2C0_IRQHandler
\r
307 def_irq_handler I2C1_IRQHandler
\r
308 def_irq_handler GPIO_ODD_IRQHandler
\r
309 def_irq_handler TIMER1_IRQHandler
\r
310 def_irq_handler TIMER2_IRQHandler
\r
311 def_irq_handler TIMER3_IRQHandler
\r
312 def_irq_handler USART1_RX_IRQHandler
\r
313 def_irq_handler USART1_TX_IRQHandler
\r
314 def_irq_handler LESENSE_IRQHandler
\r
315 def_irq_handler USART2_RX_IRQHandler
\r
316 def_irq_handler USART2_TX_IRQHandler
\r
317 def_irq_handler UART0_RX_IRQHandler
\r
318 def_irq_handler UART0_TX_IRQHandler
\r
319 def_irq_handler UART1_RX_IRQHandler
\r
320 def_irq_handler UART1_TX_IRQHandler
\r
321 def_irq_handler LEUART0_IRQHandler
\r
322 def_irq_handler LEUART1_IRQHandler
\r
323 def_irq_handler LETIMER0_IRQHandler
\r
324 def_irq_handler PCNT0_IRQHandler
\r
325 def_irq_handler PCNT1_IRQHandler
\r
326 def_irq_handler PCNT2_IRQHandler
\r
327 def_irq_handler RTC_IRQHandler
\r
328 def_irq_handler BURTC_IRQHandler
\r
329 def_irq_handler CMU_IRQHandler
\r
330 def_irq_handler VCMP_IRQHandler
\r
331 def_irq_handler LCD_IRQHandler
\r
332 def_irq_handler MSC_IRQHandler
\r
333 def_irq_handler AES_IRQHandler
\r
334 def_irq_handler EBI_IRQHandler
\r
335 def_irq_handler EMU_IRQHandler
\r