startup_stm32f30x.s 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. /**
  2. ******************************************************************************
  3. * @file startup_stm32f30x.s
  4. * @author MCD Application Team
  5. * @version V1.1.1
  6. * @date 28-March-2014
  7. * @brief STM32F30x Devices vector table for RIDE7 toolchain.
  8. * This module performs:
  9. * - Set the initial SP
  10. * - Set the initial PC == Reset_Handler,
  11. * - Set the vector table entries with the exceptions ISR address
  12. * - Configure the clock system and the external SRAM mounted on
  13. * STM3230C-EVAL board to be used as data memory (optional,
  14. * to be enabled by user)
  15. * - Branches to main in the C library (which eventually
  16. * calls main()).
  17. * After Reset the Cortex-M4 processor is in Thread mode,
  18. * priority is Privileged, and the Stack is set to Main.
  19. ******************************************************************************
  20. * @attention
  21. *
  22. * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
  23. *
  24. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  25. * You may not use this file except in compliance with the License.
  26. * You may obtain a copy of the License at:
  27. *
  28. * http://www.st.com/software_license_agreement_liberty_v2
  29. *
  30. * Unless required by applicable law or agreed to in writing, software
  31. * distributed under the License is distributed on an "AS IS" BASIS,
  32. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  33. * See the License for the specific language governing permissions and
  34. * limitations under the License.
  35. *
  36. ******************************************************************************
  37. */
  38. .syntax unified
  39. .cpu cortex-m4
  40. .fpu softvfp
  41. .thumb
  42. .global g_pfnVectors
  43. .global Default_Handler
  44. /* start address for the initialization values of the .data section.
  45. defined in linker script */
  46. .word _sidata
  47. /* start address for the .data section. defined in linker script */
  48. .word _sdata
  49. /* end address for the .data section. defined in linker script */
  50. .word _edata
  51. /* start address for the .bss section. defined in linker script */
  52. .word _sbss
  53. /* end address for the .bss section. defined in linker script */
  54. .word _ebss
  55. /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
  56. /**
  57. * @brief This is the code that gets called when the processor first
  58. * starts execution following a reset event. Only the absolutely
  59. * necessary set is performed, after which the application
  60. * supplied main() routine is called.
  61. * @param None
  62. * @retval : None
  63. */
  64. .section .text.Reset_Handler
  65. .weak Reset_Handler
  66. .type Reset_Handler, %function
  67. Reset_Handler:
  68. /* Copy the data segment initializers from flash to SRAM */
  69. movs r1, #0
  70. b LoopCopyDataInit
  71. CopyDataInit:
  72. ldr r3, =_sidata
  73. ldr r3, [r3, r1]
  74. str r3, [r0, r1]
  75. adds r1, r1, #4
  76. LoopCopyDataInit:
  77. ldr r0, =_sdata
  78. ldr r3, =_edata
  79. adds r2, r0, r1
  80. cmp r2, r3
  81. bcc CopyDataInit
  82. ldr r2, =_sbss
  83. b LoopFillZerobss
  84. /* Zero fill the bss segment. */
  85. FillZerobss:
  86. movs r3, #0
  87. str r3, [r2], #4
  88. LoopFillZerobss:
  89. ldr r3, = _ebss
  90. cmp r2, r3
  91. bcc FillZerobss
  92. /* Call the clock system intitialization function.*/
  93. bl SystemInit
  94. /* Call the application's entry point.*/
  95. bl main
  96. bx lr
  97. .size Reset_Handler, .-Reset_Handler
  98. /**
  99. * @brief This is the code that gets called when the processor receives an
  100. * unexpected interrupt. This simply enters an infinite loop, preserving
  101. * the system state for examination by a debugger.
  102. * @param None
  103. * @retval None
  104. */
  105. .section .text.Default_Handler,"ax",%progbits
  106. Default_Handler:
  107. Infinite_Loop:
  108. b Infinite_Loop
  109. .size Default_Handler, .-Default_Handler
  110. /******************************************************************************
  111. *
  112. * The minimal vector table for a Cortex M4. Note that the proper constructs
  113. * must be placed on this to ensure that it ends up at physical address
  114. * 0x0000.0000.
  115. *
  116. *******************************************************************************/
  117. .section .isr_vector,"a",%progbits
  118. .type g_pfnVectors, %object
  119. .size g_pfnVectors, .-g_pfnVectors
  120. g_pfnVectors:
  121. .word _estack
  122. .word Reset_Handler
  123. .word NMI_Handler
  124. .word HardFault_Handler
  125. .word MemManage_Handler
  126. .word BusFault_Handler
  127. .word UsageFault_Handler
  128. .word 0
  129. .word 0
  130. .word 0
  131. .word 0
  132. .word SVC_Handler
  133. .word DebugMon_Handler
  134. .word 0
  135. .word PendSV_Handler
  136. .word SysTick_Handler
  137. .word WWDG_IRQHandler
  138. .word PVD_IRQHandler
  139. .word TAMPER_STAMP_IRQHandler
  140. .word RTC_WKUP_IRQHandler
  141. .word FLASH_IRQHandler
  142. .word RCC_IRQHandler
  143. .word EXTI0_IRQHandler
  144. .word EXTI1_IRQHandler
  145. .word EXTI2_TS_IRQHandler
  146. .word EXTI3_IRQHandler
  147. .word EXTI4_IRQHandler
  148. .word DMA1_Channel1_IRQHandler
  149. .word DMA1_Channel2_IRQHandler
  150. .word DMA1_Channel3_IRQHandler
  151. .word DMA1_Channel4_IRQHandler
  152. .word DMA1_Channel5_IRQHandler
  153. .word DMA1_Channel6_IRQHandler
  154. .word DMA1_Channel7_IRQHandler
  155. .word ADC1_2_IRQHandler
  156. .word USB_HP_CAN1_TX_IRQHandler
  157. .word USB_LP_CAN1_RX0_IRQHandler
  158. .word CAN1_RX1_IRQHandler
  159. .word CAN1_SCE_IRQHandler
  160. .word EXTI9_5_IRQHandler
  161. .word TIM1_BRK_TIM15_IRQHandler
  162. .word TIM1_UP_TIM16_IRQHandler
  163. .word TIM1_TRG_COM_TIM17_IRQHandler
  164. .word TIM1_CC_IRQHandler
  165. .word TIM2_IRQHandler
  166. .word TIM3_IRQHandler
  167. .word TIM4_IRQHandler
  168. .word I2C1_EV_IRQHandler
  169. .word I2C1_ER_IRQHandler
  170. .word I2C2_EV_IRQHandler
  171. .word I2C2_ER_IRQHandler
  172. .word SPI1_IRQHandler
  173. .word SPI2_IRQHandler
  174. .word USART1_IRQHandler
  175. .word USART2_IRQHandler
  176. .word USART3_IRQHandler
  177. .word EXTI15_10_IRQHandler
  178. .word RTC_Alarm_IRQHandler
  179. .word USBWakeUp_IRQHandler
  180. .word TIM8_BRK_IRQHandler
  181. .word TIM8_UP_IRQHandler
  182. .word TIM8_TRG_COM_IRQHandler
  183. .word TIM8_CC_IRQHandler
  184. .word ADC3_IRQHandler
  185. .word 0
  186. .word 0
  187. .word 0
  188. .word SPI3_IRQHandler
  189. .word UART4_IRQHandler
  190. .word UART5_IRQHandler
  191. .word TIM6_DAC_IRQHandler
  192. .word TIM7_IRQHandler
  193. .word DMA2_Channel1_IRQHandler
  194. .word DMA2_Channel2_IRQHandler
  195. .word DMA2_Channel3_IRQHandler
  196. .word DMA2_Channel4_IRQHandler
  197. .word DMA2_Channel5_IRQHandler
  198. .word ADC4_IRQHandler
  199. .word 0
  200. .word 0
  201. .word COMP1_2_3_IRQHandler
  202. .word COMP4_5_6_IRQHandler
  203. .word COMP7_IRQHandler
  204. .word 0
  205. .word 0
  206. .word 0
  207. .word 0
  208. .word 0
  209. .word 0
  210. .word 0
  211. .word USB_HP_IRQHandler
  212. .word USB_LP_IRQHandler
  213. .word USBWakeUp_RMP_IRQHandler
  214. .word 0
  215. .word 0
  216. .word 0
  217. .word 0
  218. .word FPU_IRQHandler
  219. /*******************************************************************************
  220. *
  221. * Provide weak aliases for each Exception handler to the Default_Handler.
  222. * As they are weak aliases, any function with the same name will override
  223. * this definition.
  224. *
  225. *******************************************************************************/
  226. .weak NMI_Handler
  227. .thumb_set NMI_Handler,Default_Handler
  228. .weak HardFault_Handler
  229. .thumb_set HardFault_Handler,Default_Handler
  230. .weak MemManage_Handler
  231. .thumb_set MemManage_Handler,Default_Handler
  232. .weak BusFault_Handler
  233. .thumb_set BusFault_Handler,Default_Handler
  234. .weak UsageFault_Handler
  235. .thumb_set UsageFault_Handler,Default_Handler
  236. .weak SVC_Handler
  237. .thumb_set SVC_Handler,Default_Handler
  238. .weak DebugMon_Handler
  239. .thumb_set DebugMon_Handler,Default_Handler
  240. .weak PendSV_Handler
  241. .thumb_set PendSV_Handler,Default_Handler
  242. .weak SysTick_Handler
  243. .thumb_set SysTick_Handler,Default_Handler
  244. .weak WWDG_IRQHandler
  245. .thumb_set WWDG_IRQHandler,Default_Handler
  246. .weak PVD_IRQHandler
  247. .thumb_set PVD_IRQHandler,Default_Handler
  248. .weak TAMPER_STAMP_IRQHandler
  249. .thumb_set TAMPER_STAMP_IRQHandler,Default_Handler
  250. .weak RTC_WKUP_IRQHandler
  251. .thumb_set RTC_WKUP_IRQHandler,Default_Handler
  252. .weak FLASH_IRQHandler
  253. .thumb_set FLASH_IRQHandler,Default_Handler
  254. .weak RCC_IRQHandler
  255. .thumb_set RCC_IRQHandler,Default_Handler
  256. .weak EXTI0_IRQHandler
  257. .thumb_set EXTI0_IRQHandler,Default_Handler
  258. .weak EXTI1_IRQHandler
  259. .thumb_set EXTI1_IRQHandler,Default_Handler
  260. .weak EXTI2_TS_IRQHandler
  261. .thumb_set EXTI2_TS_IRQHandler,Default_Handler
  262. .weak EXTI3_IRQHandler
  263. .thumb_set EXTI3_IRQHandler,Default_Handler
  264. .weak EXTI4_IRQHandler
  265. .thumb_set EXTI4_IRQHandler,Default_Handler
  266. .weak DMA1_Channel1_IRQHandler
  267. .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
  268. .weak DMA1_Channel2_IRQHandler
  269. .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
  270. .weak DMA1_Channel3_IRQHandler
  271. .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
  272. .weak DMA1_Channel4_IRQHandler
  273. .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
  274. .weak DMA1_Channel5_IRQHandler
  275. .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
  276. .weak DMA1_Channel6_IRQHandler
  277. .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
  278. .weak DMA1_Channel7_IRQHandler
  279. .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
  280. .weak ADC1_2_IRQHandler
  281. .thumb_set ADC1_2_IRQHandler,Default_Handler
  282. .weak USB_HP_CAN1_TX_IRQHandler
  283. .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
  284. .weak USB_LP_CAN1_RX0_IRQHandler
  285. .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
  286. .weak CAN1_RX1_IRQHandler
  287. .thumb_set CAN1_RX1_IRQHandler,Default_Handler
  288. .weak CAN1_SCE_IRQHandler
  289. .thumb_set CAN1_SCE_IRQHandler,Default_Handler
  290. .weak EXTI9_5_IRQHandler
  291. .thumb_set EXTI9_5_IRQHandler,Default_Handler
  292. .weak TIM1_BRK_TIM15_IRQHandler
  293. .thumb_set TIM1_BRK_TIM15_IRQHandler,Default_Handler
  294. .weak TIM1_UP_TIM16_IRQHandler
  295. .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler
  296. .weak TIM1_TRG_COM_TIM17_IRQHandler
  297. .thumb_set TIM1_TRG_COM_TIM17_IRQHandler,Default_Handler
  298. .weak TIM1_CC_IRQHandler
  299. .thumb_set TIM1_CC_IRQHandler,Default_Handler
  300. .weak TIM2_IRQHandler
  301. .thumb_set TIM2_IRQHandler,Default_Handler
  302. .weak TIM3_IRQHandler
  303. .thumb_set TIM3_IRQHandler,Default_Handler
  304. .weak TIM4_IRQHandler
  305. .thumb_set TIM4_IRQHandler,Default_Handler
  306. .weak I2C1_EV_IRQHandler
  307. .thumb_set I2C1_EV_IRQHandler,Default_Handler
  308. .weak I2C1_ER_IRQHandler
  309. .thumb_set I2C1_ER_IRQHandler,Default_Handler
  310. .weak I2C2_EV_IRQHandler
  311. .thumb_set I2C2_EV_IRQHandler,Default_Handler
  312. .weak I2C2_ER_IRQHandler
  313. .thumb_set I2C2_ER_IRQHandler,Default_Handler
  314. .weak SPI1_IRQHandler
  315. .thumb_set SPI1_IRQHandler,Default_Handler
  316. .weak SPI2_IRQHandler
  317. .thumb_set SPI2_IRQHandler,Default_Handler
  318. .weak USART1_IRQHandler
  319. .thumb_set USART1_IRQHandler,Default_Handler
  320. .weak USART2_IRQHandler
  321. .thumb_set USART2_IRQHandler,Default_Handler
  322. .weak USART3_IRQHandler
  323. .thumb_set USART3_IRQHandler,Default_Handler
  324. .weak EXTI15_10_IRQHandler
  325. .thumb_set EXTI15_10_IRQHandler,Default_Handler
  326. .weak RTC_Alarm_IRQHandler
  327. .thumb_set RTC_Alarm_IRQHandler,Default_Handler
  328. .weak USBWakeUp_IRQHandler
  329. .thumb_set USBWakeUp_IRQHandler,Default_Handler
  330. .weak TIM8_BRK_IRQHandler
  331. .thumb_set TIM8_BRK_IRQHandler,Default_Handler
  332. .weak TIM8_UP_IRQHandler
  333. .thumb_set TIM8_UP_IRQHandler,Default_Handler
  334. .weak TIM8_TRG_COM_IRQHandler
  335. .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler
  336. .weak TIM8_CC_IRQHandler
  337. .thumb_set TIM8_CC_IRQHandler,Default_Handler
  338. .weak ADC3_IRQHandler
  339. .thumb_set ADC3_IRQHandler,Default_Handler
  340. .weak SPI3_IRQHandler
  341. .thumb_set SPI3_IRQHandler,Default_Handler
  342. .weak UART4_IRQHandler
  343. .thumb_set UART4_IRQHandler,Default_Handler
  344. .weak UART5_IRQHandler
  345. .thumb_set UART5_IRQHandler,Default_Handler
  346. .weak TIM6_DAC_IRQHandler
  347. .thumb_set TIM6_DAC_IRQHandler,Default_Handler
  348. .weak TIM7_IRQHandler
  349. .thumb_set TIM7_IRQHandler,Default_Handler
  350. .weak DMA2_Channel1_IRQHandler
  351. .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
  352. .weak DMA2_Channel2_IRQHandler
  353. .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
  354. .weak DMA2_Channel3_IRQHandler
  355. .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
  356. .weak DMA2_Channel4_IRQHandler
  357. .thumb_set DMA2_Channel4_IRQHandler,Default_Handler
  358. .weak DMA2_Channel5_IRQHandler
  359. .thumb_set DMA2_Channel5_IRQHandler,Default_Handler
  360. .weak ADC4_IRQHandler
  361. .thumb_set ADC4_IRQHandler,Default_Handler
  362. .weak COMP1_2_3_IRQHandler
  363. .thumb_set COMP1_2_3_IRQHandler,Default_Handler
  364. .weak COMP4_5_6_IRQHandler
  365. .thumb_set COMP4_5_6_IRQHandler,Default_Handler
  366. .weak COMP7_IRQHandler
  367. .thumb_set COMP7_IRQHandler,Default_Handler
  368. .weak USB_HP_IRQHandler
  369. .thumb_set USB_HP_IRQHandler,Default_Handler
  370. .weak USB_LP_IRQHandler
  371. .thumb_set USB_LP_IRQHandler,Default_Handler
  372. .weak USBWakeUp_RMP_IRQHandler
  373. .thumb_set USBWakeUp_RMP_IRQHandler,Default_Handler
  374. .weak FPU_IRQHandler
  375. .thumb_set FPU_IRQHandler,Default_Handler
  376. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/