startup_mb9bf56xr.S 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. /**************************************************************************//**
  2. * @file startup_<Device>.s
  3. * @brief CMSIS Cortex-M# Core Device Startup File for
  4. * Device <Device>
  5. * @version V3.01
  6. * @date 06. March 2012
  7. *
  8. * @note Version CodeSourcery Sourcery G++ Lite (with CS3)
  9. * Copyright (C) 2012 ARM Limited. All rights reserved.
  10. *
  11. * @par
  12. * ARM Limited (ARM) is supplying this software for use with Cortex-M
  13. * processor based microcontrollers. This file can be freely distributed
  14. * within development tools that are supporting such ARM based processors.
  15. *
  16. * @par
  17. * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  18. * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  19. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  20. * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  21. * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  22. *
  23. ******************************************************************************/
  24. /*
  25. //-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
  26. */
  27. /*
  28. // <h> Stack Configuration
  29. // <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  30. // </h>
  31. */
  32. .equ Stack_Size, 0x00000400
  33. .section ".stack", "w"
  34. .align 3
  35. .globl __cs3_stack_mem
  36. .globl __cs3_stack_size
  37. __cs3_stack_mem:
  38. .if Stack_Size
  39. .space Stack_Size
  40. .endif
  41. .size __cs3_stack_mem, . - __cs3_stack_mem
  42. .set __cs3_stack_size, . - __cs3_stack_mem
  43. /*
  44. // <h> Heap Configuration
  45. // <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  46. // </h>
  47. */
  48. .equ Heap_Size, 0x00000100
  49. .section ".heap", "w"
  50. .align 3
  51. .globl __cs3_heap_start
  52. .globl __cs3_heap_end
  53. __cs3_heap_start:
  54. .if Heap_Size
  55. .space Heap_Size
  56. .endif
  57. __cs3_heap_end:
  58. /* Vector Table */
  59. .section ".cs3.interrupt_vector"
  60. .globl __cs3_interrupt_vector_cortex_m
  61. .type __cs3_interrupt_vector_cortex_m, %object
  62. __cs3_interrupt_vector_cortex_m:
  63. .long __cs3_stack /* Top of Stack */
  64. .long __cs3_reset /* Reset Handler */
  65. .long NMI_Handler /* NMI Handler */
  66. .long HardFault_Handler /* Hard Fault Handler */
  67. .long MemManage_Handler /* MPU Fault Handler */
  68. .long BusFault_Handler /* Bus Fault Handler */
  69. .long UsageFault_Handler /* Usage Fault Handler */
  70. .long 0 /* Reserved */
  71. .long 0 /* Reserved */
  72. .long 0 /* Reserved */
  73. .long 0 /* Reserved */
  74. .long SVC_Handler /* SVCall Handler */
  75. .long DebugMon_Handler /* Debug Monitor Handler */
  76. .long 0 /* Reserved */
  77. .long PendSV_Handler /* PendSV Handler */
  78. .long SysTick_Handler /* SysTick Handler */
  79. /* External Interrupts */
  80. /* ToDo: Add here the vectors for the device specific external interrupts handler */
  81. .long CSV_Handler /* 0: Clock Super Visor */
  82. .long SWDT_Handler /* 1: Software Watchdog Timer */
  83. .long LVD_Handler /* 2: Low Voltage Detector */
  84. .long MFT_WG_IRQHandler /* 3: Wave Form Generator / DTIF */
  85. .long INT0_7_Handler /* 4: External Interrupt Request ch.0 to ch.7 */
  86. .long INT8_15_Handler /* 5: External Interrupt Request ch.8 to ch.15 */
  87. .long DT_Handler /* 6: Dual Timer / Quad Decoder */
  88. .long MFS0RX_IRQHandler /* 7: MultiFunction Serial ch.0 */
  89. .long MFS0TX_IRQHandler /* 8: MultiFunction Serial ch.0 */
  90. .long MFS1RX_IRQHandler /* 9: MultiFunction Serial ch.1 */
  91. .long MFS1TX_IRQHandler /* 10: MultiFunction Serial ch.1 */
  92. .long MFS2RX_IRQHandler /* 11: MultiFunction Serial ch.2 */
  93. .long MFS2TX_IRQHandler /* 12: MultiFunction Serial ch.2 */
  94. .long MFS3RX_IRQHandler /* 13: MultiFunction Serial ch.3 */
  95. .long MFS3TX_IRQHandler /* 14: MultiFunction Serial ch.3 */
  96. .long MFS4RX_IRQHandler /* 15: MultiFunction Serial ch.4 */
  97. .long MFS4TX_IRQHandler /* 16: MultiFunction Serial ch.4 */
  98. .long MFS5RX_IRQHandler /* 17: MultiFunction Serial ch.5 */
  99. .long MFS5TX_IRQHandler /* 18: MultiFunction Serial ch.5 */
  100. .long MFS6RX_IRQHandler /* 19: MultiFunction Serial ch.6 */
  101. .long MFS6TX_IRQHandler /* 20: MultiFunction Serial ch.6 */
  102. .long MFS7RX_IRQHandler /* 21: MultiFunction Serial ch.7 */
  103. .long MFS7TX_IRQHandler /* 22: MultiFunction Serial ch.7 */
  104. .long PPG_Handler /* 23: PPG */
  105. .long TIM_IRQHandler /* 24: OSC / PLL / Watch Counter */
  106. .long ADC0_IRQHandler /* 25: ADC0 */
  107. .long ADC1_IRQHandler /* 26: ADC1 */
  108. .long ADC2_IRQHandler /* 27: ADC2 */
  109. .long MFT_FRT_IRQHandler /* 28: Free-run Timer */
  110. .long MFT_IPC_IRQHandler /* 29: Input Capture */
  111. .long MFT_OPC_IRQHandler /* 30: Output Compare */
  112. .long BT_IRQHandler /* 31: Base Timer ch.0 to ch.7 */
  113. .long CAN0_IRQHandler /* 32: CAN ch.0 */
  114. .long CAN1_IRQHandler /* 33: CAN ch.1 */
  115. .long USBF_Handler /* 34: USB Function */
  116. .long USB_Handler /* 35: USB Function / USB HOST */
  117. .long RESERVED_1_IRQHandler /* 36: Reserved */
  118. .long RESERVED_2_IRQHandler /* 37: Reserved */
  119. .long DMAC0_Handler /* 38: DMAC ch.0 */
  120. .long DMAC1_Handler /* 39: DMAC ch.1 */
  121. .long DMAC2_Handler /* 40: DMAC ch.2 */
  122. .long DMAC3_Handler /* 41: DMAC ch.3 */
  123. .long DMAC4_Handler /* 42: DMAC ch.4 */
  124. .long DMAC5_Handler /* 43: DMAC ch.5 */
  125. .long DMAC6_Handler /* 44: DMAC ch.6 */
  126. .long DMAC7_Handler /* 45: DMAC ch.7 */
  127. .long RESERVED_3_IRQHandler /* 46: Reserved */
  128. .long RESERVED_4_IRQHandler /* 47: Reserved */
  129. .size __cs3_interrupt_vector_cortex_m, . - __cs3_interrupt_vector_cortex_m
  130. .thumb
  131. /* Reset Handler */
  132. .section .cs3.reset,"x",%progbits
  133. .thumb_func
  134. .globl __cs3_reset_cortex_m
  135. .globl _start
  136. .type __cs3_reset_cortex_m, %function
  137. __cs3_reset_cortex_m:
  138. _start:
  139. .fnstart
  140. LDR R0, =SystemInit
  141. BLX R0
  142. LDR R0,=_start
  143. BX R0
  144. .pool
  145. .cantunwind
  146. .fnend
  147. .size __cs3_reset_cortex_m,.-__cs3_reset_cortex_m
  148. .section ".text"
  149. /* Exception Handlers */
  150. .weak NMI_Handler
  151. .type NMI_Handler, %function
  152. NMI_Handler:
  153. B .
  154. .size NMI_Handler, . - NMI_Handler
  155. .weak HardFault_Handler
  156. .type HardFault_Handler, %function
  157. HardFault_Handler:
  158. B .
  159. .size HardFault_Handler, . - HardFault_Handler
  160. .weak MemManage_Handler
  161. .type MemManage_Handler, %function
  162. MemManage_Handler:
  163. B .
  164. .size MemManage_Handler, . - MemManage_Handler
  165. .weak BusFault_Handler
  166. .type BusFault_Handler, %function
  167. BusFault_Handler:
  168. B .
  169. .size BusFault_Handler, . - BusFault_Handler
  170. .weak UsageFault_Handler
  171. .type UsageFault_Handler, %function
  172. UsageFault_Handler:
  173. B .
  174. .size UsageFault_Handler, . - UsageFault_Handler
  175. .weak SVC_Handler
  176. .type SVC_Handler, %function
  177. SVC_Handler:
  178. B .
  179. .size SVC_Handler, . - SVC_Handler
  180. .weak DebugMon_Handler
  181. .type DebugMon_Handler, %function
  182. DebugMon_Handler:
  183. B .
  184. .size DebugMon_Handler, . - DebugMon_Handler
  185. .weak PendSV_Handler
  186. .type PendSV_Handler, %function
  187. PendSV_Handler:
  188. B .
  189. .size PendSV_Handler, . - PendSV_Handler
  190. .weak SysTick_Handler
  191. .type SysTick_Handler, %function
  192. SysTick_Handler:
  193. B .
  194. .size SysTick_Handler, . - SysTick_Handler
  195. /* IRQ Handlers */
  196. /* ToDo: Add here the export definition for the device specific external interrupts handler */
  197. /* ToDo: Add here the names for the device specific external interrupts handler */
  198. .globl Default_Handler
  199. .type Default_Handler, %function
  200. Default_Handler:
  201. B .
  202. .size Default_Handler, . - Default_Handler
  203. .macro IRQ handler
  204. .weak \handler
  205. .set \handler, Default_Handler
  206. .endm
  207. IRQ CSV_Handler /* 0: Clock Super Visor */
  208. IRQ SWDT_Handler /* 1: Software Watchdog Timer */
  209. IRQ LVD_Handler /* 2: Low Voltage Detector */
  210. IRQ MFT_WG_IRQHandler /* 3: Wave Form Generator / DTIF */
  211. IRQ INT0_7_Handler /* 4: External Interrupt Request ch.0 to ch.7 */
  212. IRQ INT8_15_Handler /* 5: External Interrupt Request ch.8 to ch.15 */
  213. IRQ DT_Handler /* 6: Dual Timer / Quad Decoder */
  214. IRQ MFS0RX_IRQHandler /* 7: MultiFunction Serial ch.0 */
  215. IRQ MFS0TX_IRQHandler /* 8: MultiFunction Serial ch.0 */
  216. IRQ MFS1RX_IRQHandler /* 9: MultiFunction Serial ch.1 */
  217. IRQ MFS1TX_IRQHandler /* 10: MultiFunction Serial ch.1 */
  218. IRQ MFS2RX_IRQHandler /* 11: MultiFunction Serial ch.2 */
  219. IRQ MFS2TX_IRQHandler /* 12: MultiFunction Serial ch.2 */
  220. IRQ MFS3RX_IRQHandler /* 13: MultiFunction Serial ch.3 */
  221. IRQ MFS3TX_IRQHandler /* 14: MultiFunction Serial ch.3 */
  222. IRQ MFS4RX_IRQHandler /* 15: MultiFunction Serial ch.4 */
  223. IRQ MFS4TX_IRQHandler /* 16: MultiFunction Serial ch.4 */
  224. IRQ MFS5RX_IRQHandler /* 17: MultiFunction Serial ch.5 */
  225. IRQ MFS5TX_IRQHandler /* 18: MultiFunction Serial ch.5 */
  226. IRQ MFS6RX_IRQHandler /* 19: MultiFunction Serial ch.6 */
  227. IRQ MFS6TX_IRQHandler /* 20: MultiFunction Serial ch.6 */
  228. IRQ MFS7RX_IRQHandler /* 21: MultiFunction Serial ch.7 */
  229. IRQ MFS7TX_IRQHandler /* 22: MultiFunction Serial ch.7 */
  230. IRQ PPG_Handler /* 23: PPG */
  231. IRQ TIM_IRQHandler /* 24: OSC / PLL / Watch Counter */
  232. IRQ ADC0_IRQHandler /* 25: ADC0 */
  233. IRQ ADC1_IRQHandler /* 26: ADC1 */
  234. IRQ ADC2_IRQHandler /* 27: ADC2 */
  235. IRQ MFT_FRT_IRQHandler /* 28: Free-run Timer */
  236. IRQ MFT_IPC_IRQHandler /* 29: Input Capture */
  237. IRQ MFT_OPC_IRQHandler /* 30: Output Compare */
  238. IRQ BT_IRQHandler /* 31: Base Timer ch.0 to ch.7 */
  239. IRQ CAN0_IRQHandler /* 32: CAN ch.0 */
  240. IRQ CAN1_IRQHandler /* 33: CAN ch.1 */
  241. IRQ USBF_Handler /* 34: USB Function */
  242. IRQ USB_Handler /* 35: USB Function / USB HOST */
  243. IRQ RESERVED_1_IRQHandler /* 36: Reserved */
  244. IRQ RESERVED_2_IRQHandler /* 37: Reserved */
  245. IRQ DMAC0_Handler /* 38: DMAC ch.0 */
  246. IRQ DMAC1_Handler /* 39: DMAC ch.1 */
  247. IRQ DMAC2_Handler /* 40: DMAC ch.2 */
  248. IRQ DMAC3_Handler /* 41: DMAC ch.3 */
  249. IRQ DMAC4_Handler /* 42: DMAC ch.4 */
  250. IRQ DMAC5_Handler /* 43: DMAC ch.5 */
  251. IRQ DMAC6_Handler /* 44: DMAC ch.6 */
  252. IRQ DMAC7_Handler /* 45: DMAC ch.7 */
  253. IRQ RESERVED_3_IRQHandler /* 46: Reserved */
  254. IRQ RESERVED_4_IRQHandler /* 47: Reserved */
  255. .end