startup_stm32f730z8tx.s 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. /**
  2. ******************************************************************************
  3. * @file startup_stm32f730xx.s
  4. * @author MCD Application Team
  5. * @brief STM32F730xx Devices vector table for GCC based toolchain.
  6. * This module performs:
  7. * - Set the initial SP
  8. * - Set the initial PC == Reset_Handler,
  9. * - Set the vector table entries with the exceptions ISR address
  10. * - Branches to main in the C library (which eventually
  11. * calls main()).
  12. * After Reset the Cortex-M7 processor is in Thread mode,
  13. * priority is Privileged, and the Stack is set to Main.
  14. ******************************************************************************
  15. * @attention
  16. *
  17. * Copyright (c) 2016 STMicroelectronics.
  18. * All rights reserved.
  19. *
  20. * This software is licensed under terms that can be found in the LICENSE file
  21. * in the root directory of this software component.
  22. * If no LICENSE file comes with this software, it is provided AS-IS.
  23. *
  24. ******************************************************************************
  25. */
  26. .syntax unified
  27. .cpu cortex-m7
  28. .fpu softvfp
  29. .thumb
  30. .global g_pfnVectors
  31. .global Default_Handler
  32. /* start address for the initialization values of the .data section.
  33. defined in linker script */
  34. .word _sidata
  35. /* start address for the .data section. defined in linker script */
  36. .word _sdata
  37. /* end address for the .data section. defined in linker script */
  38. .word _edata
  39. /* start address for the .bss section. defined in linker script */
  40. .word _sbss
  41. /* end address for the .bss section. defined in linker script */
  42. .word _ebss
  43. /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
  44. /**
  45. * @brief This is the code that gets called when the processor first
  46. * starts execution following a reset event. Only the absolutely
  47. * necessary set is performed, after which the application
  48. * supplied main() routine is called.
  49. * @param None
  50. * @retval : None
  51. */
  52. .section .text.Reset_Handler
  53. .weak Reset_Handler
  54. .type Reset_Handler, %function
  55. Reset_Handler:
  56. ldr sp, =_estack /* set stack pointer */
  57. /* Copy the data segment initializers from flash to SRAM */
  58. ldr r0, =_sdata
  59. ldr r1, =_edata
  60. ldr r2, =_sidata
  61. movs r3, #0
  62. b LoopCopyDataInit
  63. CopyDataInit:
  64. ldr r4, [r2, r3]
  65. str r4, [r0, r3]
  66. adds r3, r3, #4
  67. LoopCopyDataInit:
  68. adds r4, r0, r3
  69. cmp r4, r1
  70. bcc CopyDataInit
  71. /* Zero fill the bss segment. */
  72. ldr r2, =_sbss
  73. ldr r4, =_ebss
  74. movs r3, #0
  75. b LoopFillZerobss
  76. FillZerobss:
  77. str r3, [r2]
  78. adds r2, r2, #4
  79. LoopFillZerobss:
  80. cmp r2, r4
  81. bcc FillZerobss
  82. /* Call the clock system intitialization function.*/
  83. bl SystemInit
  84. /* Call static constructors */
  85. bl __libc_init_array
  86. /* Call the application's entry point.*/
  87. bl main
  88. bx lr
  89. .size Reset_Handler, .-Reset_Handler
  90. /**
  91. * @brief This is the code that gets called when the processor receives an
  92. * unexpected interrupt. This simply enters an infinite loop, preserving
  93. * the system state for examination by a debugger.
  94. * @param None
  95. * @retval None
  96. */
  97. .section .text.Default_Handler,"ax",%progbits
  98. Default_Handler:
  99. Infinite_Loop:
  100. b Infinite_Loop
  101. .size Default_Handler, .-Default_Handler
  102. /******************************************************************************
  103. *
  104. * The minimal vector table for a Cortex M7. Note that the proper constructs
  105. * must be placed on this to ensure that it ends up at physical address
  106. * 0x0000.0000.
  107. *
  108. *******************************************************************************/
  109. .section .isr_vector,"a",%progbits
  110. .type g_pfnVectors, %object
  111. .size g_pfnVectors, .-g_pfnVectors
  112. g_pfnVectors:
  113. .word _estack
  114. .word Reset_Handler
  115. .word NMI_Handler
  116. .word HardFault_Handler
  117. .word MemManage_Handler
  118. .word BusFault_Handler
  119. .word UsageFault_Handler
  120. .word 0
  121. .word 0
  122. .word 0
  123. .word 0
  124. .word SVC_Handler
  125. .word DebugMon_Handler
  126. .word 0
  127. .word PendSV_Handler
  128. .word SysTick_Handler
  129. /* External Interrupts */
  130. .word WWDG_IRQHandler /* Window WatchDog */
  131. .word PVD_IRQHandler /* PVD through EXTI Line detection */
  132. .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
  133. .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
  134. .word FLASH_IRQHandler /* FLASH */
  135. .word RCC_IRQHandler /* RCC */
  136. .word EXTI0_IRQHandler /* EXTI Line0 */
  137. .word EXTI1_IRQHandler /* EXTI Line1 */
  138. .word EXTI2_IRQHandler /* EXTI Line2 */
  139. .word EXTI3_IRQHandler /* EXTI Line3 */
  140. .word EXTI4_IRQHandler /* EXTI Line4 */
  141. .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
  142. .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
  143. .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
  144. .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
  145. .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
  146. .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
  147. .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
  148. .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
  149. .word CAN1_TX_IRQHandler /* CAN1 TX */
  150. .word CAN1_RX0_IRQHandler /* CAN1 RX0 */
  151. .word CAN1_RX1_IRQHandler /* CAN1 RX1 */
  152. .word CAN1_SCE_IRQHandler /* CAN1 SCE */
  153. .word EXTI9_5_IRQHandler /* External Line[9:5]s */
  154. .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
  155. .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
  156. .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
  157. .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
  158. .word TIM2_IRQHandler /* TIM2 */
  159. .word TIM3_IRQHandler /* TIM3 */
  160. .word TIM4_IRQHandler /* TIM4 */
  161. .word I2C1_EV_IRQHandler /* I2C1 Event */
  162. .word I2C1_ER_IRQHandler /* I2C1 Error */
  163. .word I2C2_EV_IRQHandler /* I2C2 Event */
  164. .word I2C2_ER_IRQHandler /* I2C2 Error */
  165. .word SPI1_IRQHandler /* SPI1 */
  166. .word SPI2_IRQHandler /* SPI2 */
  167. .word USART1_IRQHandler /* USART1 */
  168. .word USART2_IRQHandler /* USART2 */
  169. .word USART3_IRQHandler /* USART3 */
  170. .word EXTI15_10_IRQHandler /* External Line[15:10]s */
  171. .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
  172. .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
  173. .word TIM8_BRK_TIM12_IRQHandler /* TIM8 Break and TIM12 */
  174. .word TIM8_UP_TIM13_IRQHandler /* TIM8 Update and TIM13 */
  175. .word TIM8_TRG_COM_TIM14_IRQHandler /* TIM8 Trigger and Commutation and TIM14 */
  176. .word TIM8_CC_IRQHandler /* TIM8 Capture Compare */
  177. .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
  178. .word FMC_IRQHandler /* FMC */
  179. .word SDMMC1_IRQHandler /* SDMMC1 */
  180. .word TIM5_IRQHandler /* TIM5 */
  181. .word SPI3_IRQHandler /* SPI3 */
  182. .word UART4_IRQHandler /* UART4 */
  183. .word UART5_IRQHandler /* UART5 */
  184. .word TIM6_DAC_IRQHandler /* TIM6 and DAC1&2 underrun errors */
  185. .word TIM7_IRQHandler /* TIM7 */
  186. .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
  187. .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
  188. .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
  189. .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
  190. .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
  191. .word 0 /* Reserved */
  192. .word 0 /* Reserved */
  193. .word 0 /* Reserved */
  194. .word 0 /* Reserved */
  195. .word 0 /* Reserved */
  196. .word 0 /* Reserved */
  197. .word OTG_FS_IRQHandler /* USB OTG FS */
  198. .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
  199. .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
  200. .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
  201. .word USART6_IRQHandler /* USART6 */
  202. .word I2C3_EV_IRQHandler /* I2C3 event */
  203. .word I2C3_ER_IRQHandler /* I2C3 error */
  204. .word OTG_HS_EP1_OUT_IRQHandler /* USB OTG HS End Point 1 Out */
  205. .word OTG_HS_EP1_IN_IRQHandler /* USB OTG HS End Point 1 In */
  206. .word OTG_HS_WKUP_IRQHandler /* USB OTG HS Wakeup through EXTI */
  207. .word OTG_HS_IRQHandler /* USB OTG HS */
  208. .word 0 /* Reserved */
  209. .word AES_IRQHandler /* AES */
  210. .word RNG_IRQHandler /* RNG */
  211. .word FPU_IRQHandler /* FPU */
  212. .word UART7_IRQHandler /* UART7 */
  213. .word UART8_IRQHandler /* UART8 */
  214. .word SPI4_IRQHandler /* SPI4 */
  215. .word SPI5_IRQHandler /* SPI5 */
  216. .word 0 /* Reserved */
  217. .word SAI1_IRQHandler /* SAI1 */
  218. .word 0 /* Reserved */
  219. .word 0 /* Reserved */
  220. .word 0 /* Reserved */
  221. .word SAI2_IRQHandler /* SAI2 */
  222. .word QUADSPI_IRQHandler /* QUADSPI */
  223. .word LPTIM1_IRQHandler /* LPTIM1 */
  224. .word 0 /* Reserved */
  225. .word 0 /* Reserved */
  226. .word 0 /* Reserved */
  227. .word 0 /* Reserved */
  228. .word 0 /* Reserved */
  229. .word 0 /* Reserved */
  230. .word 0 /* Reserved */
  231. .word 0 /* Reserved */
  232. .word 0 /* Reserved */
  233. .word SDMMC2_IRQHandler /* SDMMC2 */
  234. /*******************************************************************************
  235. *
  236. * Provide weak aliases for each Exception handler to the Default_Handler.
  237. * As they are weak aliases, any function with the same name will override
  238. * this definition.
  239. *
  240. *******************************************************************************/
  241. .weak NMI_Handler
  242. .thumb_set NMI_Handler,Default_Handler
  243. .weak HardFault_Handler
  244. .thumb_set HardFault_Handler,Default_Handler
  245. .weak MemManage_Handler
  246. .thumb_set MemManage_Handler,Default_Handler
  247. .weak BusFault_Handler
  248. .thumb_set BusFault_Handler,Default_Handler
  249. .weak UsageFault_Handler
  250. .thumb_set UsageFault_Handler,Default_Handler
  251. .weak SVC_Handler
  252. .thumb_set SVC_Handler,Default_Handler
  253. .weak DebugMon_Handler
  254. .thumb_set DebugMon_Handler,Default_Handler
  255. .weak PendSV_Handler
  256. .thumb_set PendSV_Handler,Default_Handler
  257. .weak SysTick_Handler
  258. .thumb_set SysTick_Handler,Default_Handler
  259. .weak WWDG_IRQHandler
  260. .thumb_set WWDG_IRQHandler,Default_Handler
  261. .weak PVD_IRQHandler
  262. .thumb_set PVD_IRQHandler,Default_Handler
  263. .weak TAMP_STAMP_IRQHandler
  264. .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
  265. .weak RTC_WKUP_IRQHandler
  266. .thumb_set RTC_WKUP_IRQHandler,Default_Handler
  267. .weak FLASH_IRQHandler
  268. .thumb_set FLASH_IRQHandler,Default_Handler
  269. .weak RCC_IRQHandler
  270. .thumb_set RCC_IRQHandler,Default_Handler
  271. .weak EXTI0_IRQHandler
  272. .thumb_set EXTI0_IRQHandler,Default_Handler
  273. .weak EXTI1_IRQHandler
  274. .thumb_set EXTI1_IRQHandler,Default_Handler
  275. .weak EXTI2_IRQHandler
  276. .thumb_set EXTI2_IRQHandler,Default_Handler
  277. .weak EXTI3_IRQHandler
  278. .thumb_set EXTI3_IRQHandler,Default_Handler
  279. .weak EXTI4_IRQHandler
  280. .thumb_set EXTI4_IRQHandler,Default_Handler
  281. .weak DMA1_Stream0_IRQHandler
  282. .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
  283. .weak DMA1_Stream1_IRQHandler
  284. .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
  285. .weak DMA1_Stream2_IRQHandler
  286. .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
  287. .weak DMA1_Stream3_IRQHandler
  288. .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
  289. .weak DMA1_Stream4_IRQHandler
  290. .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
  291. .weak DMA1_Stream5_IRQHandler
  292. .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
  293. .weak DMA1_Stream6_IRQHandler
  294. .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
  295. .weak ADC_IRQHandler
  296. .thumb_set ADC_IRQHandler,Default_Handler
  297. .weak CAN1_TX_IRQHandler
  298. .thumb_set CAN1_TX_IRQHandler,Default_Handler
  299. .weak CAN1_RX0_IRQHandler
  300. .thumb_set CAN1_RX0_IRQHandler,Default_Handler
  301. .weak CAN1_RX1_IRQHandler
  302. .thumb_set CAN1_RX1_IRQHandler,Default_Handler
  303. .weak CAN1_SCE_IRQHandler
  304. .thumb_set CAN1_SCE_IRQHandler,Default_Handler
  305. .weak EXTI9_5_IRQHandler
  306. .thumb_set EXTI9_5_IRQHandler,Default_Handler
  307. .weak TIM1_BRK_TIM9_IRQHandler
  308. .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
  309. .weak TIM1_UP_TIM10_IRQHandler
  310. .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
  311. .weak TIM1_TRG_COM_TIM11_IRQHandler
  312. .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
  313. .weak TIM1_CC_IRQHandler
  314. .thumb_set TIM1_CC_IRQHandler,Default_Handler
  315. .weak TIM2_IRQHandler
  316. .thumb_set TIM2_IRQHandler,Default_Handler
  317. .weak TIM3_IRQHandler
  318. .thumb_set TIM3_IRQHandler,Default_Handler
  319. .weak TIM4_IRQHandler
  320. .thumb_set TIM4_IRQHandler,Default_Handler
  321. .weak I2C1_EV_IRQHandler
  322. .thumb_set I2C1_EV_IRQHandler,Default_Handler
  323. .weak I2C1_ER_IRQHandler
  324. .thumb_set I2C1_ER_IRQHandler,Default_Handler
  325. .weak I2C2_EV_IRQHandler
  326. .thumb_set I2C2_EV_IRQHandler,Default_Handler
  327. .weak I2C2_ER_IRQHandler
  328. .thumb_set I2C2_ER_IRQHandler,Default_Handler
  329. .weak SPI1_IRQHandler
  330. .thumb_set SPI1_IRQHandler,Default_Handler
  331. .weak SPI2_IRQHandler
  332. .thumb_set SPI2_IRQHandler,Default_Handler
  333. .weak USART1_IRQHandler
  334. .thumb_set USART1_IRQHandler,Default_Handler
  335. .weak USART2_IRQHandler
  336. .thumb_set USART2_IRQHandler,Default_Handler
  337. .weak USART3_IRQHandler
  338. .thumb_set USART3_IRQHandler,Default_Handler
  339. .weak EXTI15_10_IRQHandler
  340. .thumb_set EXTI15_10_IRQHandler,Default_Handler
  341. .weak RTC_Alarm_IRQHandler
  342. .thumb_set RTC_Alarm_IRQHandler,Default_Handler
  343. .weak OTG_FS_WKUP_IRQHandler
  344. .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
  345. .weak TIM8_BRK_TIM12_IRQHandler
  346. .thumb_set TIM8_BRK_TIM12_IRQHandler,Default_Handler
  347. .weak TIM8_UP_TIM13_IRQHandler
  348. .thumb_set TIM8_UP_TIM13_IRQHandler,Default_Handler
  349. .weak TIM8_TRG_COM_TIM14_IRQHandler
  350. .thumb_set TIM8_TRG_COM_TIM14_IRQHandler,Default_Handler
  351. .weak TIM8_CC_IRQHandler
  352. .thumb_set TIM8_CC_IRQHandler,Default_Handler
  353. .weak DMA1_Stream7_IRQHandler
  354. .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
  355. .weak FMC_IRQHandler
  356. .thumb_set FMC_IRQHandler,Default_Handler
  357. .weak SDMMC1_IRQHandler
  358. .thumb_set SDMMC1_IRQHandler,Default_Handler
  359. .weak TIM5_IRQHandler
  360. .thumb_set TIM5_IRQHandler,Default_Handler
  361. .weak SPI3_IRQHandler
  362. .thumb_set SPI3_IRQHandler,Default_Handler
  363. .weak UART4_IRQHandler
  364. .thumb_set UART4_IRQHandler,Default_Handler
  365. .weak UART5_IRQHandler
  366. .thumb_set UART5_IRQHandler,Default_Handler
  367. .weak TIM6_DAC_IRQHandler
  368. .thumb_set TIM6_DAC_IRQHandler,Default_Handler
  369. .weak TIM7_IRQHandler
  370. .thumb_set TIM7_IRQHandler,Default_Handler
  371. .weak DMA2_Stream0_IRQHandler
  372. .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
  373. .weak DMA2_Stream1_IRQHandler
  374. .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
  375. .weak DMA2_Stream2_IRQHandler
  376. .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
  377. .weak DMA2_Stream3_IRQHandler
  378. .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
  379. .weak DMA2_Stream4_IRQHandler
  380. .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
  381. .weak OTG_FS_IRQHandler
  382. .thumb_set OTG_FS_IRQHandler,Default_Handler
  383. .weak DMA2_Stream5_IRQHandler
  384. .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
  385. .weak DMA2_Stream6_IRQHandler
  386. .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
  387. .weak DMA2_Stream7_IRQHandler
  388. .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
  389. .weak USART6_IRQHandler
  390. .thumb_set USART6_IRQHandler,Default_Handler
  391. .weak I2C3_EV_IRQHandler
  392. .thumb_set I2C3_EV_IRQHandler,Default_Handler
  393. .weak I2C3_ER_IRQHandler
  394. .thumb_set I2C3_ER_IRQHandler,Default_Handler
  395. .weak OTG_HS_EP1_OUT_IRQHandler
  396. .thumb_set OTG_HS_EP1_OUT_IRQHandler,Default_Handler
  397. .weak OTG_HS_EP1_IN_IRQHandler
  398. .thumb_set OTG_HS_EP1_IN_IRQHandler,Default_Handler
  399. .weak OTG_HS_WKUP_IRQHandler
  400. .thumb_set OTG_HS_WKUP_IRQHandler,Default_Handler
  401. .weak OTG_HS_IRQHandler
  402. .thumb_set OTG_HS_IRQHandler,Default_Handler
  403. .weak AES_IRQHandler
  404. .thumb_set AES_IRQHandler,Default_Handler
  405. .weak RNG_IRQHandler
  406. .thumb_set RNG_IRQHandler,Default_Handler
  407. .weak FPU_IRQHandler
  408. .thumb_set FPU_IRQHandler,Default_Handler
  409. .weak UART7_IRQHandler
  410. .thumb_set UART7_IRQHandler,Default_Handler
  411. .weak UART8_IRQHandler
  412. .thumb_set UART8_IRQHandler,Default_Handler
  413. .weak SPI4_IRQHandler
  414. .thumb_set SPI4_IRQHandler,Default_Handler
  415. .weak SPI5_IRQHandler
  416. .thumb_set SPI5_IRQHandler,Default_Handler
  417. .weak SAI1_IRQHandler
  418. .thumb_set SAI1_IRQHandler,Default_Handler
  419. .weak SAI2_IRQHandler
  420. .thumb_set SAI2_IRQHandler,Default_Handler
  421. .weak QUADSPI_IRQHandler
  422. .thumb_set QUADSPI_IRQHandler,Default_Handler
  423. .weak LPTIM1_IRQHandler
  424. .thumb_set LPTIM1_IRQHandler,Default_Handler
  425. .weak SDMMC2_IRQHandler
  426. .thumb_set SDMMC2_IRQHandler,Default_Handler