startup_stm32f051.s 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. ;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
  2. ;* File Name : startup_stm32f051.s
  3. ;* Author : MCD Application Team
  4. ;* Version : V1.5.0
  5. ;* Date : 24-December-2014
  6. ;* Description : STM32F051 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-M0 processor is in Thread mode,
  16. ;* priority is Privileged, and the Stack is set to Main.
  17. ;*******************************************************************************
  18. ; @attention
  19. ;
  20. ; Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  21. ; You may not use this file except in compliance with the License.
  22. ; You may obtain a copy of the License at:
  23. ;
  24. ; http://www.st.com/software_license_agreement_liberty_v2
  25. ;
  26. ; Unless required by applicable law or agreed to in writing, software
  27. ; distributed under the License is distributed on an "AS IS" BASIS,
  28. ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  29. ; See the License for the specific language governing permissions and
  30. ; limitations under the License.
  31. ;
  32. ;*******************************************************************************
  33. ;
  34. ;
  35. ; The modules in this file are included in the libraries, and may be replaced
  36. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  37. ; a user defined start symbol.
  38. ; To override the cstartup defined in the library, simply add your modified
  39. ; version to the workbench project.
  40. ;
  41. ; The vector table is normally located at address 0.
  42. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  43. ; The name "__vector_table" has special meaning for C-SPY:
  44. ; it is where the SP start value is found, and the NVIC vector
  45. ; table register (VTOR) is initialized to this address if != 0.
  46. ;
  47. ; Cortex-M version
  48. ;
  49. MODULE ?cstartup
  50. ;; Forward declaration of sections.
  51. SECTION CSTACK:DATA:NOROOT(3)
  52. SECTION .intvec:CODE:NOROOT(2)
  53. EXTERN __iar_program_start
  54. EXTERN SystemInit
  55. PUBLIC __vector_table
  56. DATA
  57. __vector_table
  58. DCD sfe(CSTACK)
  59. DCD Reset_Handler ; Reset Handler
  60. DCD NMI_Handler ; NMI Handler
  61. DCD HardFault_Handler ; Hard Fault Handler
  62. DCD 0 ; Reserved
  63. DCD 0 ; Reserved
  64. DCD 0 ; Reserved
  65. DCD 0 ; Reserved
  66. DCD 0 ; Reserved
  67. DCD 0 ; Reserved
  68. DCD 0 ; Reserved
  69. DCD SVC_Handler ; SVCall Handler
  70. DCD 0 ; Reserved
  71. DCD 0 ; Reserved
  72. DCD PendSV_Handler ; PendSV Handler
  73. DCD SysTick_Handler ; SysTick Handler
  74. ; External Interrupts
  75. DCD WWDG_IRQHandler ; Window Watchdog
  76. DCD PVD_IRQHandler ; PVD through EXTI Line detect
  77. DCD RTC_IRQHandler ; RTC through EXTI Line
  78. DCD FLASH_IRQHandler ; FLASH
  79. DCD RCC_IRQHandler ; RCC
  80. DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
  81. DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
  82. DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
  83. DCD TS_IRQHandler ; TS
  84. DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
  85. DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
  86. DCD DMA1_Channel4_5_IRQHandler ; DMA1 Channel 4 and Channel 5
  87. DCD ADC1_COMP_IRQHandler ; ADC1, COMP1 and COMP2
  88. DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
  89. DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  90. DCD TIM2_IRQHandler ; TIM2
  91. DCD TIM3_IRQHandler ; TIM3
  92. DCD TIM6_DAC_IRQHandler ; TIM6 and DAC
  93. DCD 0 ; Reserved
  94. DCD TIM14_IRQHandler ; TIM14
  95. DCD TIM15_IRQHandler ; TIM15
  96. DCD TIM16_IRQHandler ; TIM16
  97. DCD TIM17_IRQHandler ; TIM17
  98. DCD I2C1_IRQHandler ; I2C1
  99. DCD I2C2_IRQHandler ; I2C2
  100. DCD SPI1_IRQHandler ; SPI1
  101. DCD SPI2_IRQHandler ; SPI2
  102. DCD USART1_IRQHandler ; USART1
  103. DCD USART2_IRQHandler ; USART2
  104. DCD 0 ; Reserved
  105. DCD CEC_IRQHandler ; CEC
  106. DCD 0 ; Reserved
  107. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  108. ;;
  109. ;; Default interrupt handlers.
  110. ;;
  111. THUMB
  112. PUBWEAK Reset_Handler
  113. SECTION .text:CODE:NOROOT:REORDER(2)
  114. Reset_Handler
  115. LDR R0, =sfe(CSTACK) ; set stack pointer
  116. MSR MSP, R0
  117. ;;Check if boot space corresponds to test memory
  118. LDR R0,=0x00000004
  119. LDR R1, [R0]
  120. LSRS R1, R1, #24
  121. LDR R2,=0x1F
  122. CMP R1, R2
  123. BNE ApplicationStart
  124. ;; SYSCFG clock enable
  125. LDR R0,=0x40021018
  126. LDR R1,=0x00000001
  127. STR R1, [R0]
  128. ;; Set CFGR1 register with flash memory remap at address 0
  129. LDR R0,=0x40010000
  130. LDR R1,=0x00000000
  131. STR R1, [R0]
  132. ApplicationStart
  133. LDR R0, =SystemInit
  134. BLX R0
  135. LDR R0, =__iar_program_start
  136. BX R0
  137. PUBWEAK NMI_Handler
  138. SECTION .text:CODE:NOROOT:REORDER(1)
  139. NMI_Handler
  140. B NMI_Handler
  141. PUBWEAK HardFault_Handler
  142. SECTION .text:CODE:NOROOT:REORDER(1)
  143. HardFault_Handler
  144. B HardFault_Handler
  145. PUBWEAK SVC_Handler
  146. SECTION .text:CODE:NOROOT:REORDER(1)
  147. SVC_Handler
  148. B SVC_Handler
  149. PUBWEAK PendSV_Handler
  150. SECTION .text:CODE:NOROOT:REORDER(1)
  151. PendSV_Handler
  152. B PendSV_Handler
  153. PUBWEAK SysTick_Handler
  154. SECTION .text:CODE:NOROOT:REORDER(1)
  155. SysTick_Handler
  156. B SysTick_Handler
  157. PUBWEAK WWDG_IRQHandler
  158. SECTION .text:CODE:NOROOT:REORDER(1)
  159. WWDG_IRQHandler
  160. B WWDG_IRQHandler
  161. PUBWEAK PVD_IRQHandler
  162. SECTION .text:CODE:NOROOT:REORDER(1)
  163. PVD_IRQHandler
  164. B PVD_IRQHandler
  165. PUBWEAK RTC_IRQHandler
  166. SECTION .text:CODE:NOROOT:REORDER(1)
  167. RTC_IRQHandler
  168. B RTC_IRQHandler
  169. PUBWEAK FLASH_IRQHandler
  170. SECTION .text:CODE:NOROOT:REORDER(1)
  171. FLASH_IRQHandler
  172. B FLASH_IRQHandler
  173. PUBWEAK RCC_IRQHandler
  174. SECTION .text:CODE:NOROOT:REORDER(1)
  175. RCC_IRQHandler
  176. B RCC_IRQHandler
  177. PUBWEAK EXTI0_1_IRQHandler
  178. SECTION .text:CODE:NOROOT:REORDER(1)
  179. EXTI0_1_IRQHandler
  180. B EXTI0_1_IRQHandler
  181. PUBWEAK EXTI2_3_IRQHandler
  182. SECTION .text:CODE:NOROOT:REORDER(1)
  183. EXTI2_3_IRQHandler
  184. B EXTI2_3_IRQHandler
  185. PUBWEAK EXTI4_15_IRQHandler
  186. SECTION .text:CODE:NOROOT:REORDER(1)
  187. EXTI4_15_IRQHandler
  188. B EXTI4_15_IRQHandler
  189. PUBWEAK TS_IRQHandler
  190. SECTION .text:CODE:NOROOT:REORDER(1)
  191. TS_IRQHandler
  192. B TS_IRQHandler
  193. PUBWEAK DMA1_Channel1_IRQHandler
  194. SECTION .text:CODE:NOROOT:REORDER(1)
  195. DMA1_Channel1_IRQHandler
  196. B DMA1_Channel1_IRQHandler
  197. PUBWEAK DMA1_Channel2_3_IRQHandler
  198. SECTION .text:CODE:NOROOT:REORDER(1)
  199. DMA1_Channel2_3_IRQHandler
  200. B DMA1_Channel2_3_IRQHandler
  201. PUBWEAK DMA1_Channel4_5_IRQHandler
  202. SECTION .text:CODE:NOROOT:REORDER(1)
  203. DMA1_Channel4_5_IRQHandler
  204. B DMA1_Channel4_5_IRQHandler
  205. PUBWEAK ADC1_COMP_IRQHandler
  206. SECTION .text:CODE:NOROOT:REORDER(1)
  207. ADC1_COMP_IRQHandler
  208. B ADC1_COMP_IRQHandler
  209. PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler
  210. SECTION .text:CODE:NOROOT:REORDER(1)
  211. TIM1_BRK_UP_TRG_COM_IRQHandler
  212. B TIM1_BRK_UP_TRG_COM_IRQHandler
  213. PUBWEAK TIM1_CC_IRQHandler
  214. SECTION .text:CODE:NOROOT:REORDER(1)
  215. TIM1_CC_IRQHandler
  216. B TIM1_CC_IRQHandler
  217. PUBWEAK TIM2_IRQHandler
  218. SECTION .text:CODE:NOROOT:REORDER(1)
  219. TIM2_IRQHandler
  220. B TIM2_IRQHandler
  221. PUBWEAK TIM3_IRQHandler
  222. SECTION .text:CODE:NOROOT:REORDER(1)
  223. TIM3_IRQHandler
  224. B TIM3_IRQHandler
  225. PUBWEAK TIM6_DAC_IRQHandler
  226. SECTION .text:CODE:NOROOT:REORDER(1)
  227. TIM6_DAC_IRQHandler
  228. B TIM6_DAC_IRQHandler
  229. PUBWEAK TIM14_IRQHandler
  230. SECTION .text:CODE:NOROOT:REORDER(1)
  231. TIM14_IRQHandler
  232. B TIM14_IRQHandler
  233. PUBWEAK TIM15_IRQHandler
  234. SECTION .text:CODE:NOROOT:REORDER(1)
  235. TIM15_IRQHandler
  236. B TIM15_IRQHandler
  237. PUBWEAK TIM16_IRQHandler
  238. SECTION .text:CODE:NOROOT:REORDER(1)
  239. TIM16_IRQHandler
  240. B TIM16_IRQHandler
  241. PUBWEAK TIM17_IRQHandler
  242. SECTION .text:CODE:NOROOT:REORDER(1)
  243. TIM17_IRQHandler
  244. B TIM17_IRQHandler
  245. PUBWEAK I2C1_IRQHandler
  246. SECTION .text:CODE:NOROOT:REORDER(1)
  247. I2C1_IRQHandler
  248. B I2C1_IRQHandler
  249. PUBWEAK I2C2_IRQHandler
  250. SECTION .text:CODE:NOROOT:REORDER(1)
  251. I2C2_IRQHandler
  252. B I2C2_IRQHandler
  253. PUBWEAK SPI1_IRQHandler
  254. SECTION .text:CODE:NOROOT:REORDER(1)
  255. SPI1_IRQHandler
  256. B SPI1_IRQHandler
  257. PUBWEAK SPI2_IRQHandler
  258. SECTION .text:CODE:NOROOT:REORDER(1)
  259. SPI2_IRQHandler
  260. B SPI2_IRQHandler
  261. PUBWEAK USART1_IRQHandler
  262. SECTION .text:CODE:NOROOT:REORDER(1)
  263. USART1_IRQHandler
  264. B USART1_IRQHandler
  265. PUBWEAK USART2_IRQHandler
  266. SECTION .text:CODE:NOROOT:REORDER(1)
  267. USART2_IRQHandler
  268. B USART2_IRQHandler
  269. PUBWEAK CEC_IRQHandler
  270. SECTION .text:CODE:NOROOT:REORDER(1)
  271. CEC_IRQHandler
  272. B CEC_IRQHandler
  273. END
  274. ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****