startup_stm32f401xx.s 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. ;/******************** (C) COPYRIGHT 2015 STMicroelectronics ********************
  2. ;* File Name : startup_stm32f401x.s
  3. ;* Author : MCD Application Team
  4. ;* @version : V1.5.0
  5. ;* @date : 06-March-2015
  6. ;* Description : STM32F401xx devices vector table for EWARM toolchain.
  7. ;* This module performs:
  8. ;* - Set the initial SP
  9. ;* - Set the initial PC == _iar_program_start,
  10. ;* - Set the vector table entries with the exceptions ISR
  11. ;* address.
  12. ;* - Configure the system clock
  13. ;* - Branches to main in the C library (which eventually
  14. ;* calls main()).
  15. ;* After Reset the Cortex-M4 processor is in Thread mode,
  16. ;* priority is Privileged, and the Stack is set to Main.
  17. ;********************************************************************************
  18. ;*
  19. ;* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  20. ;* You may not use this file except in compliance with the License.
  21. ;* You may obtain a copy of the License at:
  22. ;*
  23. ;* http://www.st.com/software_license_agreement_liberty_v2
  24. ;*
  25. ;* Unless required by applicable law or agreed to in writing, software
  26. ;* distributed under the License is distributed on an "AS IS" BASIS,
  27. ;* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  28. ;* See the License for the specific language governing permissions and
  29. ;* limitations under the License.
  30. ;*
  31. ;*******************************************************************************/
  32. ;
  33. ;
  34. ; The modules in this file are included in the libraries, and may be replaced
  35. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  36. ; a user defined start symbol.
  37. ; To override the cstartup defined in the library, simply add your modified
  38. ; version to the workbench project.
  39. ;
  40. ; The vector table is normally located at address 0.
  41. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  42. ; The name "__vector_table" has special meaning for C-SPY:
  43. ; it is where the SP start value is found, and the NVIC vector
  44. ; table register (VTOR) is initialized to this address if != 0.
  45. ;
  46. ; Cortex-M version
  47. ;
  48. MODULE ?cstartup
  49. ;; Forward declaration of sections.
  50. SECTION CSTACK:DATA:NOROOT(3)
  51. SECTION .intvec:CODE:NOROOT(2)
  52. EXTERN __iar_program_start
  53. EXTERN SystemInit
  54. PUBLIC __vector_table
  55. DATA
  56. __vector_table
  57. DCD sfe(CSTACK)
  58. DCD Reset_Handler ; Reset Handler
  59. DCD NMI_Handler ; NMI Handler
  60. DCD HardFault_Handler ; Hard Fault Handler
  61. DCD MemManage_Handler ; MPU Fault Handler
  62. DCD BusFault_Handler ; Bus Fault Handler
  63. DCD UsageFault_Handler ; Usage Fault Handler
  64. DCD 0 ; Reserved
  65. DCD 0 ; Reserved
  66. DCD 0 ; Reserved
  67. DCD 0 ; Reserved
  68. DCD SVC_Handler ; SVCall Handler
  69. DCD DebugMon_Handler ; Debug Monitor Handler
  70. DCD 0 ; Reserved
  71. DCD PendSV_Handler ; PendSV Handler
  72. DCD SysTick_Handler ; SysTick Handler
  73. ; External Interrupts
  74. DCD WWDG_IRQHandler ; Window WatchDog
  75. DCD PVD_IRQHandler ; PVD through EXTI Line detection
  76. DCD TAMP_STAMP_IRQHandler ; Tamper and TimeStamps through the EXTI line
  77. DCD RTC_WKUP_IRQHandler ; RTC Wakeup through the EXTI line
  78. DCD FLASH_IRQHandler ; FLASH
  79. DCD RCC_IRQHandler ; RCC
  80. DCD EXTI0_IRQHandler ; EXTI Line0
  81. DCD EXTI1_IRQHandler ; EXTI Line1
  82. DCD EXTI2_IRQHandler ; EXTI Line2
  83. DCD EXTI3_IRQHandler ; EXTI Line3
  84. DCD EXTI4_IRQHandler ; EXTI Line4
  85. DCD DMA1_Stream0_IRQHandler ; DMA1 Stream 0
  86. DCD DMA1_Stream1_IRQHandler ; DMA1 Stream 1
  87. DCD DMA1_Stream2_IRQHandler ; DMA1 Stream 2
  88. DCD DMA1_Stream3_IRQHandler ; DMA1 Stream 3
  89. DCD DMA1_Stream4_IRQHandler ; DMA1 Stream 4
  90. DCD DMA1_Stream5_IRQHandler ; DMA1 Stream 5
  91. DCD DMA1_Stream6_IRQHandler ; DMA1 Stream 6
  92. DCD ADC_IRQHandler ; ADC1
  93. DCD 0 ; Reserved
  94. DCD 0 ; Reserved
  95. DCD 0 ; Reserved
  96. DCD 0 ; Reserved
  97. DCD EXTI9_5_IRQHandler ; External Line[9:5]s
  98. DCD TIM1_BRK_TIM9_IRQHandler ; TIM1 Break and TIM9
  99. DCD TIM1_UP_TIM10_IRQHandler ; TIM1 Update and TIM10
  100. DCD TIM1_TRG_COM_TIM11_IRQHandler ; TIM1 Trigger and Commutation and TIM11
  101. DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  102. DCD TIM2_IRQHandler ; TIM2
  103. DCD TIM3_IRQHandler ; TIM3
  104. DCD TIM4_IRQHandler ; TIM4
  105. DCD I2C1_EV_IRQHandler ; I2C1 Event
  106. DCD I2C1_ER_IRQHandler ; I2C1 Error
  107. DCD I2C2_EV_IRQHandler ; I2C2 Event
  108. DCD I2C2_ER_IRQHandler ; I2C2 Error
  109. DCD SPI1_IRQHandler ; SPI1
  110. DCD SPI2_IRQHandler ; SPI2
  111. DCD USART1_IRQHandler ; USART1
  112. DCD USART2_IRQHandler ; USART2
  113. DCD 0 ; Reserved
  114. DCD EXTI15_10_IRQHandler ; External Line[15:10]s
  115. DCD RTC_Alarm_IRQHandler ; RTC Alarm (A and B) through EXTI Line
  116. DCD OTG_FS_WKUP_IRQHandler ; USB OTG FS Wakeup through EXTI line
  117. DCD 0 ; Reserved
  118. DCD 0 ; Reserved
  119. DCD 0 ; Reserved
  120. DCD 0 ; Reserved
  121. DCD DMA1_Stream7_IRQHandler ; DMA1 Stream7
  122. DCD 0 ; Reserved
  123. DCD SDIO_IRQHandler ; SDIO
  124. DCD TIM5_IRQHandler ; TIM5
  125. DCD SPI3_IRQHandler ; SPI3
  126. DCD 0 ; Reserved
  127. DCD 0 ; Reserved
  128. DCD 0 ; Reserved
  129. DCD 0 ; Reserved
  130. DCD DMA2_Stream0_IRQHandler ; DMA2 Stream 0
  131. DCD DMA2_Stream1_IRQHandler ; DMA2 Stream 1
  132. DCD DMA2_Stream2_IRQHandler ; DMA2 Stream 2
  133. DCD DMA2_Stream3_IRQHandler ; DMA2 Stream 3
  134. DCD DMA2_Stream4_IRQHandler ; DMA2 Stream 4
  135. DCD 0 ; Reserved
  136. DCD 0 ; Reserved
  137. DCD 0 ; Reserved
  138. DCD 0 ; Reserved
  139. DCD 0 ; Reserved
  140. DCD 0 ; Reserved
  141. DCD OTG_FS_IRQHandler ; USB OTG FS
  142. DCD DMA2_Stream5_IRQHandler ; DMA2 Stream 5
  143. DCD DMA2_Stream6_IRQHandler ; DMA2 Stream 6
  144. DCD DMA2_Stream7_IRQHandler ; DMA2 Stream 7
  145. DCD USART6_IRQHandler ; USART6
  146. DCD I2C3_EV_IRQHandler ; I2C3 event
  147. DCD I2C3_ER_IRQHandler ; I2C3 error
  148. DCD 0 ; Reserved
  149. DCD 0 ; Reserved
  150. DCD 0 ; Reserved
  151. DCD 0 ; Reserved
  152. DCD 0 ; Reserved
  153. DCD 0 ; Reserved
  154. DCD 0 ; Reserved
  155. DCD FPU_IRQHandler ; FPU
  156. DCD 0 ; Reserved
  157. DCD 0 ; Reserved
  158. DCD SPI4_IRQHandler ; SPI4
  159. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  160. ;;
  161. ;; Default interrupt handlers.
  162. ;;
  163. THUMB
  164. PUBWEAK Reset_Handler
  165. SECTION .text:CODE:REORDER:NOROOT(2)
  166. Reset_Handler
  167. LDR R0, =SystemInit
  168. BLX R0
  169. LDR R0, =__iar_program_start
  170. BX R0
  171. PUBWEAK NMI_Handler
  172. SECTION .text:CODE:REORDER:NOROOT(1)
  173. NMI_Handler
  174. B NMI_Handler
  175. PUBWEAK HardFault_Handler
  176. SECTION .text:CODE:REORDER:NOROOT(1)
  177. HardFault_Handler
  178. B HardFault_Handler
  179. PUBWEAK MemManage_Handler
  180. SECTION .text:CODE:REORDER:NOROOT(1)
  181. MemManage_Handler
  182. B MemManage_Handler
  183. PUBWEAK BusFault_Handler
  184. SECTION .text:CODE:REORDER:NOROOT(1)
  185. BusFault_Handler
  186. B BusFault_Handler
  187. PUBWEAK UsageFault_Handler
  188. SECTION .text:CODE:REORDER:NOROOT(1)
  189. UsageFault_Handler
  190. B UsageFault_Handler
  191. PUBWEAK SVC_Handler
  192. SECTION .text:CODE:REORDER:NOROOT(1)
  193. SVC_Handler
  194. B SVC_Handler
  195. PUBWEAK DebugMon_Handler
  196. SECTION .text:CODE:REORDER:NOROOT(1)
  197. DebugMon_Handler
  198. B DebugMon_Handler
  199. PUBWEAK PendSV_Handler
  200. SECTION .text:CODE:REORDER:NOROOT(1)
  201. PendSV_Handler
  202. B PendSV_Handler
  203. PUBWEAK SysTick_Handler
  204. SECTION .text:CODE:REORDER:NOROOT(1)
  205. SysTick_Handler
  206. B SysTick_Handler
  207. PUBWEAK WWDG_IRQHandler
  208. SECTION .text:CODE:REORDER:NOROOT(1)
  209. WWDG_IRQHandler
  210. B WWDG_IRQHandler
  211. PUBWEAK PVD_IRQHandler
  212. SECTION .text:CODE:REORDER:NOROOT(1)
  213. PVD_IRQHandler
  214. B PVD_IRQHandler
  215. PUBWEAK TAMP_STAMP_IRQHandler
  216. SECTION .text:CODE:REORDER:NOROOT(1)
  217. TAMP_STAMP_IRQHandler
  218. B TAMP_STAMP_IRQHandler
  219. PUBWEAK RTC_WKUP_IRQHandler
  220. SECTION .text:CODE:REORDER:NOROOT(1)
  221. RTC_WKUP_IRQHandler
  222. B RTC_WKUP_IRQHandler
  223. PUBWEAK FLASH_IRQHandler
  224. SECTION .text:CODE:REORDER:NOROOT(1)
  225. FLASH_IRQHandler
  226. B FLASH_IRQHandler
  227. PUBWEAK RCC_IRQHandler
  228. SECTION .text:CODE:REORDER:NOROOT(1)
  229. RCC_IRQHandler
  230. B RCC_IRQHandler
  231. PUBWEAK EXTI0_IRQHandler
  232. SECTION .text:CODE:REORDER:NOROOT(1)
  233. EXTI0_IRQHandler
  234. B EXTI0_IRQHandler
  235. PUBWEAK EXTI1_IRQHandler
  236. SECTION .text:CODE:REORDER:NOROOT(1)
  237. EXTI1_IRQHandler
  238. B EXTI1_IRQHandler
  239. PUBWEAK EXTI2_IRQHandler
  240. SECTION .text:CODE:REORDER:NOROOT(1)
  241. EXTI2_IRQHandler
  242. B EXTI2_IRQHandler
  243. PUBWEAK EXTI3_IRQHandler
  244. SECTION .text:CODE:REORDER:NOROOT(1)
  245. EXTI3_IRQHandler
  246. B EXTI3_IRQHandler
  247. PUBWEAK EXTI4_IRQHandler
  248. SECTION .text:CODE:REORDER:NOROOT(1)
  249. EXTI4_IRQHandler
  250. B EXTI4_IRQHandler
  251. PUBWEAK DMA1_Stream0_IRQHandler
  252. SECTION .text:CODE:REORDER:NOROOT(1)
  253. DMA1_Stream0_IRQHandler
  254. B DMA1_Stream0_IRQHandler
  255. PUBWEAK DMA1_Stream1_IRQHandler
  256. SECTION .text:CODE:REORDER:NOROOT(1)
  257. DMA1_Stream1_IRQHandler
  258. B DMA1_Stream1_IRQHandler
  259. PUBWEAK DMA1_Stream2_IRQHandler
  260. SECTION .text:CODE:REORDER:NOROOT(1)
  261. DMA1_Stream2_IRQHandler
  262. B DMA1_Stream2_IRQHandler
  263. PUBWEAK DMA1_Stream3_IRQHandler
  264. SECTION .text:CODE:REORDER:NOROOT(1)
  265. DMA1_Stream3_IRQHandler
  266. B DMA1_Stream3_IRQHandler
  267. PUBWEAK DMA1_Stream4_IRQHandler
  268. SECTION .text:CODE:REORDER:NOROOT(1)
  269. DMA1_Stream4_IRQHandler
  270. B DMA1_Stream4_IRQHandler
  271. PUBWEAK DMA1_Stream5_IRQHandler
  272. SECTION .text:CODE:REORDER:NOROOT(1)
  273. DMA1_Stream5_IRQHandler
  274. B DMA1_Stream5_IRQHandler
  275. PUBWEAK DMA1_Stream6_IRQHandler
  276. SECTION .text:CODE:REORDER:NOROOT(1)
  277. DMA1_Stream6_IRQHandler
  278. B DMA1_Stream6_IRQHandler
  279. PUBWEAK ADC_IRQHandler
  280. SECTION .text:CODE:REORDER:NOROOT(1)
  281. ADC_IRQHandler
  282. B ADC_IRQHandler
  283. PUBWEAK EXTI9_5_IRQHandler
  284. SECTION .text:CODE:REORDER:NOROOT(1)
  285. EXTI9_5_IRQHandler
  286. B EXTI9_5_IRQHandler
  287. PUBWEAK TIM1_BRK_TIM9_IRQHandler
  288. SECTION .text:CODE:REORDER:NOROOT(1)
  289. TIM1_BRK_TIM9_IRQHandler
  290. B TIM1_BRK_TIM9_IRQHandler
  291. PUBWEAK TIM1_UP_TIM10_IRQHandler
  292. SECTION .text:CODE:REORDER:NOROOT(1)
  293. TIM1_UP_TIM10_IRQHandler
  294. B TIM1_UP_TIM10_IRQHandler
  295. PUBWEAK TIM1_TRG_COM_TIM11_IRQHandler
  296. SECTION .text:CODE:REORDER:NOROOT(1)
  297. TIM1_TRG_COM_TIM11_IRQHandler
  298. B TIM1_TRG_COM_TIM11_IRQHandler
  299. PUBWEAK TIM1_CC_IRQHandler
  300. SECTION .text:CODE:REORDER:NOROOT(1)
  301. TIM1_CC_IRQHandler
  302. B TIM1_CC_IRQHandler
  303. PUBWEAK TIM2_IRQHandler
  304. SECTION .text:CODE:REORDER:NOROOT(1)
  305. TIM2_IRQHandler
  306. B TIM2_IRQHandler
  307. PUBWEAK TIM3_IRQHandler
  308. SECTION .text:CODE:REORDER:NOROOT(1)
  309. TIM3_IRQHandler
  310. B TIM3_IRQHandler
  311. PUBWEAK TIM4_IRQHandler
  312. SECTION .text:CODE:REORDER:NOROOT(1)
  313. TIM4_IRQHandler
  314. B TIM4_IRQHandler
  315. PUBWEAK I2C1_EV_IRQHandler
  316. SECTION .text:CODE:REORDER:NOROOT(1)
  317. I2C1_EV_IRQHandler
  318. B I2C1_EV_IRQHandler
  319. PUBWEAK I2C1_ER_IRQHandler
  320. SECTION .text:CODE:REORDER:NOROOT(1)
  321. I2C1_ER_IRQHandler
  322. B I2C1_ER_IRQHandler
  323. PUBWEAK I2C2_EV_IRQHandler
  324. SECTION .text:CODE:REORDER:NOROOT(1)
  325. I2C2_EV_IRQHandler
  326. B I2C2_EV_IRQHandler
  327. PUBWEAK I2C2_ER_IRQHandler
  328. SECTION .text:CODE:REORDER:NOROOT(1)
  329. I2C2_ER_IRQHandler
  330. B I2C2_ER_IRQHandler
  331. PUBWEAK SPI1_IRQHandler
  332. SECTION .text:CODE:REORDER:NOROOT(1)
  333. SPI1_IRQHandler
  334. B SPI1_IRQHandler
  335. PUBWEAK SPI2_IRQHandler
  336. SECTION .text:CODE:REORDER:NOROOT(1)
  337. SPI2_IRQHandler
  338. B SPI2_IRQHandler
  339. PUBWEAK USART1_IRQHandler
  340. SECTION .text:CODE:REORDER:NOROOT(1)
  341. USART1_IRQHandler
  342. B USART1_IRQHandler
  343. PUBWEAK USART2_IRQHandler
  344. SECTION .text:CODE:REORDER:NOROOT(1)
  345. USART2_IRQHandler
  346. B USART2_IRQHandler
  347. PUBWEAK EXTI15_10_IRQHandler
  348. SECTION .text:CODE:REORDER:NOROOT(1)
  349. EXTI15_10_IRQHandler
  350. B EXTI15_10_IRQHandler
  351. PUBWEAK RTC_Alarm_IRQHandler
  352. SECTION .text:CODE:REORDER:NOROOT(1)
  353. RTC_Alarm_IRQHandler
  354. B RTC_Alarm_IRQHandler
  355. PUBWEAK OTG_FS_WKUP_IRQHandler
  356. SECTION .text:CODE:REORDER:NOROOT(1)
  357. OTG_FS_WKUP_IRQHandler
  358. B OTG_FS_WKUP_IRQHandler
  359. PUBWEAK DMA1_Stream7_IRQHandler
  360. SECTION .text:CODE:REORDER:NOROOT(1)
  361. DMA1_Stream7_IRQHandler
  362. B DMA1_Stream7_IRQHandler
  363. PUBWEAK SDIO_IRQHandler
  364. SECTION .text:CODE:REORDER:NOROOT(1)
  365. SDIO_IRQHandler
  366. B SDIO_IRQHandler
  367. PUBWEAK TIM5_IRQHandler
  368. SECTION .text:CODE:REORDER:NOROOT(1)
  369. TIM5_IRQHandler
  370. B TIM5_IRQHandler
  371. PUBWEAK SPI3_IRQHandler
  372. SECTION .text:CODE:REORDER:NOROOT(1)
  373. SPI3_IRQHandler
  374. B SPI3_IRQHandler
  375. PUBWEAK DMA2_Stream0_IRQHandler
  376. SECTION .text:CODE:REORDER:NOROOT(1)
  377. DMA2_Stream0_IRQHandler
  378. B DMA2_Stream0_IRQHandler
  379. PUBWEAK DMA2_Stream1_IRQHandler
  380. SECTION .text:CODE:REORDER:NOROOT(1)
  381. DMA2_Stream1_IRQHandler
  382. B DMA2_Stream1_IRQHandler
  383. PUBWEAK DMA2_Stream2_IRQHandler
  384. SECTION .text:CODE:REORDER:NOROOT(1)
  385. DMA2_Stream2_IRQHandler
  386. B DMA2_Stream2_IRQHandler
  387. PUBWEAK DMA2_Stream3_IRQHandler
  388. SECTION .text:CODE:REORDER:NOROOT(1)
  389. DMA2_Stream3_IRQHandler
  390. B DMA2_Stream3_IRQHandler
  391. PUBWEAK DMA2_Stream4_IRQHandler
  392. SECTION .text:CODE:REORDER:NOROOT(1)
  393. DMA2_Stream4_IRQHandler
  394. B DMA2_Stream4_IRQHandler
  395. PUBWEAK OTG_FS_IRQHandler
  396. SECTION .text:CODE:REORDER:NOROOT(1)
  397. OTG_FS_IRQHandler
  398. B OTG_FS_IRQHandler
  399. PUBWEAK DMA2_Stream5_IRQHandler
  400. SECTION .text:CODE:REORDER:NOROOT(1)
  401. DMA2_Stream5_IRQHandler
  402. B DMA2_Stream5_IRQHandler
  403. PUBWEAK DMA2_Stream6_IRQHandler
  404. SECTION .text:CODE:REORDER:NOROOT(1)
  405. DMA2_Stream6_IRQHandler
  406. B DMA2_Stream6_IRQHandler
  407. PUBWEAK DMA2_Stream7_IRQHandler
  408. SECTION .text:CODE:REORDER:NOROOT(1)
  409. DMA2_Stream7_IRQHandler
  410. B DMA2_Stream7_IRQHandler
  411. PUBWEAK USART6_IRQHandler
  412. SECTION .text:CODE:REORDER:NOROOT(1)
  413. USART6_IRQHandler
  414. B USART6_IRQHandler
  415. PUBWEAK I2C3_EV_IRQHandler
  416. SECTION .text:CODE:REORDER:NOROOT(1)
  417. I2C3_EV_IRQHandler
  418. B I2C3_EV_IRQHandler
  419. PUBWEAK I2C3_ER_IRQHandler
  420. SECTION .text:CODE:REORDER:NOROOT(1)
  421. I2C3_ER_IRQHandler
  422. B I2C3_ER_IRQHandler
  423. PUBWEAK FPU_IRQHandler
  424. SECTION .text:CODE:REORDER:NOROOT(1)
  425. FPU_IRQHandler
  426. B FPU_IRQHandler
  427. PUBWEAK SPI4_IRQHandler
  428. SECTION .text:CODE:REORDER:NOROOT(1)
  429. SPI4_IRQHandler
  430. B SPI4_IRQHandler
  431. END
  432. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/