startup_stm32wb55xx_cm4.s 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. /**
  2. ******************************************************************************
  3. * @file startup_stm32wb55xx_cm4.s
  4. * @author MCD Application Team
  5. * @brief STM32WB55xx devices vector table GCC 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-M4 processor is in Thread mode,
  13. * priority is Privileged, and the Stack is set to Main.
  14. ******************************************************************************
  15. * @attention
  16. *
  17. * Copyright (c) 2019-2021 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-m4
  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. /* start address for the .MB_MEM2 section. defined in linker script */
  44. .word _sMB_MEM2
  45. /* end address for the .MB_MEM2 section. defined in linker script */
  46. .word _eMB_MEM2
  47. /* INIT_BSS macro is used to fill the specified region [start : end] with zeros */
  48. .macro INIT_BSS start, end
  49. ldr r0, =\start
  50. ldr r1, =\end
  51. movs r3, #0
  52. bl LoopFillZerobss
  53. .endm
  54. /* INIT_DATA macro is used to copy data in the region [start : end] starting from 'src' */
  55. .macro INIT_DATA start, end, src
  56. ldr r0, =\start
  57. ldr r1, =\end
  58. ldr r2, =\src
  59. movs r3, #0
  60. bl LoopCopyDataInit
  61. .endm
  62. .section .text.data_initializers
  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. bx lr
  72. FillZerobss:
  73. str r3, [r0]
  74. adds r0, r0, #4
  75. LoopFillZerobss:
  76. cmp r0, r1
  77. bcc FillZerobss
  78. bx lr
  79. .section .text.Reset_Handler
  80. .weak Reset_Handler
  81. .type Reset_Handler, %function
  82. Reset_Handler:
  83. ldr r0, =_estack
  84. mov sp, r0 /* set stack pointer */
  85. /* Call the clock system intitialization function.*/
  86. bl SystemInit
  87. /* Copy the data segment initializers from flash to SRAM */
  88. INIT_DATA _sdata, _edata, _sidata
  89. /* Zero fill the bss segments. */
  90. INIT_BSS _sbss, _ebss
  91. INIT_BSS _sMB_MEM2, _eMB_MEM2
  92. /* Call static constructors */
  93. bl __libc_init_array
  94. /* Call the application s entry point.*/
  95. bl main
  96. LoopForever:
  97. b LoopForever
  98. .size Reset_Handler, .-Reset_Handler
  99. /**
  100. * @brief This is the code that gets called when the processor receives an
  101. * unexpected interrupt. This simply enters an infinite loop, preserving
  102. * the system state for examination by a debugger.
  103. *
  104. * @param None
  105. * @retval None
  106. */
  107. .section .text.Default_Handler,"ax",%progbits
  108. Default_Handler:
  109. Infinite_Loop:
  110. b Infinite_Loop
  111. .size Default_Handler, .-Default_Handler
  112. /******************************************************************************
  113. *
  114. * The minimal vector table for a Cortex-M4. Note that the proper constructs
  115. * must be placed on this to ensure that it ends up at physical address
  116. * 0x0000.0000.
  117. *
  118. ******************************************************************************/
  119. .section .isr_vector,"a",%progbits
  120. .type g_pfnVectors, %object
  121. .size g_pfnVectors, .-g_pfnVectors
  122. g_pfnVectors:
  123. .word _estack
  124. .word Reset_Handler
  125. .word NMI_Handler
  126. .word HardFault_Handler
  127. .word MemManage_Handler
  128. .word BusFault_Handler
  129. .word UsageFault_Handler
  130. .word 0
  131. .word 0
  132. .word 0
  133. .word 0
  134. .word SVC_Handler
  135. .word DebugMon_Handler
  136. .word 0
  137. .word PendSV_Handler
  138. .word SysTick_Handler
  139. .word WWDG_IRQHandler
  140. .word PVD_PVM_IRQHandler
  141. .word TAMP_STAMP_LSECSS_IRQHandler
  142. .word RTC_WKUP_IRQHandler
  143. .word FLASH_IRQHandler
  144. .word RCC_IRQHandler
  145. .word EXTI0_IRQHandler
  146. .word EXTI1_IRQHandler
  147. .word EXTI2_IRQHandler
  148. .word EXTI3_IRQHandler
  149. .word EXTI4_IRQHandler
  150. .word DMA1_Channel1_IRQHandler
  151. .word DMA1_Channel2_IRQHandler
  152. .word DMA1_Channel3_IRQHandler
  153. .word DMA1_Channel4_IRQHandler
  154. .word DMA1_Channel5_IRQHandler
  155. .word DMA1_Channel6_IRQHandler
  156. .word DMA1_Channel7_IRQHandler
  157. .word ADC1_IRQHandler
  158. .word USB_HP_IRQHandler
  159. .word USB_LP_IRQHandler
  160. .word C2SEV_PWR_C2H_IRQHandler
  161. .word COMP_IRQHandler
  162. .word EXTI9_5_IRQHandler
  163. .word TIM1_BRK_IRQHandler
  164. .word TIM1_UP_TIM16_IRQHandler
  165. .word TIM1_TRG_COM_TIM17_IRQHandler
  166. .word TIM1_CC_IRQHandler
  167. .word TIM2_IRQHandler
  168. .word PKA_IRQHandler
  169. .word I2C1_EV_IRQHandler
  170. .word I2C1_ER_IRQHandler
  171. .word I2C3_EV_IRQHandler
  172. .word I2C3_ER_IRQHandler
  173. .word SPI1_IRQHandler
  174. .word SPI2_IRQHandler
  175. .word USART1_IRQHandler
  176. .word LPUART1_IRQHandler
  177. .word SAI1_IRQHandler
  178. .word TSC_IRQHandler
  179. .word EXTI15_10_IRQHandler
  180. .word RTC_Alarm_IRQHandler
  181. .word CRS_IRQHandler
  182. .word PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler
  183. .word IPCC_C1_RX_IRQHandler
  184. .word IPCC_C1_TX_IRQHandler
  185. .word HSEM_IRQHandler
  186. .word LPTIM1_IRQHandler
  187. .word LPTIM2_IRQHandler
  188. .word LCD_IRQHandler
  189. .word QUADSPI_IRQHandler
  190. .word AES1_IRQHandler
  191. .word AES2_IRQHandler
  192. .word RNG_IRQHandler
  193. .word FPU_IRQHandler
  194. .word DMA2_Channel1_IRQHandler
  195. .word DMA2_Channel2_IRQHandler
  196. .word DMA2_Channel3_IRQHandler
  197. .word DMA2_Channel4_IRQHandler
  198. .word DMA2_Channel5_IRQHandler
  199. .word DMA2_Channel6_IRQHandler
  200. .word DMA2_Channel7_IRQHandler
  201. .word DMAMUX1_OVR_IRQHandler
  202. /*******************************************************************************
  203. *
  204. * Provide weak aliases for each Exception handler to the Default_Handler.
  205. * As they are weak aliases, any function with the same name will override
  206. * this definition.
  207. *
  208. *******************************************************************************/
  209. .weak NMI_Handler
  210. .thumb_set NMI_Handler,Default_Handler
  211. .weak HardFault_Handler
  212. .thumb_set HardFault_Handler,Default_Handler
  213. .weak MemManage_Handler
  214. .thumb_set MemManage_Handler,Default_Handler
  215. .weak BusFault_Handler
  216. .thumb_set BusFault_Handler,Default_Handler
  217. .weak UsageFault_Handler
  218. .thumb_set UsageFault_Handler,Default_Handler
  219. .weak SVC_Handler
  220. .thumb_set SVC_Handler,Default_Handler
  221. .weak DebugMon_Handler
  222. .thumb_set DebugMon_Handler,Default_Handler
  223. .weak PendSV_Handler
  224. .thumb_set PendSV_Handler,Default_Handler
  225. .weak SysTick_Handler
  226. .thumb_set SysTick_Handler,Default_Handler
  227. .weak WWDG_IRQHandler
  228. .thumb_set WWDG_IRQHandler,Default_Handler
  229. .weak PVD_PVM_IRQHandler
  230. .thumb_set PVD_PVM_IRQHandler,Default_Handler
  231. .weak TAMP_STAMP_LSECSS_IRQHandler
  232. .thumb_set TAMP_STAMP_LSECSS_IRQHandler,Default_Handler
  233. .weak RTC_WKUP_IRQHandler
  234. .thumb_set RTC_WKUP_IRQHandler,Default_Handler
  235. .weak FLASH_IRQHandler
  236. .thumb_set FLASH_IRQHandler,Default_Handler
  237. .weak RCC_IRQHandler
  238. .thumb_set RCC_IRQHandler,Default_Handler
  239. .weak EXTI0_IRQHandler
  240. .thumb_set EXTI0_IRQHandler,Default_Handler
  241. .weak EXTI1_IRQHandler
  242. .thumb_set EXTI1_IRQHandler,Default_Handler
  243. .weak EXTI2_IRQHandler
  244. .thumb_set EXTI2_IRQHandler,Default_Handler
  245. .weak EXTI3_IRQHandler
  246. .thumb_set EXTI3_IRQHandler,Default_Handler
  247. .weak EXTI4_IRQHandler
  248. .thumb_set EXTI4_IRQHandler,Default_Handler
  249. .weak DMA1_Channel1_IRQHandler
  250. .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
  251. .weak DMA1_Channel2_IRQHandler
  252. .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
  253. .weak DMA1_Channel3_IRQHandler
  254. .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
  255. .weak DMA1_Channel4_IRQHandler
  256. .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
  257. .weak DMA1_Channel5_IRQHandler
  258. .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
  259. .weak DMA1_Channel6_IRQHandler
  260. .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
  261. .weak DMA1_Channel7_IRQHandler
  262. .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
  263. .weak ADC1_IRQHandler
  264. .thumb_set ADC1_IRQHandler,Default_Handler
  265. .weak USB_HP_IRQHandler
  266. .thumb_set USB_HP_IRQHandler,Default_Handler
  267. .weak USB_LP_IRQHandler
  268. .thumb_set USB_LP_IRQHandler,Default_Handler
  269. .weak C2SEV_PWR_C2H_IRQHandler
  270. .thumb_set C2SEV_PWR_C2H_IRQHandler,Default_Handler
  271. .weak COMP_IRQHandler
  272. .thumb_set COMP_IRQHandler,Default_Handler
  273. .weak EXTI9_5_IRQHandler
  274. .thumb_set EXTI9_5_IRQHandler,Default_Handler
  275. .weak TIM1_BRK_IRQHandler
  276. .thumb_set TIM1_BRK_IRQHandler,Default_Handler
  277. .weak TIM1_UP_TIM16_IRQHandler
  278. .thumb_set TIM1_UP_TIM16_IRQHandler,Default_Handler
  279. .weak TIM1_TRG_COM_TIM17_IRQHandler
  280. .thumb_set TIM1_TRG_COM_TIM17_IRQHandler,Default_Handler
  281. .weak TIM1_CC_IRQHandler
  282. .thumb_set TIM1_CC_IRQHandler,Default_Handler
  283. .weak TIM2_IRQHandler
  284. .thumb_set TIM2_IRQHandler,Default_Handler
  285. .weak PKA_IRQHandler
  286. .thumb_set PKA_IRQHandler,Default_Handler
  287. .weak I2C1_EV_IRQHandler
  288. .thumb_set I2C1_EV_IRQHandler,Default_Handler
  289. .weak I2C1_ER_IRQHandler
  290. .thumb_set I2C1_ER_IRQHandler,Default_Handler
  291. .weak I2C3_EV_IRQHandler
  292. .thumb_set I2C3_EV_IRQHandler,Default_Handler
  293. .weak I2C3_ER_IRQHandler
  294. .thumb_set I2C3_ER_IRQHandler,Default_Handler
  295. .weak SPI1_IRQHandler
  296. .thumb_set SPI1_IRQHandler,Default_Handler
  297. .weak SPI2_IRQHandler
  298. .thumb_set SPI2_IRQHandler,Default_Handler
  299. .weak USART1_IRQHandler
  300. .thumb_set USART1_IRQHandler,Default_Handler
  301. .weak LPUART1_IRQHandler
  302. .thumb_set LPUART1_IRQHandler,Default_Handler
  303. .weak SAI1_IRQHandler
  304. .thumb_set SAI1_IRQHandler,Default_Handler
  305. .weak TSC_IRQHandler
  306. .thumb_set TSC_IRQHandler,Default_Handler
  307. .weak EXTI15_10_IRQHandler
  308. .thumb_set EXTI15_10_IRQHandler,Default_Handler
  309. .weak RTC_Alarm_IRQHandler
  310. .thumb_set RTC_Alarm_IRQHandler,Default_Handler
  311. .weak CRS_IRQHandler
  312. .thumb_set CRS_IRQHandler,Default_Handler
  313. .weak PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler
  314. .thumb_set PWR_SOTF_BLEACT_802ACT_RFPHASE_IRQHandler,Default_Handler
  315. .weak IPCC_C1_RX_IRQHandler
  316. .thumb_set IPCC_C1_RX_IRQHandler,Default_Handler
  317. .weak IPCC_C1_TX_IRQHandler
  318. .thumb_set IPCC_C1_TX_IRQHandler,Default_Handler
  319. .weak HSEM_IRQHandler
  320. .thumb_set HSEM_IRQHandler,Default_Handler
  321. .weak LPTIM1_IRQHandler
  322. .thumb_set LPTIM1_IRQHandler,Default_Handler
  323. .weak LPTIM2_IRQHandler
  324. .thumb_set LPTIM2_IRQHandler,Default_Handler
  325. .weak LCD_IRQHandler
  326. .thumb_set LCD_IRQHandler,Default_Handler
  327. .weak QUADSPI_IRQHandler
  328. .thumb_set QUADSPI_IRQHandler,Default_Handler
  329. .weak AES1_IRQHandler
  330. .thumb_set AES1_IRQHandler,Default_Handler
  331. .weak AES2_IRQHandler
  332. .thumb_set AES2_IRQHandler,Default_Handler
  333. .weak RNG_IRQHandler
  334. .thumb_set RNG_IRQHandler,Default_Handler
  335. .weak FPU_IRQHandler
  336. .thumb_set FPU_IRQHandler,Default_Handler
  337. .weak DMA2_Channel1_IRQHandler
  338. .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
  339. .weak DMA2_Channel2_IRQHandler
  340. .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
  341. .weak DMA2_Channel3_IRQHandler
  342. .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
  343. .weak DMA2_Channel4_IRQHandler
  344. .thumb_set DMA2_Channel4_IRQHandler,Default_Handler
  345. .weak DMA2_Channel5_IRQHandler
  346. .thumb_set DMA2_Channel5_IRQHandler,Default_Handler
  347. .weak DMA2_Channel6_IRQHandler
  348. .thumb_set DMA2_Channel6_IRQHandler,Default_Handler
  349. .weak DMA2_Channel7_IRQHandler
  350. .thumb_set DMA2_Channel7_IRQHandler,Default_Handler
  351. .weak DMAMUX1_OVR_IRQHandler
  352. .thumb_set DMAMUX1_OVR_IRQHandler,Default_Handler
  353. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/