startup_stm32f0xx.s 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. /**
  2. ******************************************************************************
  3. * @file startup_stm32f0xx.s
  4. * @author MCD Application Team
  5. * @version V1.0.0
  6. * @date 23-March-2012
  7. * @brief STM32F0xx Devices vector table for RIDE7 toolchain.
  8. * This module performs:
  9. * - Set the initial SP
  10. * - Set the initial PC == Reset_Handler,
  11. * - Set the vector table entries with the exceptions ISR 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. * @attention
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
  20. *
  21. * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  22. * You may not use this file except in compliance with the License.
  23. * You may obtain a copy of the License at:
  24. *
  25. * http://www.st.com/software_license_agreement_liberty_v2
  26. *
  27. * Unless required by applicable law or agreed to in writing, software
  28. * distributed under the License is distributed on an "AS IS" BASIS,
  29. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  30. * See the License for the specific language governing permissions and
  31. * limitations under the License.
  32. *
  33. ******************************************************************************
  34. */
  35. .syntax unified
  36. .cpu cortex-m0
  37. .fpu softvfp
  38. .thumb
  39. .global g_pfnVectors
  40. .global Default_Handler
  41. /* start address for the initialization values of the .data section.
  42. defined in linker script */
  43. .word _sidata
  44. /* start address for the .data section. defined in linker script */
  45. .word _sdata
  46. /* end address for the .data section. defined in linker script */
  47. .word _edata
  48. /* start address for the .bss section. defined in linker script */
  49. .word _sbss
  50. /* end address for the .bss section. defined in linker script */
  51. .word _ebss
  52. .equ BootRAM, 0xF108F85F
  53. /**
  54. * @brief This is the code that gets called when the processor first
  55. * starts execution following a reset event. Only the absolutely
  56. * necessary set is performed, after which the application
  57. * supplied main() routine is called.
  58. * @param None
  59. * @retval : None
  60. */
  61. .section .text.Reset_Handler
  62. .weak Reset_Handler
  63. .type Reset_Handler, %function
  64. Reset_Handler:
  65. /* Copy the data segment initializers from flash to SRAM */
  66. /* movs r1, #0 */
  67. /* b LoopCopyDataInit */
  68. CopyDataInit:
  69. /* ldr r3, =_sidata */
  70. /* ldr r3, [r3, r1] */
  71. /* str r3, [r0, r1] */
  72. /* adds r1, r1, #4 */
  73. LoopCopyDataInit:
  74. /* ldr r0, =_sdata */
  75. /* ldr r3, =_edata */
  76. /* adds r2, r0, r1 */
  77. /* cmp r2, r3 */
  78. /* bcc CopyDataInit */
  79. /* ldr r2, =_sbss */
  80. /* b LoopFillZerobss */
  81. /* Zero fill the bss segment. */
  82. FillZerobss:
  83. /* movs r3, #0 */
  84. /* str r3, [r2] */
  85. /* adds r2, r2, #4 */
  86. LoopFillZerobss:
  87. /* ldr r3, = _ebss */
  88. /* cmp r2, r3 */
  89. /* bcc FillZerobss */
  90. nop
  91. nop
  92. nop
  93. /* Call the clock system intitialization function.*/
  94. bl SystemInit
  95. /* Call the application's entry point.*/
  96. bl main
  97. bx lr
  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 M0. 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. .section .isr_vector,"a",%progbits
  119. .type g_pfnVectors, %object
  120. .size g_pfnVectors, .-g_pfnVectors
  121. g_pfnVectors:
  122. .word _estack
  123. .word Reset_Handler
  124. .word NMI_Handler
  125. .word HardFault_Handler
  126. .word 0
  127. .word 0
  128. .word 0
  129. .word 0
  130. .word 0
  131. .word 0
  132. .word 0
  133. .word SVC_Handler
  134. .word 0
  135. .word 0
  136. .word PendSV_Handler
  137. .word SysTick_Handler
  138. .word WWDG_IRQHandler
  139. .word PVD_IRQHandler
  140. .word RTC_IRQHandler
  141. .word FLASH_IRQHandler
  142. .word RCC_IRQHandler
  143. .word EXTI0_1_IRQHandler
  144. .word EXTI2_3_IRQHandler
  145. .word EXTI4_15_IRQHandler
  146. .word TS_IRQHandler
  147. .word DMA1_Channel1_IRQHandler
  148. .word DMA1_Channel2_3_IRQHandler
  149. .word DMA1_Channel4_5_IRQHandler
  150. .word ADC1_COMP_IRQHandler
  151. .word TIM1_BRK_UP_TRG_COM_IRQHandler
  152. .word TIM1_CC_IRQHandler
  153. .word TIM2_IRQHandler
  154. .word TIM3_IRQHandler
  155. .word TIM6_DAC_IRQHandler
  156. .word 0
  157. .word TIM14_IRQHandler
  158. .word TIM15_IRQHandler
  159. .word TIM16_IRQHandler
  160. .word TIM17_IRQHandler
  161. .word I2C1_IRQHandler
  162. .word I2C2_IRQHandler
  163. .word SPI1_IRQHandler
  164. .word SPI2_IRQHandler
  165. .word USART1_IRQHandler
  166. .word USART2_IRQHandler
  167. .word 0
  168. .word CEC_IRQHandler
  169. .word 0
  170. .word BootRAM /* @0x108. This is for boot in RAM mode for
  171. STM32F0xx devices. */
  172. /*******************************************************************************
  173. *
  174. * Provide weak aliases for each Exception handler to the Default_Handler.
  175. * As they are weak aliases, any function with the same name will override
  176. * this definition.
  177. *
  178. *******************************************************************************/
  179. .weak NMI_Handler
  180. .thumb_set NMI_Handler,Default_Handler
  181. .weak HardFault_Handler
  182. .thumb_set HardFault_Handler,Default_Handler
  183. .weak SVC_Handler
  184. .thumb_set SVC_Handler,Default_Handler
  185. .weak PendSV_Handler
  186. .thumb_set PendSV_Handler,Default_Handler
  187. .weak SysTick_Handler
  188. .thumb_set SysTick_Handler,Default_Handler
  189. .weak WWDG_IRQHandler
  190. .thumb_set WWDG_IRQHandler,Default_Handler
  191. .weak PVD_IRQHandler
  192. .thumb_set PVD_IRQHandler,Default_Handler
  193. .weak RTC_IRQHandler
  194. .thumb_set RTC_IRQHandler,Default_Handler
  195. .weak FLASH_IRQHandler
  196. .thumb_set FLASH_IRQHandler,Default_Handler
  197. .weak RCC_IRQHandler
  198. .thumb_set RCC_IRQHandler,Default_Handler
  199. .weak EXTI0_1_IRQHandler
  200. .thumb_set EXTI0_1_IRQHandler,Default_Handler
  201. .weak EXTI2_3_IRQHandler
  202. .thumb_set EXTI2_3_IRQHandler,Default_Handler
  203. .weak EXTI4_15_IRQHandler
  204. .thumb_set EXTI4_15_IRQHandler,Default_Handler
  205. .weak TS_IRQHandler
  206. .thumb_set TS_IRQHandler,Default_Handler
  207. .weak DMA1_Channel1_IRQHandler
  208. .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
  209. .weak DMA1_Channel2_3_IRQHandler
  210. .thumb_set DMA1_Channel2_3_IRQHandler,Default_Handler
  211. .weak DMA1_Channel4_5_IRQHandler
  212. .thumb_set DMA1_Channel4_5_IRQHandler,Default_Handler
  213. .weak ADC1_COMP_IRQHandler
  214. .thumb_set ADC1_COMP_IRQHandler,Default_Handler
  215. .weak TIM1_BRK_UP_TRG_COM_IRQHandler
  216. .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler
  217. .weak TIM1_CC_IRQHandler
  218. .thumb_set TIM1_CC_IRQHandler,Default_Handler
  219. .weak TIM2_IRQHandler
  220. .thumb_set TIM2_IRQHandler,Default_Handler
  221. .weak TIM3_IRQHandler
  222. .thumb_set TIM3_IRQHandler,Default_Handler
  223. .weak TIM6_DAC_IRQHandler
  224. .thumb_set TIM6_DAC_IRQHandler,Default_Handler
  225. .weak TIM14_IRQHandler
  226. .thumb_set TIM14_IRQHandler,Default_Handler
  227. .weak TIM15_IRQHandler
  228. .thumb_set TIM15_IRQHandler,Default_Handler
  229. .weak TIM16_IRQHandler
  230. .thumb_set TIM16_IRQHandler,Default_Handler
  231. .weak TIM17_IRQHandler
  232. .thumb_set TIM17_IRQHandler,Default_Handler
  233. .weak I2C1_IRQHandler
  234. .thumb_set I2C1_IRQHandler,Default_Handler
  235. .weak I2C2_IRQHandler
  236. .thumb_set I2C2_IRQHandler,Default_Handler
  237. .weak SPI1_IRQHandler
  238. .thumb_set SPI1_IRQHandler,Default_Handler
  239. .weak SPI2_IRQHandler
  240. .thumb_set SPI2_IRQHandler,Default_Handler
  241. .weak USART1_IRQHandler
  242. .thumb_set USART1_IRQHandler,Default_Handler
  243. .weak USART2_IRQHandler
  244. .thumb_set USART2_IRQHandler,Default_Handler
  245. .weak CEC_IRQHandler
  246. .thumb_set CEC_IRQHandler,Default_Handler
  247. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/