startup_gd32e23x.s 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. ;/*!
  2. ; \file startup_gd32e23x.s
  3. ; \brief start up file
  4. ;
  5. ; \version 2024-02-22, V2.1.0, firmware for GD32E23x
  6. ;*/
  7. ;/* Copyright (c) 2012 ARM LIMITED
  8. ; Copyright (c) 2024, GigaDevice Semiconductor Inc.
  9. ;
  10. ; All rights reserved.
  11. ; Redistribution and use in source and binary forms, with or without
  12. ; modification, are permitted provided that the following conditions are met:
  13. ; - Redistributions of source code must retain the above copyright
  14. ; notice, this list of conditions and the following disclaimer.
  15. ; - Redistributions in binary form must reproduce the above copyright
  16. ; notice, this list of conditions and the following disclaimer in the
  17. ; documentation and/or other materials provided with the distribution.
  18. ; - Neither the name of ARM nor the names of its contributors may be used
  19. ; to endorse or promote products derived from this software without
  20. ; specific prior written permission.
  21. ; *
  22. ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. ; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. ; ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
  26. ; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. ; POSSIBILITY OF SUCH DAMAGE.
  33. ;*/
  34. ;/* This file refers the CMSIS standard, some adjustments are made according to GigaDevice chips */
  35. MODULE ?cstartup
  36. ;; Forward declaration of sections.
  37. SECTION CSTACK:DATA:NOROOT(3)
  38. SECTION .intvec:CODE:NOROOT(2)
  39. EXTERN __iar_program_start
  40. EXTERN SystemInit
  41. PUBLIC __vector_table
  42. DATA
  43. __vector_table
  44. DCD sfe(CSTACK) ; top of stack
  45. DCD Reset_Handler ; Vector Number 1,Reset Handler
  46. DCD NMI_Handler ; Vector Number 2,NMI Handler
  47. DCD HardFault_Handler ; Vector Number 3,Hard Fault Handler
  48. DCD 0 ; Reserved
  49. DCD 0 ; Reserved
  50. DCD 0 ; Reserved
  51. DCD 0 ; Reserved
  52. DCD 0 ; Reserved
  53. DCD 0 ; Reserved
  54. DCD 0 ; Reserved
  55. DCD SVC_Handler ; Vector Number 11,SVCall Handler
  56. DCD 0 ; Reserved
  57. DCD 0 ; Reserved
  58. DCD PendSV_Handler ; Vector Number 14,PendSV Handler
  59. DCD SysTick_Handler ; Vector Number 15,SysTick Handler
  60. ; External Interrupts
  61. DCD WWDGT_IRQHandler ; 16:Window Watchdog Timer
  62. DCD LVD_IRQHandler ; 17:LVD through EXTI Line detect
  63. DCD RTC_IRQHandler ; 18:RTC through EXTI Line
  64. DCD FMC_IRQHandler ; 19:FMC
  65. DCD RCU_IRQHandler ; 20:RCU
  66. DCD EXTI0_1_IRQHandler ; 21:EXTI Line 0 and EXTI Line 1
  67. DCD EXTI2_3_IRQHandler ; 22:EXTI Line 2 and EXTI Line 3
  68. DCD EXTI4_15_IRQHandler ; 23:EXTI Line 4 to EXTI Line 15
  69. DCD 0 ; Reserved
  70. DCD DMA_Channel0_IRQHandler ; 25:DMA Channel 0
  71. DCD DMA_Channel1_2_IRQHandler ; 26:DMA Channel 1 and DMA Channel 2
  72. DCD DMA_Channel3_4_IRQHandler ; 27:DMA Channel 3 and DMA Channel 4
  73. DCD ADC_CMP_IRQHandler ; 28:ADC and Comparator
  74. DCD TIMER0_BRK_UP_TRG_COM_IRQHandler ; 29:TIMER0 Break,Update,Trigger and Commutation
  75. DCD TIMER0_Channel_IRQHandler ; 30:TIMER0 Channel Capture Compare
  76. DCD 0 ; Reserved
  77. DCD TIMER2_IRQHandler ; 32:TIMER2
  78. DCD TIMER5_IRQHandler ; 33:TIMER5
  79. DCD 0 ; Reserved
  80. DCD TIMER13_IRQHandler ; 35:TIMER13
  81. DCD TIMER14_IRQHandler ; 36:TIMER14
  82. DCD TIMER15_IRQHandler ; 37:TIMER15
  83. DCD TIMER16_IRQHandler ; 38:TIMER16
  84. DCD I2C0_EV_IRQHandler ; 39:I2C0 Event
  85. DCD I2C1_EV_IRQHandler ; 40:I2C1 Event
  86. DCD SPI0_IRQHandler ; 41:SPI0
  87. DCD SPI1_IRQHandler ; 42:SPI1
  88. DCD USART0_IRQHandler ; 43:USART0
  89. DCD USART1_IRQHandler ; 44:USART1
  90. DCD 0 ; Reserved
  91. DCD 0 ; Reserved
  92. DCD 0 ; Reserved
  93. DCD I2C0_ER_IRQHandler ; 48:I2C0 Error
  94. DCD 0 ; Reserved
  95. DCD I2C1_ER_IRQHandler ; 50:I2C1 Error
  96. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  97. ;;
  98. ;; Default interrupt handlers.
  99. ;;
  100. THUMB
  101. PUBWEAK Reset_Handler
  102. SECTION .text:CODE:NOROOT:REORDER(2)
  103. Reset_Handler
  104. LDR R0, =SystemInit
  105. BLX R0
  106. LDR R0, =__iar_program_start
  107. BX R0
  108. PUBWEAK NMI_Handler
  109. SECTION .text:CODE:NOROOT:REORDER(1)
  110. NMI_Handler
  111. B NMI_Handler
  112. PUBWEAK HardFault_Handler
  113. SECTION .text:CODE:NOROOT:REORDER(1)
  114. HardFault_Handler
  115. B HardFault_Handler
  116. PUBWEAK SVC_Handler
  117. SECTION .text:CODE:NOROOT:REORDER(1)
  118. SVC_Handler
  119. B SVC_Handler
  120. PUBWEAK PendSV_Handler
  121. SECTION .text:CODE:NOROOT:REORDER(1)
  122. PendSV_Handler
  123. B PendSV_Handler
  124. PUBWEAK SysTick_Handler
  125. SECTION .text:CODE:NOROOT:REORDER(1)
  126. SysTick_Handler
  127. B SysTick_Handler
  128. PUBWEAK WWDGT_IRQHandler
  129. SECTION .text:CODE:NOROOT:REORDER(1)
  130. WWDGT_IRQHandler
  131. B WWDGT_IRQHandler
  132. PUBWEAK LVD_IRQHandler
  133. SECTION .text:CODE:NOROOT:REORDER(1)
  134. LVD_IRQHandler
  135. B LVD_IRQHandler
  136. PUBWEAK RTC_IRQHandler
  137. SECTION .text:CODE:NOROOT:REORDER(1)
  138. RTC_IRQHandler
  139. B RTC_IRQHandler
  140. PUBWEAK FMC_IRQHandler
  141. SECTION .text:CODE:NOROOT:REORDER(1)
  142. FMC_IRQHandler
  143. B FMC_IRQHandler
  144. PUBWEAK RCU_IRQHandler
  145. SECTION .text:CODE:NOROOT:REORDER(1)
  146. RCU_IRQHandler
  147. B RCU_IRQHandler
  148. PUBWEAK EXTI0_1_IRQHandler
  149. SECTION .text:CODE:NOROOT:REORDER(1)
  150. EXTI0_1_IRQHandler
  151. B EXTI0_1_IRQHandler
  152. PUBWEAK EXTI2_3_IRQHandler
  153. SECTION .text:CODE:NOROOT:REORDER(1)
  154. EXTI2_3_IRQHandler
  155. B EXTI2_3_IRQHandler
  156. PUBWEAK EXTI4_15_IRQHandler
  157. SECTION .text:CODE:NOROOT:REORDER(1)
  158. EXTI4_15_IRQHandler
  159. B EXTI4_15_IRQHandler
  160. PUBWEAK DMA_Channel0_IRQHandler
  161. SECTION .text:CODE:NOROOT:REORDER(1)
  162. DMA_Channel0_IRQHandler
  163. B DMA_Channel0_IRQHandler
  164. PUBWEAK DMA_Channel1_2_IRQHandler
  165. SECTION .text:CODE:NOROOT:REORDER(1)
  166. DMA_Channel1_2_IRQHandler
  167. B DMA_Channel1_2_IRQHandler
  168. PUBWEAK DMA_Channel3_4_IRQHandler
  169. SECTION .text:CODE:NOROOT:REORDER(1)
  170. DMA_Channel3_4_IRQHandler
  171. B DMA_Channel3_4_IRQHandler
  172. PUBWEAK ADC_CMP_IRQHandler
  173. SECTION .text:CODE:NOROOT:REORDER(1)
  174. ADC_CMP_IRQHandler
  175. B ADC_CMP_IRQHandler
  176. PUBWEAK TIMER0_BRK_UP_TRG_COM_IRQHandler
  177. SECTION .text:CODE:NOROOT:REORDER(1)
  178. TIMER0_BRK_UP_TRG_COM_IRQHandler
  179. B TIMER0_BRK_UP_TRG_COM_IRQHandler
  180. PUBWEAK TIMER0_Channel_IRQHandler
  181. SECTION .text:CODE:NOROOT:REORDER(1)
  182. TIMER0_Channel_IRQHandler
  183. B TIMER0_Channel_IRQHandler
  184. PUBWEAK TIMER2_IRQHandler
  185. SECTION .text:CODE:NOROOT:REORDER(1)
  186. TIMER2_IRQHandler
  187. B TIMER2_IRQHandler
  188. PUBWEAK TIMER5_IRQHandler
  189. SECTION .text:CODE:NOROOT:REORDER(1)
  190. TIMER5_IRQHandler
  191. B TIMER5_IRQHandler
  192. PUBWEAK TIMER13_IRQHandler
  193. SECTION .text:CODE:NOROOT:REORDER(1)
  194. TIMER13_IRQHandler
  195. B TIMER13_IRQHandler
  196. PUBWEAK TIMER14_IRQHandler
  197. SECTION .text:CODE:NOROOT:REORDER(1)
  198. TIMER14_IRQHandler
  199. B TIMER14_IRQHandler
  200. PUBWEAK TIMER15_IRQHandler
  201. SECTION .text:CODE:NOROOT:REORDER(1)
  202. TIMER15_IRQHandler
  203. B TIMER15_IRQHandler
  204. PUBWEAK TIMER16_IRQHandler
  205. SECTION .text:CODE:NOROOT:REORDER(1)
  206. TIMER16_IRQHandler
  207. B TIMER16_IRQHandler
  208. PUBWEAK I2C0_EV_IRQHandler
  209. SECTION .text:CODE:NOROOT:REORDER(1)
  210. I2C0_EV_IRQHandler
  211. B I2C0_EV_IRQHandler
  212. PUBWEAK I2C1_EV_IRQHandler
  213. SECTION .text:CODE:NOROOT:REORDER(1)
  214. I2C1_EV_IRQHandler
  215. B I2C1_EV_IRQHandler
  216. PUBWEAK SPI0_IRQHandler
  217. SECTION .text:CODE:NOROOT:REORDER(1)
  218. SPI0_IRQHandler
  219. B SPI0_IRQHandler
  220. PUBWEAK SPI1_IRQHandler
  221. SECTION .text:CODE:NOROOT:REORDER(1)
  222. SPI1_IRQHandler
  223. B SPI1_IRQHandler
  224. PUBWEAK USART0_IRQHandler
  225. SECTION .text:CODE:NOROOT:REORDER(1)
  226. USART0_IRQHandler
  227. B USART0_IRQHandler
  228. PUBWEAK USART1_IRQHandler
  229. SECTION .text:CODE:NOROOT:REORDER(1)
  230. USART1_IRQHandler
  231. B USART1_IRQHandler
  232. PUBWEAK I2C0_ER_IRQHandler
  233. SECTION .text:CODE:NOROOT:REORDER(1)
  234. I2C0_ER_IRQHandler
  235. B I2C0_ER_IRQHandler
  236. PUBWEAK I2C1_ER_IRQHandler
  237. SECTION .text:CODE:NOROOT:REORDER(1)
  238. I2C1_ER_IRQHandler
  239. B I2C1_ER_IRQHandler
  240. END