You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

293 lines
10 KiB

  1. ;/******************** (C) COPYRIGHT 2018 STMicroelectronics ********************
  2. ;* File Name : startup_stm32l010xb.s
  3. ;* Author : MCD Application Team
  4. ;* Description : STM32L010xB Ultra Low Power Devices vector
  5. ;* This module performs:
  6. ;* - Set the initial SP
  7. ;* - Set the initial PC == _iar_program_start,
  8. ;* - Set the vector table entries with the exceptions ISR
  9. ;* address.
  10. ;* - Configure the system clock
  11. ;* - Branches to main in the C library (which eventually
  12. ;* calls main()).
  13. ;* After Reset the Cortex-M0+ processor is in Thread mode,
  14. ;* priority is Privileged, and the Stack is set to Main.
  15. ;********************************************************************************
  16. ;*
  17. ;* Redistribution and use in source and binary forms, with or without modification,
  18. ;* are permitted provided that the following conditions are met:
  19. ;* 1. Redistributions of source code must retain the above copyright notice,
  20. ;* this list of conditions and the following disclaimer.
  21. ;* 2. Redistributions in binary form must reproduce the above copyright notice,
  22. ;* this list of conditions and the following disclaimer in the documentation
  23. ;* and/or other materials provided with the distribution.
  24. ;* 3. Neither the name of STMicroelectronics nor the names of its contributors
  25. ;* may be used to endorse or promote products derived from this software
  26. ;* without specific prior written permission.
  27. ;*
  28. ;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  29. ;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. ;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. ;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  32. ;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. ;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  34. ;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  35. ;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  36. ;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  37. ;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. ;*
  39. ;*******************************************************************************/
  40. ;
  41. ;
  42. ; The modules in this file are included in the libraries, and may be replaced
  43. ; by any user-defined modules that define the PUBLIC symbol _program_start or
  44. ; a user defined start symbol.
  45. ; To override the cstartup defined in the library, simply add your modified
  46. ; version to the workbench project.
  47. ;
  48. ; The vector table is normally located at address 0.
  49. ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
  50. ; The name "__vector_table" has special meaning for C-SPY:
  51. ; it is where the SP start value is found, and the NVIC vector
  52. ; table register (VTOR) is initialized to this address if != 0.
  53. ;
  54. ; Cortex-M version
  55. ;
  56. MODULE ?cstartup
  57. ;; Forward declaration of sections.
  58. SECTION CSTACK:DATA:NOROOT(3)
  59. SECTION .intvec:CODE:NOROOT(2)
  60. EXTERN __iar_program_start
  61. EXTERN SystemInit
  62. PUBLIC __vector_table
  63. DATA
  64. __vector_table
  65. DCD sfe(CSTACK)
  66. DCD Reset_Handler ; Reset Handler
  67. DCD NMI_Handler ; NMI Handler
  68. DCD HardFault_Handler ; Hard Fault Handler
  69. DCD 0 ; Reserved
  70. DCD 0 ; Reserved
  71. DCD 0 ; Reserved
  72. DCD 0 ; Reserved
  73. DCD 0 ; Reserved
  74. DCD 0 ; Reserved
  75. DCD 0 ; Reserved
  76. DCD SVC_Handler ; SVCall Handler
  77. DCD 0 ; Reserved
  78. DCD 0 ; Reserved
  79. DCD PendSV_Handler ; PendSV Handler
  80. DCD SysTick_Handler ; SysTick Handler
  81. ; External Interrupts
  82. DCD WWDG_IRQHandler ; Window Watchdog
  83. DCD 0 ; Reserved
  84. DCD RTC_IRQHandler ; RTC through EXTI Line
  85. DCD FLASH_IRQHandler ; FLASH
  86. DCD RCC_IRQHandler ; RCC
  87. DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
  88. DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
  89. DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
  90. DCD 0 ; Reserved
  91. DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
  92. DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
  93. DCD DMA1_Channel4_5_6_7_IRQHandler ; DMA1 Channel 4, Channel 5, Channel 6 and Channel 7
  94. DCD ADC1_IRQHandler ; ADC1
  95. DCD LPTIM1_IRQHandler ; LPTIM1
  96. DCD 0 ; Reserved
  97. DCD TIM2_IRQHandler ; TIM2
  98. DCD 0 ; Reserved
  99. DCD 0 ; Reserved
  100. DCD 0 ; Reserved
  101. DCD 0 ; Reserved
  102. DCD TIM21_IRQHandler ; TIM21
  103. DCD 0 ; Reserved
  104. DCD 0 ; Reserved
  105. DCD I2C1_IRQHandler ; I2C1
  106. DCD 0 ; Reserved
  107. DCD SPI1_IRQHandler ; SPI1
  108. DCD 0 ; Reserved
  109. DCD 0 ; Reserved
  110. DCD USART2_IRQHandler ; USART2
  111. DCD LPUART1_IRQHandler ; LPUART1
  112. DCD 0 ; Reserved
  113. DCD 0 ; Reserved
  114. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115. ;;
  116. ;; Default interrupt handlers.
  117. ;;
  118. THUMB
  119. PUBWEAK Reset_Handler
  120. SECTION .text:CODE:NOROOT:REORDER(2)
  121. Reset_Handler
  122. LDR R0, =sfe(CSTACK) ; set stack pointer
  123. MSR MSP, R0
  124. ;;Check if boot space corresponds to system memory
  125. LDR R0,=0x00000004
  126. LDR R1, [R0]
  127. LSRS R1, R1, #24
  128. LDR R2,=0x1F
  129. CMP R1, R2
  130. BNE ApplicationStart
  131. ;; SYSCFG clock enable
  132. LDR R0,=0x40021034
  133. LDR R1,=0x00000001
  134. STR R1, [R0]
  135. ;; Set CFGR1 register with flash memory remap at address 0
  136. LDR R0,=0x40010000
  137. LDR R1,=0x00000000
  138. STR R1, [R0]
  139. ApplicationStart
  140. LDR R0, =SystemInit
  141. BLX R0
  142. LDR R0, =__iar_program_start
  143. BX R0
  144. PUBWEAK NMI_Handler
  145. SECTION .text:CODE:NOROOT:REORDER(1)
  146. NMI_Handler
  147. B NMI_Handler
  148. PUBWEAK HardFault_Handler
  149. SECTION .text:CODE:NOROOT:REORDER(1)
  150. HardFault_Handler
  151. B HardFault_Handler
  152. PUBWEAK SVC_Handler
  153. SECTION .text:CODE:NOROOT:REORDER(1)
  154. SVC_Handler
  155. B SVC_Handler
  156. PUBWEAK PendSV_Handler
  157. SECTION .text:CODE:NOROOT:REORDER(1)
  158. PendSV_Handler
  159. B PendSV_Handler
  160. PUBWEAK SysTick_Handler
  161. SECTION .text:CODE:NOROOT:REORDER(1)
  162. SysTick_Handler
  163. B SysTick_Handler
  164. PUBWEAK WWDG_IRQHandler
  165. SECTION .text:CODE:NOROOT:REORDER(1)
  166. WWDG_IRQHandler
  167. B WWDG_IRQHandler
  168. PUBWEAK RTC_IRQHandler
  169. SECTION .text:CODE:NOROOT:REORDER(1)
  170. RTC_IRQHandler
  171. B RTC_IRQHandler
  172. PUBWEAK FLASH_IRQHandler
  173. SECTION .text:CODE:NOROOT:REORDER(1)
  174. FLASH_IRQHandler
  175. B FLASH_IRQHandler
  176. PUBWEAK RCC_IRQHandler
  177. SECTION .text:CODE:NOROOT:REORDER(1)
  178. RCC_IRQHandler
  179. B RCC_IRQHandler
  180. PUBWEAK EXTI0_1_IRQHandler
  181. SECTION .text:CODE:NOROOT:REORDER(1)
  182. EXTI0_1_IRQHandler
  183. B EXTI0_1_IRQHandler
  184. PUBWEAK EXTI2_3_IRQHandler
  185. SECTION .text:CODE:NOROOT:REORDER(1)
  186. EXTI2_3_IRQHandler
  187. B EXTI2_3_IRQHandler
  188. PUBWEAK EXTI4_15_IRQHandler
  189. SECTION .text:CODE:NOROOT:REORDER(1)
  190. EXTI4_15_IRQHandler
  191. B EXTI4_15_IRQHandler
  192. PUBWEAK DMA1_Channel1_IRQHandler
  193. SECTION .text:CODE:NOROOT:REORDER(1)
  194. DMA1_Channel1_IRQHandler
  195. B DMA1_Channel1_IRQHandler
  196. PUBWEAK DMA1_Channel2_3_IRQHandler
  197. SECTION .text:CODE:NOROOT:REORDER(1)
  198. DMA1_Channel2_3_IRQHandler
  199. B DMA1_Channel2_3_IRQHandler
  200. PUBWEAK DMA1_Channel4_5_6_7_IRQHandler
  201. SECTION .text:CODE:NOROOT:REORDER(1)
  202. DMA1_Channel4_5_6_7_IRQHandler
  203. B DMA1_Channel4_5_6_7_IRQHandler
  204. PUBWEAK ADC1_IRQHandler
  205. SECTION .text:CODE:NOROOT:REORDER(1)
  206. ADC1_IRQHandler
  207. B ADC1_IRQHandler
  208. PUBWEAK LPTIM1_IRQHandler
  209. SECTION .text:CODE:NOROOT:REORDER(1)
  210. LPTIM1_IRQHandler
  211. B LPTIM1_IRQHandler
  212. PUBWEAK TIM2_IRQHandler
  213. SECTION .text:CODE:NOROOT:REORDER(1)
  214. TIM2_IRQHandler
  215. B TIM2_IRQHandler
  216. PUBWEAK TIM21_IRQHandler
  217. SECTION .text:CODE:NOROOT:REORDER(1)
  218. TIM21_IRQHandler
  219. B TIM21_IRQHandler
  220. PUBWEAK I2C1_IRQHandler
  221. SECTION .text:CODE:NOROOT:REORDER(1)
  222. I2C1_IRQHandler
  223. B I2C1_IRQHandler
  224. PUBWEAK SPI1_IRQHandler
  225. SECTION .text:CODE:NOROOT:REORDER(1)
  226. SPI1_IRQHandler
  227. B SPI1_IRQHandler
  228. PUBWEAK USART2_IRQHandler
  229. SECTION .text:CODE:NOROOT:REORDER(1)
  230. USART2_IRQHandler
  231. B USART2_IRQHandler
  232. PUBWEAK LPUART1_IRQHandler
  233. SECTION .text:CODE:NOROOT:REORDER(1)
  234. LPUART1_IRQHandler
  235. B LPUART1_IRQHandler
  236. END
  237. ;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****