1 /* @file startup_efm32pg1b.S
\r
2 * @brief startup file for Silicon Labs EFM32PG1B 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 EMU_IRQHandler /* 0 - EMU */
\r
92 .long Default_Handler /* 1 - Reserved */
\r
93 .long WDOG0_IRQHandler /* 2 - WDOG0 */
\r
94 .long Default_Handler /* 3 - Reserved */
\r
95 .long Default_Handler /* 4 - Reserved */
\r
96 .long Default_Handler /* 5 - Reserved */
\r
97 .long Default_Handler /* 6 - Reserved */
\r
98 .long Default_Handler /* 7 - Reserved */
\r
99 .long LDMA_IRQHandler /* 8 - LDMA */
\r
100 .long GPIO_EVEN_IRQHandler /* 9 - GPIO_EVEN */
\r
101 .long TIMER0_IRQHandler /* 10 - TIMER0 */
\r
102 .long USART0_RX_IRQHandler /* 11 - USART0_RX */
\r
103 .long USART0_TX_IRQHandler /* 12 - USART0_TX */
\r
104 .long ACMP0_IRQHandler /* 13 - ACMP0 */
\r
105 .long ADC0_IRQHandler /* 14 - ADC0 */
\r
106 .long IDAC0_IRQHandler /* 15 - IDAC0 */
\r
107 .long I2C0_IRQHandler /* 16 - I2C0 */
\r
108 .long GPIO_ODD_IRQHandler /* 17 - GPIO_ODD */
\r
109 .long TIMER1_IRQHandler /* 18 - TIMER1 */
\r
110 .long USART1_RX_IRQHandler /* 19 - USART1_RX */
\r
111 .long USART1_TX_IRQHandler /* 20 - USART1_TX */
\r
112 .long LEUART0_IRQHandler /* 21 - LEUART0 */
\r
113 .long PCNT0_IRQHandler /* 22 - PCNT0 */
\r
114 .long CMU_IRQHandler /* 23 - CMU */
\r
115 .long MSC_IRQHandler /* 24 - MSC */
\r
116 .long CRYPTO_IRQHandler /* 25 - CRYPTO */
\r
117 .long LETIMER0_IRQHandler /* 26 - LETIMER0 */
\r
118 .long Default_Handler /* 27 - Reserved */
\r
119 .long Default_Handler /* 28 - Reserved */
\r
120 .long RTCC_IRQHandler /* 29 - RTCC */
\r
121 .long Default_Handler /* 30 - Reserved */
\r
122 .long CRYOTIMER_IRQHandler /* 31 - CRYOTIMER */
\r
123 .long Default_Handler /* 32 - Reserved */
\r
124 .long FPUEH_IRQHandler /* 33 - FPUEH */
\r
127 .size __Vectors, . - __Vectors
\r
133 .globl Reset_Handler
\r
134 .type Reset_Handler, %function
\r
136 #ifndef __NO_SYSTEM_INIT
\r
137 ldr r0, =SystemInit
\r
141 /* Firstly it copies data from read only memory to RAM. There are two schemes
\r
142 * to copy. One can copy more than one sections. Another can only copy
\r
143 * one section. The former scheme needs more instructions and read-only
\r
144 * data to implement than the latter.
\r
145 * Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes. */
\r
147 #ifdef __STARTUP_COPY_MULTIPLE
\r
148 /* Multiple sections scheme.
\r
150 * Between symbol address __copy_table_start__ and __copy_table_end__,
\r
151 * there are array of triplets, each of which specify:
\r
152 * offset 0: LMA of start of a section to copy from
\r
153 * offset 4: VMA of start of a section to copy to
\r
154 * offset 8: size of the section to copy. Must be multiply of 4
\r
156 * All addresses must be aligned to 4 bytes boundary.
\r
158 ldr r4, =__copy_table_start__
\r
159 ldr r5, =__copy_table_end__
\r
180 /* Single section scheme.
\r
182 * The ranges of copy from/to are specified by following symbols
\r
183 * __etext: LMA of start of the section to copy from. Usually end of text
\r
184 * __data_start__: VMA of start of the section to copy to
\r
185 * __data_end__: VMA of end of the section to copy to
\r
187 * All addresses must be aligned to 4 bytes boundary.
\r
190 ldr r2, =__data_start__
\r
191 ldr r3, =__data_end__
\r
199 #endif /*__STARTUP_COPY_MULTIPLE */
\r
201 /* This part of work usually is done in C library startup code. Otherwise,
\r
202 * define this macro to enable it in this startup.
\r
204 * There are two schemes too. One can clear multiple BSS sections. Another
\r
205 * can only clear one section. The former is more size expensive than the
\r
208 * Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former.
\r
209 * Otherwise efine macro __STARTUP_CLEAR_BSS to choose the later.
\r
211 #ifdef __STARTUP_CLEAR_BSS_MULTIPLE
\r
212 /* Multiple sections scheme.
\r
214 * Between symbol address __copy_table_start__ and __copy_table_end__,
\r
215 * there are array of tuples specifying:
\r
216 * offset 0: Start of a BSS section
\r
217 * offset 4: Size of this BSS section. Must be multiply of 4
\r
219 ldr r3, =__zero_table_start__
\r
220 ldr r4, =__zero_table_end__
\r
237 #elif defined (__STARTUP_CLEAR_BSS)
\r
238 /* Single BSS section scheme.
\r
240 * The BSS section is specified by following symbols
\r
241 * __bss_start__: start of the BSS section.
\r
242 * __bss_end__: end of the BSS section.
\r
244 * Both addresses must be aligned to 4 bytes boundary.
\r
246 ldr r1, =__bss_start__
\r
247 ldr r2, =__bss_end__
\r
255 #endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */
\r
258 #define __START _start
\r
263 .size Reset_Handler, . - Reset_Handler
\r
267 .weak Default_Handler
\r
268 .type Default_Handler, %function
\r
271 .size Default_Handler, . - Default_Handler
\r
273 /* Macro to define default handlers. Default handler
\r
274 * will be weak symbol and just dead loops. They can be
\r
275 * overwritten by other handlers */
\r
276 .macro def_irq_handler handler_name
\r
277 .weak \handler_name
\r
278 .set \handler_name, Default_Handler
\r
281 def_irq_handler NMI_Handler
\r
282 def_irq_handler HardFault_Handler
\r
283 def_irq_handler MemManage_Handler
\r
284 def_irq_handler BusFault_Handler
\r
285 def_irq_handler UsageFault_Handler
\r
286 def_irq_handler SVC_Handler
\r
287 def_irq_handler DebugMon_Handler
\r
288 def_irq_handler PendSV_Handler
\r
289 def_irq_handler SysTick_Handler
\r
292 def_irq_handler EMU_IRQHandler
\r
293 def_irq_handler WDOG0_IRQHandler
\r
294 def_irq_handler LDMA_IRQHandler
\r
295 def_irq_handler GPIO_EVEN_IRQHandler
\r
296 def_irq_handler TIMER0_IRQHandler
\r
297 def_irq_handler USART0_RX_IRQHandler
\r
298 def_irq_handler USART0_TX_IRQHandler
\r
299 def_irq_handler ACMP0_IRQHandler
\r
300 def_irq_handler ADC0_IRQHandler
\r
301 def_irq_handler IDAC0_IRQHandler
\r
302 def_irq_handler I2C0_IRQHandler
\r
303 def_irq_handler GPIO_ODD_IRQHandler
\r
304 def_irq_handler TIMER1_IRQHandler
\r
305 def_irq_handler USART1_RX_IRQHandler
\r
306 def_irq_handler USART1_TX_IRQHandler
\r
307 def_irq_handler LEUART0_IRQHandler
\r
308 def_irq_handler PCNT0_IRQHandler
\r
309 def_irq_handler CMU_IRQHandler
\r
310 def_irq_handler MSC_IRQHandler
\r
311 def_irq_handler CRYPTO_IRQHandler
\r
312 def_irq_handler LETIMER0_IRQHandler
\r
313 def_irq_handler RTCC_IRQHandler
\r
314 def_irq_handler CRYOTIMER_IRQHandler
\r
315 def_irq_handler FPUEH_IRQHandler
\r