startup_stm32f101xg.s 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. ;******************** (C) COPYRIGHT 2017 STMicroelectronics ********************
  2. ;* File Name : startup_stm32f101xg.s
  3. ;* Author : MCD Application Team
  4. ;* Description : STM32F101xG Access Line Devices vector table for EWARM
  5. ;* toolchain.
  6. ;* This module performs:
  7. ;* - Set the initial SP
  8. ;* - Set the initial PC == __iar_program_start,
  9. ;* - Set the vector table entries with the exceptions ISR
  10. ;* address.
  11. ;* - Configure the system clock
  12. ;* - Branches to main in the C library (which eventually
  13. ;* calls main()).
  14. ;* After Reset the Cortex-M3 processor is in Thread mode,
  15. ;* priority is Privileged, and the Stack is set to Main.
  16. ;********************************************************************************
  17. ;*
  18. ;* Copyright (c) 2017-2021 STMicroelectronics.
  19. ;* All rights reserved.
  20. ;*
  21. ;* This software is licensed under terms that can be found in the LICENSE file
  22. ;* in the root directory of this software component.
  23. ;* If no LICENSE file comes with this software, it is provided AS-IS.
  24. ;
  25. ;*******************************************************************************
  26. ;
  27. ;
  28. ; The modules in this file are included in the libraries, and may be replaced
  29. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  30. ; a user defined start symbol.
  31. ; To override the cstartup defined in the library, simply add your modified
  32. ; version to the workbench project.
  33. ;
  34. ; The vector table is normally located at address 0.
  35. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  36. ; The name "__vector_table" has special meaning for C-SPY:
  37. ; it is where the SP start value is found, and the NVIC vector
  38. ; table register (VTOR) is initialized to this address if != 0.
  39. ;
  40. ; Cortex-M version
  41. ;
  42. MODULE ?cstartup
  43. ;; Forward declaration of sections.
  44. SECTION CSTACK:DATA:NOROOT(3)
  45. SECTION .intvec:CODE:NOROOT(2)
  46. EXTERN __iar_program_start
  47. EXTERN SystemInit
  48. PUBLIC __vector_table
  49. DATA
  50. __vector_table
  51. DCD sfe(CSTACK)
  52. DCD Reset_Handler ; Reset Handler
  53. DCD NMI_Handler ; NMI Handler
  54. DCD HardFault_Handler ; Hard Fault Handler
  55. DCD MemManage_Handler ; MPU Fault Handler
  56. DCD BusFault_Handler ; Bus Fault Handler
  57. DCD UsageFault_Handler ; Usage Fault Handler
  58. DCD 0 ; Reserved
  59. DCD 0 ; Reserved
  60. DCD 0 ; Reserved
  61. DCD 0 ; Reserved
  62. DCD SVC_Handler ; SVCall Handler
  63. DCD DebugMon_Handler ; Debug Monitor Handler
  64. DCD 0 ; Reserved
  65. DCD PendSV_Handler ; PendSV Handler
  66. DCD SysTick_Handler ; SysTick Handler
  67. ; External Interrupts
  68. DCD WWDG_IRQHandler ; Window Watchdog
  69. DCD PVD_IRQHandler ; PVD through EXTI Line detect
  70. DCD TAMPER_IRQHandler ; Tamper
  71. DCD RTC_IRQHandler ; RTC
  72. DCD FLASH_IRQHandler ; Flash
  73. DCD RCC_IRQHandler ; RCC
  74. DCD EXTI0_IRQHandler ; EXTI Line 0
  75. DCD EXTI1_IRQHandler ; EXTI Line 1
  76. DCD EXTI2_IRQHandler ; EXTI Line 2
  77. DCD EXTI3_IRQHandler ; EXTI Line 3
  78. DCD EXTI4_IRQHandler ; EXTI Line 4
  79. DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
  80. DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
  81. DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
  82. DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
  83. DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
  84. DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
  85. DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
  86. DCD ADC1_IRQHandler ; ADC1
  87. DCD 0 ; Reserved
  88. DCD 0 ; Reserved
  89. DCD 0 ; Reserved
  90. DCD 0 ; Reserved
  91. DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
  92. DCD TIM9_IRQHandler ; TIM9
  93. DCD TIM10_IRQHandler ; TIM10
  94. DCD TIM11_IRQHandler ; TIM11
  95. DCD 0 ; Reserved
  96. DCD TIM2_IRQHandler ; TIM2
  97. DCD TIM3_IRQHandler ; TIM3
  98. DCD TIM4_IRQHandler ; TIM4
  99. DCD I2C1_EV_IRQHandler ; I2C1 Event
  100. DCD I2C1_ER_IRQHandler ; I2C1 Error
  101. DCD I2C2_EV_IRQHandler ; I2C2 Event
  102. DCD I2C2_ER_IRQHandler ; I2C2 Error
  103. DCD SPI1_IRQHandler ; SPI1
  104. DCD SPI2_IRQHandler ; SPI2
  105. DCD USART1_IRQHandler ; USART1
  106. DCD USART2_IRQHandler ; USART2
  107. DCD USART3_IRQHandler ; USART3
  108. DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
  109. DCD RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
  110. DCD 0 ; Reserved
  111. DCD TIM12_IRQHandler ; TIM12
  112. DCD TIM13_IRQHandler ; TIM13
  113. DCD TIM14_IRQHandler ; TIM14
  114. DCD 0 ; Reserved
  115. DCD 0 ; Reserved
  116. DCD FSMC_IRQHandler ; FSMC
  117. DCD 0 ; Reserved
  118. DCD TIM5_IRQHandler ; TIM5
  119. DCD SPI3_IRQHandler ; SPI3
  120. DCD UART4_IRQHandler ; UART4
  121. DCD UART5_IRQHandler ; UART5
  122. DCD TIM6_IRQHandler ; TIM6
  123. DCD TIM7_IRQHandler ; TIM7
  124. DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
  125. DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
  126. DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
  127. DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
  128. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  129. ;;
  130. ;; Default interrupt handlers.
  131. ;;
  132. THUMB
  133. PUBWEAK Reset_Handler
  134. SECTION .text:CODE:REORDER:NOROOT(2)
  135. Reset_Handler
  136. LDR R0, =SystemInit
  137. BLX R0
  138. LDR R0, =__iar_program_start
  139. BX R0
  140. PUBWEAK NMI_Handler
  141. SECTION .text:CODE:REORDER:NOROOT(1)
  142. NMI_Handler
  143. B NMI_Handler
  144. PUBWEAK HardFault_Handler
  145. SECTION .text:CODE:REORDER:NOROOT(1)
  146. HardFault_Handler
  147. B HardFault_Handler
  148. PUBWEAK MemManage_Handler
  149. SECTION .text:CODE:REORDER:NOROOT(1)
  150. MemManage_Handler
  151. B MemManage_Handler
  152. PUBWEAK BusFault_Handler
  153. SECTION .text:CODE:REORDER:NOROOT(1)
  154. BusFault_Handler
  155. B BusFault_Handler
  156. PUBWEAK UsageFault_Handler
  157. SECTION .text:CODE:REORDER:NOROOT(1)
  158. UsageFault_Handler
  159. B UsageFault_Handler
  160. PUBWEAK SVC_Handler
  161. SECTION .text:CODE:REORDER:NOROOT(1)
  162. SVC_Handler
  163. B SVC_Handler
  164. PUBWEAK DebugMon_Handler
  165. SECTION .text:CODE:REORDER:NOROOT(1)
  166. DebugMon_Handler
  167. B DebugMon_Handler
  168. PUBWEAK PendSV_Handler
  169. SECTION .text:CODE:REORDER:NOROOT(1)
  170. PendSV_Handler
  171. B PendSV_Handler
  172. PUBWEAK SysTick_Handler
  173. SECTION .text:CODE:REORDER:NOROOT(1)
  174. SysTick_Handler
  175. B SysTick_Handler
  176. PUBWEAK WWDG_IRQHandler
  177. SECTION .text:CODE:REORDER:NOROOT(1)
  178. WWDG_IRQHandler
  179. B WWDG_IRQHandler
  180. PUBWEAK PVD_IRQHandler
  181. SECTION .text:CODE:REORDER:NOROOT(1)
  182. PVD_IRQHandler
  183. B PVD_IRQHandler
  184. PUBWEAK TAMPER_IRQHandler
  185. SECTION .text:CODE:REORDER:NOROOT(1)
  186. TAMPER_IRQHandler
  187. B TAMPER_IRQHandler
  188. PUBWEAK RTC_IRQHandler
  189. SECTION .text:CODE:REORDER:NOROOT(1)
  190. RTC_IRQHandler
  191. B RTC_IRQHandler
  192. PUBWEAK FLASH_IRQHandler
  193. SECTION .text:CODE:REORDER:NOROOT(1)
  194. FLASH_IRQHandler
  195. B FLASH_IRQHandler
  196. PUBWEAK RCC_IRQHandler
  197. SECTION .text:CODE:REORDER:NOROOT(1)
  198. RCC_IRQHandler
  199. B RCC_IRQHandler
  200. PUBWEAK EXTI0_IRQHandler
  201. SECTION .text:CODE:REORDER:NOROOT(1)
  202. EXTI0_IRQHandler
  203. B EXTI0_IRQHandler
  204. PUBWEAK EXTI1_IRQHandler
  205. SECTION .text:CODE:REORDER:NOROOT(1)
  206. EXTI1_IRQHandler
  207. B EXTI1_IRQHandler
  208. PUBWEAK EXTI2_IRQHandler
  209. SECTION .text:CODE:REORDER:NOROOT(1)
  210. EXTI2_IRQHandler
  211. B EXTI2_IRQHandler
  212. PUBWEAK EXTI3_IRQHandler
  213. SECTION .text:CODE:REORDER:NOROOT(1)
  214. EXTI3_IRQHandler
  215. B EXTI3_IRQHandler
  216. PUBWEAK EXTI4_IRQHandler
  217. SECTION .text:CODE:REORDER:NOROOT(1)
  218. EXTI4_IRQHandler
  219. B EXTI4_IRQHandler
  220. PUBWEAK DMA1_Channel1_IRQHandler
  221. SECTION .text:CODE:REORDER:NOROOT(1)
  222. DMA1_Channel1_IRQHandler
  223. B DMA1_Channel1_IRQHandler
  224. PUBWEAK DMA1_Channel2_IRQHandler
  225. SECTION .text:CODE:REORDER:NOROOT(1)
  226. DMA1_Channel2_IRQHandler
  227. B DMA1_Channel2_IRQHandler
  228. PUBWEAK DMA1_Channel3_IRQHandler
  229. SECTION .text:CODE:REORDER:NOROOT(1)
  230. DMA1_Channel3_IRQHandler
  231. B DMA1_Channel3_IRQHandler
  232. PUBWEAK DMA1_Channel4_IRQHandler
  233. SECTION .text:CODE:REORDER:NOROOT(1)
  234. DMA1_Channel4_IRQHandler
  235. B DMA1_Channel4_IRQHandler
  236. PUBWEAK DMA1_Channel5_IRQHandler
  237. SECTION .text:CODE:REORDER:NOROOT(1)
  238. DMA1_Channel5_IRQHandler
  239. B DMA1_Channel5_IRQHandler
  240. PUBWEAK DMA1_Channel6_IRQHandler
  241. SECTION .text:CODE:REORDER:NOROOT(1)
  242. DMA1_Channel6_IRQHandler
  243. B DMA1_Channel6_IRQHandler
  244. PUBWEAK DMA1_Channel7_IRQHandler
  245. SECTION .text:CODE:REORDER:NOROOT(1)
  246. DMA1_Channel7_IRQHandler
  247. B DMA1_Channel7_IRQHandler
  248. PUBWEAK ADC1_IRQHandler
  249. SECTION .text:CODE:REORDER:NOROOT(1)
  250. ADC1_IRQHandler
  251. B ADC1_IRQHandler
  252. PUBWEAK EXTI9_5_IRQHandler
  253. SECTION .text:CODE:REORDER:NOROOT(1)
  254. EXTI9_5_IRQHandler
  255. B EXTI9_5_IRQHandler
  256. PUBWEAK TIM9_IRQHandler
  257. SECTION .text:CODE:REORDER:NOROOT(1)
  258. TIM9_IRQHandler
  259. B TIM9_IRQHandler
  260. PUBWEAK TIM10_IRQHandler
  261. SECTION .text:CODE:REORDER:NOROOT(1)
  262. TIM10_IRQHandler
  263. B TIM10_IRQHandler
  264. PUBWEAK TIM11_IRQHandler
  265. SECTION .text:CODE:REORDER:NOROOT(1)
  266. TIM11_IRQHandler
  267. B TIM11_IRQHandler
  268. PUBWEAK TIM1_CC_IRQHandler
  269. SECTION .text:CODE:REORDER:NOROOT(1)
  270. TIM1_CC_IRQHandler
  271. B TIM1_CC_IRQHandler
  272. PUBWEAK TIM2_IRQHandler
  273. SECTION .text:CODE:REORDER:NOROOT(1)
  274. TIM2_IRQHandler
  275. B TIM2_IRQHandler
  276. PUBWEAK TIM3_IRQHandler
  277. SECTION .text:CODE:REORDER:NOROOT(1)
  278. TIM3_IRQHandler
  279. B TIM3_IRQHandler
  280. PUBWEAK TIM4_IRQHandler
  281. SECTION .text:CODE:REORDER:NOROOT(1)
  282. TIM4_IRQHandler
  283. B TIM4_IRQHandler
  284. PUBWEAK I2C1_EV_IRQHandler
  285. SECTION .text:CODE:REORDER:NOROOT(1)
  286. I2C1_EV_IRQHandler
  287. B I2C1_EV_IRQHandler
  288. PUBWEAK I2C1_ER_IRQHandler
  289. SECTION .text:CODE:REORDER:NOROOT(1)
  290. I2C1_ER_IRQHandler
  291. B I2C1_ER_IRQHandler
  292. PUBWEAK I2C2_EV_IRQHandler
  293. SECTION .text:CODE:REORDER:NOROOT(1)
  294. I2C2_EV_IRQHandler
  295. B I2C2_EV_IRQHandler
  296. PUBWEAK I2C2_ER_IRQHandler
  297. SECTION .text:CODE:REORDER:NOROOT(1)
  298. I2C2_ER_IRQHandler
  299. B I2C2_ER_IRQHandler
  300. PUBWEAK SPI1_IRQHandler
  301. SECTION .text:CODE:REORDER:NOROOT(1)
  302. SPI1_IRQHandler
  303. B SPI1_IRQHandler
  304. PUBWEAK SPI2_IRQHandler
  305. SECTION .text:CODE:REORDER:NOROOT(1)
  306. SPI2_IRQHandler
  307. B SPI2_IRQHandler
  308. PUBWEAK USART1_IRQHandler
  309. SECTION .text:CODE:REORDER:NOROOT(1)
  310. USART1_IRQHandler
  311. B USART1_IRQHandler
  312. PUBWEAK USART2_IRQHandler
  313. SECTION .text:CODE:REORDER:NOROOT(1)
  314. USART2_IRQHandler
  315. B USART2_IRQHandler
  316. PUBWEAK USART3_IRQHandler
  317. SECTION .text:CODE:REORDER:NOROOT(1)
  318. USART3_IRQHandler
  319. B USART3_IRQHandler
  320. PUBWEAK EXTI15_10_IRQHandler
  321. SECTION .text:CODE:REORDER:NOROOT(1)
  322. EXTI15_10_IRQHandler
  323. B EXTI15_10_IRQHandler
  324. PUBWEAK RTC_Alarm_IRQHandler
  325. SECTION .text:CODE:REORDER:NOROOT(1)
  326. RTC_Alarm_IRQHandler
  327. B RTC_Alarm_IRQHandler
  328. PUBWEAK FSMC_IRQHandler
  329. SECTION .text:CODE:REORDER:NOROOT(1)
  330. FSMC_IRQHandler
  331. B FSMC_IRQHandler
  332. PUBWEAK TIM12_IRQHandler
  333. SECTION .text:CODE:REORDER:NOROOT(1)
  334. TIM12_IRQHandler
  335. B TIM12_IRQHandler
  336. PUBWEAK TIM13_IRQHandler
  337. SECTION .text:CODE:REORDER:NOROOT(1)
  338. TIM13_IRQHandler
  339. B TIM13_IRQHandler
  340. PUBWEAK TIM14_IRQHandler
  341. SECTION .text:CODE:REORDER:NOROOT(1)
  342. TIM14_IRQHandler
  343. B TIM14_IRQHandler
  344. PUBWEAK TIM5_IRQHandler
  345. SECTION .text:CODE:REORDER:NOROOT(1)
  346. TIM5_IRQHandler
  347. B TIM5_IRQHandler
  348. PUBWEAK SPI3_IRQHandler
  349. SECTION .text:CODE:REORDER:NOROOT(1)
  350. SPI3_IRQHandler
  351. B SPI3_IRQHandler
  352. PUBWEAK UART4_IRQHandler
  353. SECTION .text:CODE:REORDER:NOROOT(1)
  354. UART4_IRQHandler
  355. B UART4_IRQHandler
  356. PUBWEAK UART5_IRQHandler
  357. SECTION .text:CODE:REORDER:NOROOT(1)
  358. UART5_IRQHandler
  359. B UART5_IRQHandler
  360. PUBWEAK TIM6_IRQHandler
  361. SECTION .text:CODE:REORDER:NOROOT(1)
  362. TIM6_IRQHandler
  363. B TIM6_IRQHandler
  364. PUBWEAK TIM7_IRQHandler
  365. SECTION .text:CODE:REORDER:NOROOT(1)
  366. TIM7_IRQHandler
  367. B TIM7_IRQHandler
  368. PUBWEAK DMA2_Channel1_IRQHandler
  369. SECTION .text:CODE:REORDER:NOROOT(1)
  370. DMA2_Channel1_IRQHandler
  371. B DMA2_Channel1_IRQHandler
  372. PUBWEAK DMA2_Channel2_IRQHandler
  373. SECTION .text:CODE:REORDER:NOROOT(1)
  374. DMA2_Channel2_IRQHandler
  375. B DMA2_Channel2_IRQHandler
  376. PUBWEAK DMA2_Channel3_IRQHandler
  377. SECTION .text:CODE:REORDER:NOROOT(1)
  378. DMA2_Channel3_IRQHandler
  379. B DMA2_Channel3_IRQHandler
  380. PUBWEAK DMA2_Channel4_5_IRQHandler
  381. SECTION .text:CODE:REORDER:NOROOT(1)
  382. DMA2_Channel4_5_IRQHandler
  383. B DMA2_Channel4_5_IRQHandler
  384. END