startup_hc32l130f8ua.s 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. ;/******************************************************************************
  2. ; * Copyright (C) 2021, Xiaohua Semiconductor Co., Ltd. All rights reserved.
  3. ; *
  4. ; * This software component is licensed by XHSC under BSD 3-Clause license
  5. ; * (the "License"); You may not use this file except in compliance with the
  6. ; * License. You may obtain a copy of the License at:
  7. ; * opensource.org/licenses/BSD-3-Clause
  8. ; *
  9. ; ******************************************************************************/
  10. ;/*****************************************************************************/
  11. ;/* Startup for IAR */
  12. ;/* Version V1.0 */
  13. ;/* Date 2021-12-02 */
  14. ;/* Target-mcu M0+ Device */
  15. ;/*****************************************************************************/
  16. MODULE ?cstartup
  17. ;; Forward declaration of sections.
  18. SECTION CSTACK:DATA:NOROOT(3)
  19. EXTERN __iar_program_start
  20. EXTERN SystemInit
  21. PUBLIC __vector_table
  22. SECTION .intvec:CODE:ROOT(8)
  23. DATA
  24. __vector_table
  25. DCD sfe(CSTACK) ; Top of Stack
  26. DCD Reset_Handler ; Reset
  27. DCD NMI_Handler ; NMI
  28. DCD HardFault_Handler ; Hard Fault
  29. DCD 0 ; Reserved
  30. DCD 0 ; Reserved
  31. DCD 0 ; Reserved
  32. DCD 0 ; Reserved
  33. DCD 0 ; Reserved
  34. DCD 0 ; Reserved
  35. DCD 0 ; Reserved
  36. DCD SVC_Handler ; SVCall
  37. DCD 0 ; Reserved
  38. DCD 0 ; Reserved
  39. DCD PendSV_Handler ; PendSV
  40. DCD SysTick_Handler ; SysTick
  41. ; Numbered IRQ handler vectors
  42. ; Note: renaming to device dependent ISR function names are done in
  43. DCD PORTA_IRQHandler
  44. DCD PORTB_IRQHandler
  45. DCD PORTC_IRQHandler
  46. DCD PORTD_IRQHandler
  47. DCD DMAC_IRQHandler
  48. DCD TIM3_IRQHandler
  49. DCD UART0_IRQHandler
  50. DCD UART1_IRQHandler
  51. DCD LPUART0_IRQHandler
  52. DCD LPUART1_IRQHandler
  53. DCD SPI0_IRQHandler
  54. DCD SPI1_IRQHandler
  55. DCD I2C0_IRQHandler
  56. DCD I2C1_IRQHandler
  57. DCD TIM0_IRQHandler
  58. DCD TIM1_IRQHandler
  59. DCD TIM2_IRQHandler
  60. DCD LPTIM_IRQHandler
  61. DCD TIM4_IRQHandler
  62. DCD TIM5_IRQHandler
  63. DCD TIM6_IRQHandler
  64. DCD PCA_IRQHandler
  65. DCD WDT_IRQHandler
  66. DCD RTC_IRQHandler
  67. DCD ADC_IRQHandler
  68. DCD PCNT_IRQHandler
  69. DCD VC0_IRQHandler
  70. DCD VC1_IRQHandler
  71. DCD LVD_IRQHandler
  72. DCD LCD_IRQHandler
  73. DCD EF_RAM_IRQHandler
  74. DCD CLKTRIM_IRQHandler
  75. THUMB
  76. PUBWEAK Reset_Handler
  77. SECTION .text:CODE:NOROOT:REORDER(2)
  78. Reset_Handler
  79. ;reset NVIC if in rom debug
  80. LDR R0, =0x20000000
  81. LDR R2, =0x0 ; vector offset
  82. cmp PC, R0
  83. bls ROMCODE
  84. ; ram code base address.
  85. ADD R2, R0,R2
  86. ROMCODE
  87. ; reset Vector table address.
  88. LDR R0, =0xE000ED08
  89. STR R2, [R0]
  90. LDR R0, =SystemInit
  91. BLX R0
  92. LDR R0, =__iar_program_start
  93. BX R0
  94. PUBWEAK NMI_Handler
  95. SECTION .text:CODE:NOROOT:REORDER(1)
  96. NMI_Handler
  97. B NMI_Handler
  98. PUBWEAK HardFault_Handler
  99. SECTION .text:CODE:NOROOT:REORDER(1)
  100. HardFault_Handler
  101. B HardFault_Handler
  102. PUBWEAK SVC_Handler
  103. SECTION .text:CODE:NOROOT:REORDER(1)
  104. SVC_Handler
  105. B SVC_Handler
  106. PUBWEAK PendSV_Handler
  107. SECTION .text:CODE:NOROOT:REORDER(1)
  108. PendSV_Handler
  109. B PendSV_Handler
  110. PUBWEAK SysTick_Handler
  111. SECTION .text:CODE:NOROOT:REORDER(1)
  112. SysTick_Handler
  113. B SysTick_Handler
  114. PUBWEAK PORTA_IRQHandler
  115. SECTION .text:CODE:NOROOT:REORDER(1)
  116. PORTA_IRQHandler
  117. B PORTA_IRQHandler
  118. PUBWEAK PORTB_IRQHandler
  119. SECTION .text:CODE:NOROOT:REORDER(1)
  120. PORTB_IRQHandler
  121. B PORTB_IRQHandler
  122. PUBWEAK PORTC_IRQHandler
  123. SECTION .text:CODE:NOROOT:REORDER(1)
  124. PORTC_IRQHandler
  125. B PORTC_IRQHandler
  126. PUBWEAK PORTD_IRQHandler
  127. SECTION .text:CODE:NOROOT:REORDER(1)
  128. PORTD_IRQHandler
  129. B PORTD_IRQHandler
  130. PUBWEAK DMAC_IRQHandler
  131. SECTION .text:CODE:NOROOT:REORDER(1)
  132. DMAC_IRQHandler
  133. B DMAC_IRQHandler
  134. PUBWEAK TIM3_IRQHandler
  135. SECTION .text:CODE:NOROOT:REORDER(1)
  136. TIM3_IRQHandler
  137. B TIM3_IRQHandler
  138. PUBWEAK UART0_IRQHandler
  139. SECTION .text:CODE:NOROOT:REORDER(1)
  140. UART0_IRQHandler
  141. B UART0_IRQHandler
  142. PUBWEAK UART1_IRQHandler
  143. SECTION .text:CODE:NOROOT:REORDER(1)
  144. UART1_IRQHandler
  145. B UART1_IRQHandler
  146. PUBWEAK LPUART0_IRQHandler
  147. SECTION .text:CODE:NOROOT:REORDER(1)
  148. LPUART0_IRQHandler
  149. B LPUART0_IRQHandler
  150. PUBWEAK LPUART1_IRQHandler
  151. SECTION .text:CODE:NOROOT:REORDER(1)
  152. LPUART1_IRQHandler
  153. B LPUART1_IRQHandler
  154. PUBWEAK SPI0_IRQHandler
  155. SECTION .text:CODE:NOROOT:REORDER(1)
  156. SPI0_IRQHandler
  157. B SPI0_IRQHandler
  158. PUBWEAK SPI1_IRQHandler
  159. SECTION .text:CODE:NOROOT:REORDER(1)
  160. SPI1_IRQHandler
  161. B SPI1_IRQHandler
  162. PUBWEAK I2C0_IRQHandler
  163. SECTION .text:CODE:NOROOT:REORDER(1)
  164. I2C0_IRQHandler
  165. B I2C0_IRQHandler
  166. PUBWEAK I2C1_IRQHandler
  167. SECTION .text:CODE:NOROOT:REORDER(1)
  168. I2C1_IRQHandler
  169. B I2C1_IRQHandler
  170. PUBWEAK TIM0_IRQHandler
  171. SECTION .text:CODE:NOROOT:REORDER(1)
  172. TIM0_IRQHandler
  173. B TIM0_IRQHandler
  174. PUBWEAK TIM1_IRQHandler
  175. SECTION .text:CODE:NOROOT:REORDER(1)
  176. TIM1_IRQHandler
  177. B TIM1_IRQHandler
  178. PUBWEAK TIM2_IRQHandler
  179. SECTION .text:CODE:NOROOT:REORDER(1)
  180. TIM2_IRQHandler
  181. B TIM2_IRQHandler
  182. PUBWEAK LPTIM_IRQHandler
  183. SECTION .text:CODE:NOROOT:REORDER(1)
  184. LPTIM_IRQHandler
  185. B LPTIM_IRQHandler
  186. PUBWEAK TIM4_IRQHandler
  187. SECTION .text:CODE:NOROOT:REORDER(1)
  188. TIM4_IRQHandler
  189. B TIM4_IRQHandler
  190. PUBWEAK TIM5_IRQHandler
  191. SECTION .text:CODE:NOROOT:REORDER(1)
  192. TIM5_IRQHandler
  193. B TIM5_IRQHandler
  194. PUBWEAK TIM6_IRQHandler
  195. SECTION .text:CODE:NOROOT:REORDER(1)
  196. TIM6_IRQHandler
  197. B TIM6_IRQHandler
  198. PUBWEAK PCA_IRQHandler
  199. SECTION .text:CODE:NOROOT:REORDER(1)
  200. PCA_IRQHandler
  201. B PCA_IRQHandler
  202. PUBWEAK WDT_IRQHandler
  203. SECTION .text:CODE:NOROOT:REORDER(1)
  204. WDT_IRQHandler
  205. B WDT_IRQHandler
  206. PUBWEAK RTC_IRQHandler
  207. SECTION .text:CODE:NOROOT:REORDER(1)
  208. RTC_IRQHandler
  209. B RTC_IRQHandler
  210. PUBWEAK ADC_IRQHandler
  211. SECTION .text:CODE:NOROOT:REORDER(1)
  212. ADC_IRQHandler
  213. B ADC_IRQHandler
  214. PUBWEAK PCNT_IRQHandler
  215. SECTION .text:CODE:NOROOT:REORDER(1)
  216. PCNT_IRQHandler
  217. B PCNT_IRQHandler
  218. PUBWEAK VC0_IRQHandler
  219. SECTION .text:CODE:NOROOT:REORDER(1)
  220. VC0_IRQHandler
  221. B VC0_IRQHandler
  222. PUBWEAK VC1_IRQHandler
  223. SECTION .text:CODE:NOROOT:REORDER(1)
  224. VC1_IRQHandler
  225. B VC1_IRQHandler
  226. PUBWEAK LVD_IRQHandler
  227. SECTION .text:CODE:NOROOT:REORDER(1)
  228. LVD_IRQHandler
  229. B LVD_IRQHandler
  230. PUBWEAK LCD_IRQHandler
  231. SECTION .text:CODE:NOROOT:REORDER(1)
  232. LCD_IRQHandler
  233. B LCD_IRQHandler
  234. PUBWEAK EF_RAM_IRQHandler
  235. SECTION .text:CODE:NOROOT:REORDER(1)
  236. EF_RAM_IRQHandler
  237. B EF_RAM_IRQHandler
  238. PUBWEAK CLKTRIM_IRQHandler
  239. SECTION .text:CODE:NOROOT:REORDER(1)
  240. CLKTRIM_IRQHandler
  241. B CLKTRIM_IRQHandler
  242. END