startup_stm32f103xe.s 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. ;******************** (C) COPYRIGHT 2017 STMicroelectronics ********************
  2. ;* File Name : startup_stm32f103xe.s
  3. ;* Author : MCD Application Team
  4. ;* Description : STM32F103xE Devices vector table for MDK-ARM toolchain.
  5. ;* This module performs:
  6. ;* - Set the initial SP
  7. ;* - Set the initial PC == Reset_Handler
  8. ;* - Set the vector table entries with the exceptions ISR address
  9. ;* - Configure the clock system
  10. ;* - Branches to __main in the C library (which eventually
  11. ;* calls main()).
  12. ;* After Reset the Cortex-M3 processor is in Thread mode,
  13. ;* priority is Privileged, and the Stack is set to Main.
  14. ;******************************************************************************
  15. ;* @attention
  16. ;*
  17. ;* Copyright (c) 2017 STMicroelectronics.
  18. ;* All rights reserved.
  19. ;*
  20. ;* This software component is licensed by ST under BSD 3-Clause license,
  21. ;* the "License"; You may not use this file except in compliance with the
  22. ;* License. You may obtain a copy of the License at:
  23. ;* opensource.org/licenses/BSD-3-Clause
  24. ;*
  25. ;******************************************************************************
  26. ; Amount of memory (in bytes) allocated for Stack
  27. ; Tailor this value to your application needs
  28. ; <h> Stack Configuration
  29. ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  30. ; </h>
  31. Stack_Size EQU 0x400
  32. AREA STACK, NOINIT, READWRITE, ALIGN=3
  33. Stack_Mem SPACE Stack_Size
  34. __initial_sp
  35. ; <h> Heap Configuration
  36. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  37. ; </h>
  38. Heap_Size EQU 0x200
  39. AREA HEAP, NOINIT, READWRITE, ALIGN=3
  40. __heap_base
  41. Heap_Mem SPACE Heap_Size
  42. __heap_limit
  43. PRESERVE8
  44. THUMB
  45. ; Vector Table Mapped to Address 0 at Reset
  46. AREA RESET, DATA, READONLY
  47. EXPORT __Vectors
  48. EXPORT __Vectors_End
  49. EXPORT __Vectors_Size
  50. __Vectors DCD __initial_sp ; Top of Stack
  51. DCD Reset_Handler ; Reset Handler
  52. DCD NMI_Handler ; NMI Handler
  53. DCD HardFault_Handler ; Hard Fault Handler
  54. DCD MemManage_Handler ; MPU Fault Handler
  55. DCD BusFault_Handler ; Bus Fault Handler
  56. DCD UsageFault_Handler ; Usage Fault Handler
  57. DCD 0 ; Reserved
  58. DCD 0 ; Reserved
  59. DCD 0 ; Reserved
  60. DCD 0 ; Reserved
  61. DCD SVC_Handler ; SVCall Handler
  62. DCD DebugMon_Handler ; Debug Monitor Handler
  63. DCD 0 ; Reserved
  64. DCD PendSV_Handler ; PendSV Handler
  65. DCD SysTick_Handler ; SysTick Handler
  66. ; External Interrupts
  67. DCD WWDG_IRQHandler ; Window Watchdog
  68. DCD PVD_IRQHandler ; PVD through EXTI Line detect
  69. DCD TAMPER_IRQHandler ; Tamper
  70. DCD RTC_IRQHandler ; RTC
  71. DCD FLASH_IRQHandler ; Flash
  72. DCD RCC_IRQHandler ; RCC
  73. DCD EXTI0_IRQHandler ; EXTI Line 0
  74. DCD EXTI1_IRQHandler ; EXTI Line 1
  75. DCD EXTI2_IRQHandler ; EXTI Line 2
  76. DCD EXTI3_IRQHandler ; EXTI Line 3
  77. DCD EXTI4_IRQHandler ; EXTI Line 4
  78. DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
  79. DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2
  80. DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3
  81. DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4
  82. DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5
  83. DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6
  84. DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7
  85. DCD ADC1_2_IRQHandler ; ADC1 & ADC2
  86. DCD USB_HP_CAN1_TX_IRQHandler ; USB High Priority or CAN1 TX
  87. DCD USB_LP_CAN1_RX0_IRQHandler ; USB Low Priority or CAN1 RX0
  88. DCD CAN1_RX1_IRQHandler ; CAN1 RX1
  89. DCD CAN1_SCE_IRQHandler ; CAN1 SCE
  90. DCD EXTI9_5_IRQHandler ; EXTI Line 9..5
  91. DCD TIM1_BRK_IRQHandler ; TIM1 Break
  92. DCD TIM1_UP_IRQHandler ; TIM1 Update
  93. DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Commutation
  94. DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  95. DCD TIM2_IRQHandler ; TIM2
  96. DCD TIM3_IRQHandler ; TIM3
  97. DCD TIM4_IRQHandler ; TIM4
  98. DCD I2C1_EV_IRQHandler ; I2C1 Event
  99. DCD I2C1_ER_IRQHandler ; I2C1 Error
  100. DCD I2C2_EV_IRQHandler ; I2C2 Event
  101. DCD I2C2_ER_IRQHandler ; I2C2 Error
  102. DCD SPI1_IRQHandler ; SPI1
  103. DCD SPI2_IRQHandler ; SPI2
  104. DCD USART1_IRQHandler ; USART1
  105. DCD USART2_IRQHandler ; USART2
  106. DCD USART3_IRQHandler ; USART3
  107. DCD EXTI15_10_IRQHandler ; EXTI Line 15..10
  108. DCD RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line
  109. DCD USBWakeUp_IRQHandler ; USB Wakeup from suspend
  110. DCD TIM8_BRK_IRQHandler ; TIM8 Break
  111. DCD TIM8_UP_IRQHandler ; TIM8 Update
  112. DCD TIM8_TRG_COM_IRQHandler ; TIM8 Trigger and Commutation
  113. DCD TIM8_CC_IRQHandler ; TIM8 Capture Compare
  114. DCD ADC3_IRQHandler ; ADC3
  115. DCD FSMC_IRQHandler ; FSMC
  116. DCD SDIO_IRQHandler ; SDIO
  117. DCD TIM5_IRQHandler ; TIM5
  118. DCD SPI3_IRQHandler ; SPI3
  119. DCD UART4_IRQHandler ; UART4
  120. DCD UART5_IRQHandler ; UART5
  121. DCD TIM6_IRQHandler ; TIM6
  122. DCD TIM7_IRQHandler ; TIM7
  123. DCD DMA2_Channel1_IRQHandler ; DMA2 Channel1
  124. DCD DMA2_Channel2_IRQHandler ; DMA2 Channel2
  125. DCD DMA2_Channel3_IRQHandler ; DMA2 Channel3
  126. DCD DMA2_Channel4_5_IRQHandler ; DMA2 Channel4 & Channel5
  127. __Vectors_End
  128. __Vectors_Size EQU __Vectors_End - __Vectors
  129. AREA |.text|, CODE, READONLY
  130. ; Reset handler
  131. Reset_Handler PROC
  132. EXPORT Reset_Handler [WEAK]
  133. IMPORT __main
  134. IMPORT SystemInit
  135. LDR R0, =SystemInit
  136. BLX R0
  137. LDR R0, =__main
  138. BX R0
  139. ENDP
  140. ; Dummy Exception Handlers (infinite loops which can be modified)
  141. NMI_Handler PROC
  142. EXPORT NMI_Handler [WEAK]
  143. B .
  144. ENDP
  145. HardFault_Handler\
  146. PROC
  147. EXPORT HardFault_Handler [WEAK]
  148. B .
  149. ENDP
  150. MemManage_Handler\
  151. PROC
  152. EXPORT MemManage_Handler [WEAK]
  153. B .
  154. ENDP
  155. BusFault_Handler\
  156. PROC
  157. EXPORT BusFault_Handler [WEAK]
  158. B .
  159. ENDP
  160. UsageFault_Handler\
  161. PROC
  162. EXPORT UsageFault_Handler [WEAK]
  163. B .
  164. ENDP
  165. SVC_Handler PROC
  166. EXPORT SVC_Handler [WEAK]
  167. B .
  168. ENDP
  169. DebugMon_Handler\
  170. PROC
  171. EXPORT DebugMon_Handler [WEAK]
  172. B .
  173. ENDP
  174. PendSV_Handler PROC
  175. EXPORT PendSV_Handler [WEAK]
  176. B .
  177. ENDP
  178. SysTick_Handler PROC
  179. EXPORT SysTick_Handler [WEAK]
  180. B .
  181. ENDP
  182. Default_Handler PROC
  183. EXPORT WWDG_IRQHandler [WEAK]
  184. EXPORT PVD_IRQHandler [WEAK]
  185. EXPORT TAMPER_IRQHandler [WEAK]
  186. EXPORT RTC_IRQHandler [WEAK]
  187. EXPORT FLASH_IRQHandler [WEAK]
  188. EXPORT RCC_IRQHandler [WEAK]
  189. EXPORT EXTI0_IRQHandler [WEAK]
  190. EXPORT EXTI1_IRQHandler [WEAK]
  191. EXPORT EXTI2_IRQHandler [WEAK]
  192. EXPORT EXTI3_IRQHandler [WEAK]
  193. EXPORT EXTI4_IRQHandler [WEAK]
  194. EXPORT DMA1_Channel1_IRQHandler [WEAK]
  195. EXPORT DMA1_Channel2_IRQHandler [WEAK]
  196. EXPORT DMA1_Channel3_IRQHandler [WEAK]
  197. EXPORT DMA1_Channel4_IRQHandler [WEAK]
  198. EXPORT DMA1_Channel5_IRQHandler [WEAK]
  199. EXPORT DMA1_Channel6_IRQHandler [WEAK]
  200. EXPORT DMA1_Channel7_IRQHandler [WEAK]
  201. EXPORT ADC1_2_IRQHandler [WEAK]
  202. EXPORT USB_HP_CAN1_TX_IRQHandler [WEAK]
  203. EXPORT USB_LP_CAN1_RX0_IRQHandler [WEAK]
  204. EXPORT CAN1_RX1_IRQHandler [WEAK]
  205. EXPORT CAN1_SCE_IRQHandler [WEAK]
  206. EXPORT EXTI9_5_IRQHandler [WEAK]
  207. EXPORT TIM1_BRK_IRQHandler [WEAK]
  208. EXPORT TIM1_UP_IRQHandler [WEAK]
  209. EXPORT TIM1_TRG_COM_IRQHandler [WEAK]
  210. EXPORT TIM1_CC_IRQHandler [WEAK]
  211. EXPORT TIM2_IRQHandler [WEAK]
  212. EXPORT TIM3_IRQHandler [WEAK]
  213. EXPORT TIM4_IRQHandler [WEAK]
  214. EXPORT I2C1_EV_IRQHandler [WEAK]
  215. EXPORT I2C1_ER_IRQHandler [WEAK]
  216. EXPORT I2C2_EV_IRQHandler [WEAK]
  217. EXPORT I2C2_ER_IRQHandler [WEAK]
  218. EXPORT SPI1_IRQHandler [WEAK]
  219. EXPORT SPI2_IRQHandler [WEAK]
  220. EXPORT USART1_IRQHandler [WEAK]
  221. EXPORT USART2_IRQHandler [WEAK]
  222. EXPORT USART3_IRQHandler [WEAK]
  223. EXPORT EXTI15_10_IRQHandler [WEAK]
  224. EXPORT RTC_Alarm_IRQHandler [WEAK]
  225. EXPORT USBWakeUp_IRQHandler [WEAK]
  226. EXPORT TIM8_BRK_IRQHandler [WEAK]
  227. EXPORT TIM8_UP_IRQHandler [WEAK]
  228. EXPORT TIM8_TRG_COM_IRQHandler [WEAK]
  229. EXPORT TIM8_CC_IRQHandler [WEAK]
  230. EXPORT ADC3_IRQHandler [WEAK]
  231. EXPORT FSMC_IRQHandler [WEAK]
  232. EXPORT SDIO_IRQHandler [WEAK]
  233. EXPORT TIM5_IRQHandler [WEAK]
  234. EXPORT SPI3_IRQHandler [WEAK]
  235. EXPORT UART4_IRQHandler [WEAK]
  236. EXPORT UART5_IRQHandler [WEAK]
  237. EXPORT TIM6_IRQHandler [WEAK]
  238. EXPORT TIM7_IRQHandler [WEAK]
  239. EXPORT DMA2_Channel1_IRQHandler [WEAK]
  240. EXPORT DMA2_Channel2_IRQHandler [WEAK]
  241. EXPORT DMA2_Channel3_IRQHandler [WEAK]
  242. EXPORT DMA2_Channel4_5_IRQHandler [WEAK]
  243. WWDG_IRQHandler
  244. PVD_IRQHandler
  245. TAMPER_IRQHandler
  246. RTC_IRQHandler
  247. FLASH_IRQHandler
  248. RCC_IRQHandler
  249. EXTI0_IRQHandler
  250. EXTI1_IRQHandler
  251. EXTI2_IRQHandler
  252. EXTI3_IRQHandler
  253. EXTI4_IRQHandler
  254. DMA1_Channel1_IRQHandler
  255. DMA1_Channel2_IRQHandler
  256. DMA1_Channel3_IRQHandler
  257. DMA1_Channel4_IRQHandler
  258. DMA1_Channel5_IRQHandler
  259. DMA1_Channel6_IRQHandler
  260. DMA1_Channel7_IRQHandler
  261. ADC1_2_IRQHandler
  262. USB_HP_CAN1_TX_IRQHandler
  263. USB_LP_CAN1_RX0_IRQHandler
  264. CAN1_RX1_IRQHandler
  265. CAN1_SCE_IRQHandler
  266. EXTI9_5_IRQHandler
  267. TIM1_BRK_IRQHandler
  268. TIM1_UP_IRQHandler
  269. TIM1_TRG_COM_IRQHandler
  270. TIM1_CC_IRQHandler
  271. TIM2_IRQHandler
  272. TIM3_IRQHandler
  273. TIM4_IRQHandler
  274. I2C1_EV_IRQHandler
  275. I2C1_ER_IRQHandler
  276. I2C2_EV_IRQHandler
  277. I2C2_ER_IRQHandler
  278. SPI1_IRQHandler
  279. SPI2_IRQHandler
  280. USART1_IRQHandler
  281. USART2_IRQHandler
  282. USART3_IRQHandler
  283. EXTI15_10_IRQHandler
  284. RTC_Alarm_IRQHandler
  285. USBWakeUp_IRQHandler
  286. TIM8_BRK_IRQHandler
  287. TIM8_UP_IRQHandler
  288. TIM8_TRG_COM_IRQHandler
  289. TIM8_CC_IRQHandler
  290. ADC3_IRQHandler
  291. FSMC_IRQHandler
  292. SDIO_IRQHandler
  293. TIM5_IRQHandler
  294. SPI3_IRQHandler
  295. UART4_IRQHandler
  296. UART5_IRQHandler
  297. TIM6_IRQHandler
  298. TIM7_IRQHandler
  299. DMA2_Channel1_IRQHandler
  300. DMA2_Channel2_IRQHandler
  301. DMA2_Channel3_IRQHandler
  302. DMA2_Channel4_5_IRQHandler
  303. B .
  304. ENDP
  305. ALIGN
  306. ;*******************************************************************************
  307. ; User Stack and Heap initialization
  308. ;*******************************************************************************
  309. IF :DEF:__MICROLIB
  310. EXPORT __initial_sp
  311. EXPORT __heap_base
  312. EXPORT __heap_limit
  313. ELSE
  314. IMPORT __use_two_region_memory
  315. EXPORT __user_initial_stackheap
  316. __user_initial_stackheap
  317. LDR R0, = Heap_Mem
  318. LDR R1, =(Stack_Mem + Stack_Size)
  319. LDR R2, = (Heap_Mem + Heap_Size)
  320. LDR R3, = Stack_Mem
  321. BX LR
  322. ALIGN
  323. ENDIF
  324. END
  325. ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****