startup_stm32f091.s 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. ;******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
  2. ;* File Name : startup_stm32f091.s
  3. ;* Author : MCD Application Team
  4. ;* Version : V1.5.0
  5. ;* Date : 24-December-2014
  6. ;* Description : STM32F091xc 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. ;* - Branches to main in the C library (which eventually
  13. ;* calls main()).
  14. ;* After Reset the Cortex-M0 processor is in Thread mode,
  15. ;* priority is Privileged, and the Stack is set to Main.
  16. ;*******************************************************************************
  17. ;*
  18. ;* <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
  19. ;*
  20. ;* Redistribution and use in source and binary forms, with or without modification,
  21. ;* are permitted provided that the following conditions are met:
  22. ;* 1. Redistributions of source code must retain the above copyright notice,
  23. ;* this list of conditions and the following disclaimer.
  24. ;* 2. Redistributions in binary form must reproduce the above copyright notice,
  25. ;* this list of conditions and the following disclaimer in the documentation
  26. ;* and/or other materials provided with the distribution.
  27. ;* 3. Neither the name of STMicroelectronics nor the names of its contributors
  28. ;* may be used to endorse or promote products derived from this software
  29. ;* without specific prior written permission.
  30. ;*
  31. ;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  32. ;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  33. ;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  34. ;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  35. ;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. ;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  37. ;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  38. ;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  39. ;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  40. ;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  41. ;*
  42. ;*******************************************************************************
  43. ;
  44. ;
  45. ; The modules in this file are included in the libraries, and may be replaced
  46. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  47. ; a user defined start symbol.
  48. ; To override the cstartup defined in the library, simply add your modified
  49. ; version to the workbench project.
  50. ;
  51. ; The vector table is normally located at address 0.
  52. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  53. ; The name "__vector_table" has special meaning for C-SPY:
  54. ; it is where the SP start value is found, and the NVIC vector
  55. ; table register (VTOR) is initialized to this address if != 0.
  56. ;
  57. ; Cortex-M version
  58. ;
  59. MODULE ?cstartup
  60. ;; Forward declaration of sections.
  61. SECTION CSTACK:DATA:NOROOT(3)
  62. SECTION .intvec:CODE:NOROOT(2)
  63. EXTERN __iar_program_start
  64. EXTERN SystemInit
  65. PUBLIC __vector_table
  66. DATA
  67. __vector_table
  68. DCD sfe(CSTACK)
  69. DCD Reset_Handler ; Reset Handler
  70. DCD NMI_Handler ; NMI Handler
  71. DCD HardFault_Handler ; Hard Fault Handler
  72. DCD 0 ; Reserved
  73. DCD 0 ; Reserved
  74. DCD 0 ; Reserved
  75. DCD 0 ; Reserved
  76. DCD 0 ; Reserved
  77. DCD 0 ; Reserved
  78. DCD 0 ; Reserved
  79. DCD SVC_Handler ; SVCall Handler
  80. DCD 0 ; Reserved
  81. DCD 0 ; Reserved
  82. DCD PendSV_Handler ; PendSV Handler
  83. DCD SysTick_Handler ; SysTick Handler
  84. ; External Interrupts
  85. DCD WWDG_IRQHandler ; Window Watchdog
  86. DCD PVD_VDDIO2_IRQHandler ; PVD and VDDIO2 through EXTI Line detect
  87. DCD RTC_IRQHandler ; RTC through EXTI Line
  88. DCD FLASH_IRQHandler ; FLASH
  89. DCD RCC_CRS_IRQHandler ; RCC and CRS
  90. DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
  91. DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
  92. DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
  93. DCD TSC_IRQHandler ; TS
  94. DCD DMA1_Ch1_IRQHandler ; DMA1 Channel 1
  95. DCD DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler ; DMA1 Channel 2 and 3 & DMA2 Channel 1 and 2
  96. DCD DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler ; DMA1 Channel 4 to 7 & DMA2 Channel 3 to 5
  97. DCD ADC1_COMP_IRQHandler ; ADC1, COMP1 and COMP2
  98. DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
  99. DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  100. DCD TIM2_IRQHandler ; TIM2
  101. DCD TIM3_IRQHandler ; TIM3
  102. DCD TIM6_DAC_IRQHandler ; TIM6 and DAC
  103. DCD TIM7_IRQHandler ; TIM7
  104. DCD TIM14_IRQHandler ; TIM14
  105. DCD TIM15_IRQHandler ; TIM15
  106. DCD TIM16_IRQHandler ; TIM16
  107. DCD TIM17_IRQHandler ; TIM17
  108. DCD I2C1_IRQHandler ; I2C1
  109. DCD I2C2_IRQHandler ; I2C2
  110. DCD SPI1_IRQHandler ; SPI1
  111. DCD SPI2_IRQHandler ; SPI2
  112. DCD USART1_IRQHandler ; USART1
  113. DCD USART2_IRQHandler ; USART2
  114. DCD USART3_8_IRQHandler ; USART3, USART4, USART5, USART6, USART7, USART8
  115. DCD CEC_CAN_IRQHandler ; CEC and CAN
  116. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  117. ;;
  118. ;; Default interrupt handlers.
  119. ;;
  120. THUMB
  121. PUBWEAK Reset_Handler
  122. SECTION .text:CODE:NOROOT:REORDER(2)
  123. Reset_Handler
  124. LDR R0, =sfe(CSTACK) ; set stack pointer
  125. MSR MSP, R0
  126. ;;Check if boot space corresponds to test memory
  127. LDR R0,=0x00000004
  128. LDR R1, [R0]
  129. LSRS R1, R1, #24
  130. LDR R2,=0x1F
  131. CMP R1, R2
  132. BNE ApplicationStart
  133. ;; SYSCFG clock enable
  134. LDR R0,=0x40021018
  135. LDR R1,=0x00000001
  136. STR R1, [R0]
  137. ;; Set CFGR1 register with flash memory remap at address 0
  138. LDR R0,=0x40010000
  139. LDR R1,=0x00000000
  140. STR R1, [R0]
  141. ApplicationStart
  142. LDR R0, =SystemInit
  143. BLX R0
  144. LDR R0, =__iar_program_start
  145. BX R0
  146. PUBWEAK NMI_Handler
  147. SECTION .text:CODE:NOROOT:REORDER(1)
  148. NMI_Handler
  149. B NMI_Handler
  150. PUBWEAK HardFault_Handler
  151. SECTION .text:CODE:NOROOT:REORDER(1)
  152. HardFault_Handler
  153. B HardFault_Handler
  154. PUBWEAK SVC_Handler
  155. SECTION .text:CODE:NOROOT:REORDER(1)
  156. SVC_Handler
  157. B SVC_Handler
  158. PUBWEAK PendSV_Handler
  159. SECTION .text:CODE:NOROOT:REORDER(1)
  160. PendSV_Handler
  161. B PendSV_Handler
  162. PUBWEAK SysTick_Handler
  163. SECTION .text:CODE:NOROOT:REORDER(1)
  164. SysTick_Handler
  165. B SysTick_Handler
  166. PUBWEAK WWDG_IRQHandler
  167. SECTION .text:CODE:NOROOT:REORDER(1)
  168. WWDG_IRQHandler
  169. B WWDG_IRQHandler
  170. PUBWEAK PVD_VDDIO2_IRQHandler
  171. SECTION .text:CODE:NOROOT:REORDER(1)
  172. PVD_VDDIO2_IRQHandler
  173. B PVD_VDDIO2_IRQHandler
  174. PUBWEAK RTC_IRQHandler
  175. SECTION .text:CODE:NOROOT:REORDER(1)
  176. RTC_IRQHandler
  177. B RTC_IRQHandler
  178. PUBWEAK FLASH_IRQHandler
  179. SECTION .text:CODE:NOROOT:REORDER(1)
  180. FLASH_IRQHandler
  181. B FLASH_IRQHandler
  182. PUBWEAK RCC_CRS_IRQHandler
  183. SECTION .text:CODE:NOROOT:REORDER(1)
  184. RCC_CRS_IRQHandler
  185. B RCC_CRS_IRQHandler
  186. PUBWEAK EXTI0_1_IRQHandler
  187. SECTION .text:CODE:NOROOT:REORDER(1)
  188. EXTI0_1_IRQHandler
  189. B EXTI0_1_IRQHandler
  190. PUBWEAK EXTI2_3_IRQHandler
  191. SECTION .text:CODE:NOROOT:REORDER(1)
  192. EXTI2_3_IRQHandler
  193. B EXTI2_3_IRQHandler
  194. PUBWEAK EXTI4_15_IRQHandler
  195. SECTION .text:CODE:NOROOT:REORDER(1)
  196. EXTI4_15_IRQHandler
  197. B EXTI4_15_IRQHandler
  198. PUBWEAK TSC_IRQHandler
  199. SECTION .text:CODE:NOROOT:REORDER(1)
  200. TSC_IRQHandler
  201. B TSC_IRQHandler
  202. PUBWEAK DMA1_Ch1_IRQHandler
  203. SECTION .text:CODE:NOROOT:REORDER(1)
  204. DMA1_Ch1_IRQHandler
  205. B DMA1_Ch1_IRQHandler
  206. PUBWEAK DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler
  207. SECTION .text:CODE:NOROOT:REORDER(1)
  208. DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler
  209. B DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler
  210. PUBWEAK DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler
  211. SECTION .text:CODE:NOROOT:REORDER(1)
  212. DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler
  213. B DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler
  214. PUBWEAK ADC1_COMP_IRQHandler
  215. SECTION .text:CODE:NOROOT:REORDER(1)
  216. ADC1_COMP_IRQHandler
  217. B ADC1_COMP_IRQHandler
  218. PUBWEAK TIM1_BRK_UP_TRG_COM_IRQHandler
  219. SECTION .text:CODE:NOROOT:REORDER(1)
  220. TIM1_BRK_UP_TRG_COM_IRQHandler
  221. B TIM1_BRK_UP_TRG_COM_IRQHandler
  222. PUBWEAK TIM1_CC_IRQHandler
  223. SECTION .text:CODE:NOROOT:REORDER(1)
  224. TIM1_CC_IRQHandler
  225. B TIM1_CC_IRQHandler
  226. PUBWEAK TIM2_IRQHandler
  227. SECTION .text:CODE:NOROOT:REORDER(1)
  228. TIM2_IRQHandler
  229. B TIM2_IRQHandler
  230. PUBWEAK TIM3_IRQHandler
  231. SECTION .text:CODE:NOROOT:REORDER(1)
  232. TIM3_IRQHandler
  233. B TIM3_IRQHandler
  234. PUBWEAK TIM6_DAC_IRQHandler
  235. SECTION .text:CODE:NOROOT:REORDER(1)
  236. TIM6_DAC_IRQHandler
  237. B TIM6_DAC_IRQHandler
  238. PUBWEAK TIM7_IRQHandler
  239. SECTION .text:CODE:NOROOT:REORDER(1)
  240. TIM7_IRQHandler
  241. B TIM7_IRQHandler
  242. PUBWEAK TIM14_IRQHandler
  243. SECTION .text:CODE:NOROOT:REORDER(1)
  244. TIM14_IRQHandler
  245. B TIM14_IRQHandler
  246. PUBWEAK TIM15_IRQHandler
  247. SECTION .text:CODE:NOROOT:REORDER(1)
  248. TIM15_IRQHandler
  249. B TIM15_IRQHandler
  250. PUBWEAK TIM16_IRQHandler
  251. SECTION .text:CODE:NOROOT:REORDER(1)
  252. TIM16_IRQHandler
  253. B TIM16_IRQHandler
  254. PUBWEAK TIM17_IRQHandler
  255. SECTION .text:CODE:NOROOT:REORDER(1)
  256. TIM17_IRQHandler
  257. B TIM17_IRQHandler
  258. PUBWEAK I2C1_IRQHandler
  259. SECTION .text:CODE:NOROOT:REORDER(1)
  260. I2C1_IRQHandler
  261. B I2C1_IRQHandler
  262. PUBWEAK I2C2_IRQHandler
  263. SECTION .text:CODE:NOROOT:REORDER(1)
  264. I2C2_IRQHandler
  265. B I2C2_IRQHandler
  266. PUBWEAK SPI1_IRQHandler
  267. SECTION .text:CODE:NOROOT:REORDER(1)
  268. SPI1_IRQHandler
  269. B SPI1_IRQHandler
  270. PUBWEAK SPI2_IRQHandler
  271. SECTION .text:CODE:NOROOT:REORDER(1)
  272. SPI2_IRQHandler
  273. B SPI2_IRQHandler
  274. PUBWEAK USART1_IRQHandler
  275. SECTION .text:CODE:NOROOT:REORDER(1)
  276. USART1_IRQHandler
  277. B USART1_IRQHandler
  278. PUBWEAK USART2_IRQHandler
  279. SECTION .text:CODE:NOROOT:REORDER(1)
  280. USART2_IRQHandler
  281. B USART2_IRQHandler
  282. PUBWEAK USART3_8_IRQHandler
  283. SECTION .text:CODE:NOROOT:REORDER(1)
  284. USART3_8_IRQHandler
  285. B USART3_8_IRQHandler
  286. PUBWEAK CEC_CAN_IRQHandler
  287. SECTION .text:CODE:NOROOT:REORDER(1)
  288. CEC_CAN_IRQHandler
  289. B CEC_CAN_IRQHandler
  290. END
  291. ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****