Startup_ACM32F0x0_gcc.s 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. /*******************************************************************************
  2. ;* File Name : Startup_ACM32F0x0_gcc.s
  3. ;* Version : V1.0.0
  4. ;* Date : 2021
  5. ;* Description : ACM32F0x0 Devices vector table for GCC toolchain.
  6. ;* This module performs:
  7. ;* - Set the initial SP
  8. ;* - Set the initial PC == Reset_Handler
  9. ;* - Set the vector table entries with the exceptions ISR address
  10. ;* - Configure the clock system
  11. ;* - Branches to __main in the C library (which eventually
  12. ;* calls main()).
  13. ;* After Reset the SC000 processor is in Thread mode,
  14. ;* priority is Privileged, and the Stack is set to Main.
  15. ;*******************************************************************************/
  16. .syntax unified
  17. .cpu cortex-m0
  18. .fpu softvfp
  19. .thumb
  20. .global g_pfnVectors
  21. .global Default_Handler
  22. /* start address for the initialization values of the .data section.
  23. defined in linker script */
  24. .word _sidata
  25. /* start address for the .data section. defined in linker script */
  26. .word _sdata
  27. /* end address for the .data section. defined in linker script */
  28. .word _edata
  29. /* start address for the .bss section. defined in linker script */
  30. .word _sbss
  31. /* end address for the .bss section. defined in linker script */
  32. .word _ebss
  33. /**
  34. * @brief This is the code that gets called when the processor first
  35. * starts execution following a reset event. Only the absolutely
  36. * necessary set is performed, after which the application
  37. * supplied main() routine is called.
  38. * @param None
  39. * @retval : None
  40. */
  41. .section .text.Reset_Handler
  42. .weak Reset_Handler
  43. .type Reset_Handler, %function
  44. Reset_Handler:
  45. /* Copy the data segment initializers from flash to SRAM */
  46. movs r1, #0
  47. b LoopCopyDataInit
  48. CopyDataInit:
  49. ldr r3, =_sidata
  50. ldr r3, [r3, r1]
  51. str r3, [r0, r1]
  52. adds r1, r1, #4
  53. LoopCopyDataInit:
  54. ldr r0, =_sdata
  55. ldr r3, =_edata
  56. adds r2, r0, r1
  57. cmp r2, r3
  58. bcc CopyDataInit
  59. ldr r2, =_sbss
  60. b LoopFillZerobss
  61. /* Zero fill the bss segment. */
  62. FillZerobss:
  63. movs r3, #0
  64. str r3, [r2, #4]
  65. adds r2, r2, #4
  66. LoopFillZerobss:
  67. ldr r3, = _ebss
  68. cmp r2, r3
  69. bcc FillZerobss
  70. /* Call the clock system intitialization function.*/
  71. /* bl SystemInit */
  72. /* Call the application's entry point.*/
  73. bl entry
  74. LoopForever:
  75. b LoopForever
  76. .size Reset_Handler, .-Reset_Handler
  77. /**
  78. * @brief This is the code that gets called when the processor receives an
  79. * unexpected interrupt. This simply enters an infinite loop, preserving
  80. * the system state for examination by a debugger.
  81. *
  82. * @param None
  83. * @retval None
  84. */
  85. .section .text.Default_Handler,"ax",%progbits
  86. Default_Handler:
  87. Infinite_Loop:
  88. b Infinite_Loop
  89. .size Default_Handler, .-Default_Handler
  90. /*******************************************************************************
  91. *
  92. * The minimal vector table for a Cortex M0. Note that the proper constructs
  93. * must be placed on this to ensure that it ends up at physical address
  94. * 0x0000.0000.
  95. *******************************************************************************/
  96. .section .isr_vector,"a",%progbits
  97. .type g_pfnVectors, %object
  98. .size g_pfnVectors, .-g_pfnVectors
  99. g_pfnVectors:
  100. .word _estack
  101. .word Reset_Handler
  102. .word NMI_Handler
  103. .word HardFault_Handler
  104. .word MemManage_Handler
  105. .word 0
  106. .word 0
  107. .word 0
  108. .word 0
  109. .word 0
  110. .word 0
  111. .word SVC_Handler
  112. .word 0
  113. .word 0
  114. .word PendSV_Handler
  115. .word SysTick_Handler
  116. /* External Interrupts */
  117. .word WDT_IRQHandler /* 0: WDT_IRQHandler */
  118. .word RTC_IRQHandler /* 1: RTC_IRQHandler */
  119. .word EFC_IRQHandler /* 2: EFC_IRQHandler */
  120. .word GPIOAB_IRQHandler /* 3: GPIOAB_IRQHandler */
  121. .word GPIOCD_IRQHandler /* 4: GPIOCD_IRQHandler */
  122. .word EXTI_IRQHandler /* 5: EXTI_IRQHandler */
  123. .word SRAM_PARITY_IRQHandler /* 6: SRAM_PARITY_IRQHandler */
  124. .word CLKRDY_IRQHandler /* 7: CLKRDY_IRQHandler */
  125. .word LCD_IRQHandler /* 8: LCD_IRQHandler */
  126. .word DMA_IRQHandler /* 9: DMA_IRQHandler */
  127. .word UART3_IRQHandler /* 10: UART3_IRQHandler */
  128. .word TKEY_IRQHandler /* 11: TKEY_IRQHandler */
  129. .word ADC_IRQHandler /* 12: ADC_IRQHandler */
  130. .word TIM1_BRK_UP_TRG_COM_IRQHandler /* 13: TIM1_BRK_UP_TRG_COM_IRQHandler */
  131. .word TIM1_CC_IRQHandler /* 14: TIM1_CC_IRQHandler */
  132. .word RSV_IRQHandler /* 15: Reserved */
  133. .word TIM3_IRQHandler /* 16: TIM3_IRQHandler */
  134. .word TIM6_IRQHandler /* 17: TIM6_IRQHandler */
  135. .word RSV_IRQHandler /* 18: Reserved */
  136. .word TIM14_IRQHandler /* 19: TIM14_IRQHandler */
  137. .word TIM15_IRQHandler /* 20: TIM15_IRQHandler */
  138. .word TIM16_IRQHandler /* 21: TIM16_IRQHandler */
  139. .word TIM17_IRQHandler /* 22: TIM17_IRQHandler */
  140. .word I2C1_IRQHandler /* 23: I2C1_IRQHandler */
  141. .word I2C2_IRQHandler /* 24: I2C2_IRQHandler */
  142. .word SPI1_IRQHandler /* 25: SPI1_IRQHandler */
  143. .word SPI2_IRQHandler /* 26: SPI2_IRQHandler */
  144. .word UART1_IRQHandler /* 27: UART1_IRQHandler */
  145. .word UART2_IRQHandler /* 28: UART2_IRQHandler */
  146. .word LPUART_IRQHandler /* 29: LPUART_IRQHandler */
  147. .word CAN1_IRQHandler /* 30: CAN1_IRQHandler */
  148. .word AES_IRQHandler /* 31: AES_IRQHandler */
  149. /*******************************************************************************
  150. *
  151. * Provide weak aliases for each Exception handler to the Default_Handler.
  152. * As they are weak aliases, any function with the same name will override
  153. * this definition.
  154. *
  155. *******************************************************************************/
  156. .weak NMI_Handler
  157. .thumb_set NMI_Handler,Default_Handler
  158. .weak HardFault_Handler
  159. .thumb_set HardFault_Handler,Default_Handler
  160. .weak MemManage_Handler
  161. .thumb_set MemManage_Handler,Default_Handler
  162. .weak SVC_Handler
  163. .thumb_set SVC_Handler,Default_Handler
  164. .weak PendSV_Handler
  165. .thumb_set PendSV_Handler,Default_Handler
  166. .weak SysTick_Handler
  167. .thumb_set SysTick_Handler,Default_Handler
  168. .weak WDT_IRQHandler
  169. .thumb_set WDT_IRQHandler,Default_Handler
  170. .weak RTC_IRQHandler
  171. .thumb_set RTC_IRQHandler,Default_Handler
  172. .weak EFC_IRQHandler
  173. .thumb_set EFC_IRQHandler,Default_Handler
  174. .weak GPIOAB_IRQHandler
  175. .thumb_set GPIOAB_IRQHandler,Default_Handler
  176. .weak GPIOCD_IRQHandler
  177. .thumb_set GPIOCD_IRQHandler,Default_Handler
  178. .weak EXTI_IRQHandler
  179. .thumb_set EXTI_IRQHandler,Default_Handler
  180. .weak SRAM_PARITY_IRQHandler
  181. .thumb_set SRAM_PARITY_IRQHandler,Default_Handler
  182. .weak CLKRDY_IRQHandler
  183. .thumb_set CLKRDY_IRQHandler,Default_Handler
  184. .weak LCD_IRQHandler
  185. .thumb_set LCD_IRQHandler,Default_Handler
  186. .weak DMA_IRQHandler
  187. .thumb_set DMA_IRQHandler,Default_Handler
  188. .weak UART3_IRQHandler
  189. .thumb_set UART3_IRQHandler,Default_Handler
  190. .weak TKEY_IRQHandler
  191. .thumb_set TKEY_IRQHandler,Default_Handler
  192. .weak ADC_IRQHandler
  193. .thumb_set ADC_IRQHandler,Default_Handler
  194. .weak TIM1_BRK_UP_TRG_COM_IRQHandler
  195. .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler
  196. .weak TIM1_CC_IRQHandler
  197. .thumb_set TIM1_CC_IRQHandler,Default_Handler
  198. .weak TIM3_IRQHandler
  199. .thumb_set TIM3_IRQHandler,Default_Handler
  200. .weak TIM6_IRQHandler
  201. .thumb_set TIM6_IRQHandler,Default_Handler
  202. .weak RSV_IRQHandler
  203. .thumb_set RSV_IRQHandler,Default_Handler
  204. .weak TIM14_IRQHandler
  205. .thumb_set TIM14_IRQHandler,Default_Handler
  206. .weak TIM15_IRQHandler
  207. .thumb_set TIM15_IRQHandler,Default_Handler
  208. .weak TIM16_IRQHandler
  209. .thumb_set TIM16_IRQHandler,Default_Handler
  210. .weak TIM17_IRQHandler
  211. .thumb_set TIM17_IRQHandler,Default_Handler
  212. .weak I2C1_IRQHandler
  213. .thumb_set I2C2_IRQHandler,Default_Handler
  214. .weak SPI1_IRQHandler
  215. .thumb_set SPI1_IRQHandler,Default_Handler
  216. .weak SPI2_IRQHandler
  217. .thumb_set SPI2_IRQHandler,Default_Handler
  218. .weak UART1_IRQHandler
  219. .thumb_set UART1_IRQHandler,Default_Handler
  220. .weak UART2_IRQHandler
  221. .thumb_set UART2_IRQHandler,Default_Handler
  222. .weak LPUART_IRQHandler
  223. .thumb_set LPUART_IRQHandler,Default_Handler
  224. .weak CAN1_IRQHandler
  225. .thumb_set CAN1_IRQHandler,Default_Handler
  226. .weak AES_IRQHandler
  227. .thumb_set AES_IRQHandler,Default_Handler
  228. /************************ (C) COPYRIGHT AisinoChip *****END OF FILE****/