startup_stm32g030xx.s 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. ;******************************************************************************
  2. ;* File Name : startup_stm32g030xx.s
  3. ;* Author : MCD Application Team
  4. ;* Description : STM32G030xx devices vector table for MDK-ARM toolchain.
  5. ;* This module performs:
  6. ;* - Set the initial SP
  7. ;* - Set the initial PC == Reset_Handler
  8. ;* - Set the vector table entries with the exceptions ISR address
  9. ;* - Branches to __main in the C library (which eventually
  10. ;* calls main()).
  11. ;* After Reset the CortexM0 processor is in Thread mode,
  12. ;* priority is Privileged, and the Stack is set to Main.
  13. ;* <<< Use Configuration Wizard in Context Menu >>>
  14. ;******************************************************************************
  15. ;* @attention
  16. ;*
  17. ;* Copyright (c) 2019 STMicroelectronics. All rights reserved.
  18. ;*
  19. ;* This software component is licensed by ST under Apache License, Version 2.0,
  20. ;* the "License"; You may not use this file except in compliance with the
  21. ;* License. You may obtain a copy of the License at:
  22. ;* opensource.org/licenses/Apache-2.0
  23. ;*
  24. ;******************************************************************************
  25. ; Amount of memory (in bytes) allocated for Stack
  26. ; Tailor this value to your application needs
  27. ; <h> Stack Configuration
  28. ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  29. ; </h>
  30. Stack_Size EQU 0x400
  31. AREA STACK, NOINIT, READWRITE, ALIGN=3
  32. Stack_Mem SPACE Stack_Size
  33. __initial_sp
  34. ; <h> Heap Configuration
  35. ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  36. ; </h>
  37. Heap_Size EQU 0x200
  38. AREA HEAP, NOINIT, READWRITE, ALIGN=3
  39. __heap_base
  40. Heap_Mem SPACE Heap_Size
  41. __heap_limit
  42. PRESERVE8
  43. THUMB
  44. ; Vector Table Mapped to Address 0 at Reset
  45. AREA RESET, DATA, READONLY
  46. EXPORT __Vectors
  47. EXPORT __Vectors_End
  48. EXPORT __Vectors_Size
  49. __Vectors DCD __initial_sp ; Top of Stack
  50. DCD Reset_Handler ; Reset Handler
  51. DCD NMI_Handler ; NMI Handler
  52. DCD HardFault_Handler ; Hard Fault Handler
  53. DCD 0 ; Reserved
  54. DCD 0 ; Reserved
  55. DCD 0 ; Reserved
  56. DCD 0 ; Reserved
  57. DCD 0 ; Reserved
  58. DCD 0 ; Reserved
  59. DCD 0 ; Reserved
  60. DCD SVC_Handler ; SVCall Handler
  61. DCD 0 ; Reserved
  62. DCD 0 ; Reserved
  63. DCD PendSV_Handler ; PendSV Handler
  64. DCD SysTick_Handler ; SysTick Handler
  65. ; External Interrupts
  66. DCD WWDG_IRQHandler ; Window Watchdog
  67. DCD 0 ; Reserved
  68. DCD RTC_TAMP_IRQHandler ; RTC through EXTI Line
  69. DCD FLASH_IRQHandler ; FLASH
  70. DCD RCC_IRQHandler ; RCC
  71. DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
  72. DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
  73. DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
  74. DCD 0 ; Reserved
  75. DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
  76. DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
  77. DCD DMA1_Ch4_5_DMAMUX1_OVR_IRQHandler ; DMA1 Channel 4 to Channel 5, DMAMUX1 overrun
  78. DCD ADC1_IRQHandler ; ADC1
  79. DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation
  80. DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare
  81. DCD 0 ; Reserved
  82. DCD TIM3_IRQHandler ; TIM3
  83. DCD 0 ; Reserved
  84. DCD 0 ; Reserved
  85. DCD TIM14_IRQHandler ; TIM14
  86. DCD 0 ; Reserved
  87. DCD TIM16_IRQHandler ; TIM16
  88. DCD TIM17_IRQHandler ; TIM17
  89. DCD I2C1_IRQHandler ; I2C1
  90. DCD I2C2_IRQHandler ; I2C2
  91. DCD SPI1_IRQHandler ; SPI1
  92. DCD SPI2_IRQHandler ; SPI2
  93. DCD USART1_IRQHandler ; USART1
  94. DCD USART2_IRQHandler ; USART2
  95. DCD 0 ; Reserved
  96. DCD 0 ; Reserved
  97. DCD 0 ; Reserved
  98. __Vectors_End
  99. __Vectors_Size EQU __Vectors_End - __Vectors
  100. AREA |.text|, CODE, READONLY
  101. ; Reset handler routine
  102. Reset_Handler PROC
  103. EXPORT Reset_Handler [WEAK]
  104. IMPORT __main
  105. IMPORT SystemInit
  106. LDR R0, =SystemInit
  107. BLX R0
  108. LDR R0, =__main
  109. BX R0
  110. ENDP
  111. ; Dummy Exception Handlers (infinite loops which can be modified)
  112. NMI_Handler PROC
  113. EXPORT NMI_Handler [WEAK]
  114. B .
  115. ENDP
  116. HardFault_Handler\
  117. PROC
  118. EXPORT HardFault_Handler [WEAK]
  119. B .
  120. ENDP
  121. SVC_Handler PROC
  122. EXPORT SVC_Handler [WEAK]
  123. B .
  124. ENDP
  125. PendSV_Handler PROC
  126. EXPORT PendSV_Handler [WEAK]
  127. B .
  128. ENDP
  129. SysTick_Handler PROC
  130. EXPORT SysTick_Handler [WEAK]
  131. B .
  132. ENDP
  133. Default_Handler PROC
  134. EXPORT WWDG_IRQHandler [WEAK]
  135. EXPORT RTC_TAMP_IRQHandler [WEAK]
  136. EXPORT FLASH_IRQHandler [WEAK]
  137. EXPORT RCC_IRQHandler [WEAK]
  138. EXPORT EXTI0_1_IRQHandler [WEAK]
  139. EXPORT EXTI2_3_IRQHandler [WEAK]
  140. EXPORT EXTI4_15_IRQHandler [WEAK]
  141. EXPORT DMA1_Channel1_IRQHandler [WEAK]
  142. EXPORT DMA1_Channel2_3_IRQHandler [WEAK]
  143. EXPORT DMA1_Ch4_5_DMAMUX1_OVR_IRQHandler [WEAK]
  144. EXPORT ADC1_IRQHandler [WEAK]
  145. EXPORT TIM1_BRK_UP_TRG_COM_IRQHandler [WEAK]
  146. EXPORT TIM1_CC_IRQHandler [WEAK]
  147. EXPORT TIM3_IRQHandler [WEAK]
  148. EXPORT TIM14_IRQHandler [WEAK]
  149. EXPORT TIM16_IRQHandler [WEAK]
  150. EXPORT TIM17_IRQHandler [WEAK]
  151. EXPORT I2C1_IRQHandler [WEAK]
  152. EXPORT I2C2_IRQHandler [WEAK]
  153. EXPORT SPI1_IRQHandler [WEAK]
  154. EXPORT SPI2_IRQHandler [WEAK]
  155. EXPORT USART1_IRQHandler [WEAK]
  156. EXPORT USART2_IRQHandler [WEAK]
  157. WWDG_IRQHandler
  158. RTC_TAMP_IRQHandler
  159. FLASH_IRQHandler
  160. RCC_IRQHandler
  161. EXTI0_1_IRQHandler
  162. EXTI2_3_IRQHandler
  163. EXTI4_15_IRQHandler
  164. DMA1_Channel1_IRQHandler
  165. DMA1_Channel2_3_IRQHandler
  166. DMA1_Ch4_5_DMAMUX1_OVR_IRQHandler
  167. ADC1_IRQHandler
  168. TIM1_BRK_UP_TRG_COM_IRQHandler
  169. TIM1_CC_IRQHandler
  170. TIM3_IRQHandler
  171. TIM14_IRQHandler
  172. TIM16_IRQHandler
  173. TIM17_IRQHandler
  174. I2C1_IRQHandler
  175. I2C2_IRQHandler
  176. SPI1_IRQHandler
  177. SPI2_IRQHandler
  178. USART1_IRQHandler
  179. USART2_IRQHandler
  180. B .
  181. ENDP
  182. ALIGN
  183. ;*******************************************************************************
  184. ; User Stack and Heap initialization
  185. ;*******************************************************************************
  186. IF :DEF:__MICROLIB
  187. EXPORT __initial_sp
  188. EXPORT __heap_base
  189. EXPORT __heap_limit
  190. ELSE
  191. IMPORT __use_two_region_memory
  192. EXPORT __user_initial_stackheap
  193. __user_initial_stackheap
  194. LDR R0, = Heap_Mem
  195. LDR R1, =(Stack_Mem + Stack_Size)
  196. LDR R2, = (Heap_Mem + Heap_Size)
  197. LDR R3, = Stack_Mem
  198. BX LR
  199. ALIGN
  200. ENDIF
  201. END
  202. ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****