1/**************************************************************************//** 2 * @file startup_ARMCM3.s 3 * @brief CMSIS Cortex-M3 Core Device Startup File 4 * for CM3 Device Series 5 * @version V1.04 6 * @date 14. January 2011 7 *------- <<< Use Configuration Wizard in Context Menu >>> ------------------ 8 * 9 ******************************************************************************/ 10 11/*****************************************************************************/ 12/* Version: CodeSourcery Sourcery G++ Lite (with CS3) */ 13/*****************************************************************************/ 14 15 16/* 17// <h> Stack Configuration 18// <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 19// </h> 20*/ 21 22 .equ Stack_Size, 0x00000100 23 .section ".stack", "w" 24 .align 3 25 .globl __cs3_stack_mem 26 .globl __cs3_stack_size 27__cs3_stack_mem: 28 .if Stack_Size 29 .space Stack_Size 30 .endif 31 .size __cs3_stack_mem, . - __cs3_stack_mem 32 .set __cs3_stack_size, . - __cs3_stack_mem 33 34 35/* 36// <h> Heap Configuration 37// <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 38// </h> 39*/ 40 41 .equ Heap_Size, 0x00001000 42 43 .section ".heap", "w" 44 .align 3 45 .globl __cs3_heap_start 46 .globl __cs3_heap_end 47__cs3_heap_start: 48 .if Heap_Size 49 .space Heap_Size 50 .endif 51__cs3_heap_end: 52 53 54/* Vector Table */ 55 56 .section ".cs3.interrupt_vector" 57 .globl __cs3_interrupt_vector_cortex_m 58 .type __cs3_interrupt_vector_cortex_m, %object 59 60__cs3_interrupt_vector_cortex_m: 61 .long __cs3_stack /* Top of Stack */ 62 .long __cs3_reset /* Reset Handler */ 63 .long NMI_Handler /* NMI Handler */ 64 .long HardFault_Handler /* Hard Fault Handler */ 65 .long MemManage_Handler /* MPU Fault Handler */ 66 .long BusFault_Handler /* Bus Fault Handler */ 67 .long UsageFault_Handler /* Usage Fault Handler */ 68 .long 0 /* Reserved */ 69 .long 0 /* Reserved */ 70 .long 0 /* Reserved */ 71 .long 0 /* Reserved */ 72 .long SVC_Handler /* SVCall Handler */ 73 .long DebugMon_Handler /* Debug Monitor Handler */ 74 .long 0 /* Reserved */ 75 .long PendSV_Handler /* PendSV Handler */ 76 .long SysTick_Handler /* SysTick Handler */ 77 78 /* External Interrupts */ 79 .long DEF_IRQHandler /* 0: Default */ 80 81 82 .size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m 83 84 85 .thumb 86 87 88/* Reset Handler */ 89 90 .section .cs3.reset,"x",%progbits 91 .thumb_func 92 .globl __cs3_reset_cortex_m 93 .type __cs3_reset_cortex_m, %function 94__cs3_reset_cortex_m: 95 .fnstart 96 LDR R0, =SystemInit 97 BLX R0 98 LDR R0,=_start 99 BX R0 100 .pool 101 .cantunwind 102 .fnend 103 .size __cs3_reset_cortex_m,.-__cs3_reset_cortex_m 104 105 .section ".text" 106 107/* Exception Handlers */ 108 109 .weak NMI_Handler 110 .type NMI_Handler, %function 111NMI_Handler: 112 B . 113 .size NMI_Handler, . - NMI_Handler 114 115 .weak HardFault_Handler 116 .type HardFault_Handler, %function 117HardFault_Handler: 118 B . 119 .size HardFault_Handler, . - HardFault_Handler 120 121 .weak MemManage_Handler 122 .type MemManage_Handler, %function 123MemManage_Handler: 124 B . 125 .size MemManage_Handler, . - MemManage_Handler 126 127 .weak BusFault_Handler 128 .type BusFault_Handler, %function 129BusFault_Handler: 130 B . 131 .size BusFault_Handler, . - BusFault_Handler 132 133 .weak UsageFault_Handler 134 .type UsageFault_Handler, %function 135UsageFault_Handler: 136 B . 137 .size UsageFault_Handler, . - UsageFault_Handler 138 139 .weak SVC_Handler 140 .type SVC_Handler, %function 141SVC_Handler: 142 B . 143 .size SVC_Handler, . - SVC_Handler 144 145 .weak DebugMon_Handler 146 .type DebugMon_Handler, %function 147DebugMon_Handler: 148 B . 149 .size DebugMon_Handler, . - DebugMon_Handler 150 151 .weak PendSV_Handler 152 .type PendSV_Handler, %function 153PendSV_Handler: 154 B . 155 .size PendSV_Handler, . - PendSV_Handler 156 157 .weak SysTick_Handler 158 .type SysTick_Handler, %function 159SysTick_Handler: 160 B . 161 .size SysTick_Handler, . - SysTick_Handler 162 163 164/* IRQ Handlers */ 165 166 .globl Default_Handler 167 .type Default_Handler, %function 168Default_Handler: 169 B . 170 .size Default_Handler, . - Default_Handler 171 172 .macro IRQ handler 173 .weak \handler 174 .set \handler, Default_Handler 175 .endm 176 177 IRQ DEF_IRQHandler 178 179 .end 180