1/** 2 ****************************************************************************** 3 * @file startup_stm32l151xb.s 4 * @author MCD Application Team 5 * @brief STM32L151XB Devices vector table for GCC toolchain. 6 * This module performs: 7 * - Set the initial SP 8 * - Set the initial PC == Reset_Handler, 9 * - Set the vector table entries with the exceptions ISR address 10 * - Configure the clock system 11 * - Branches to main in the C library (which eventually 12 * calls main()). 13 * After Reset the Cortex-M3 processor is in Thread mode, 14 * priority is Privileged, and the Stack is set to Main. 15 ****************************************************************************** 16 * 17 * @attention 18 * 19 * Copyright (c) 2017 STMicroelectronics. All rights reserved. 20 * 21 * This software component is licensed by ST under BSD 3-Clause license, 22 * the "License"; You may not use this file except in compliance with the 23 * License. You may obtain a copy of the License at: 24 * opensource.org/licenses/BSD-3-Clause 25 * 26 ****************************************************************************** 27 */ 28 29 .syntax unified 30 .cpu cortex-m3 31 .fpu softvfp 32 .thumb 33 34.global g_pfnVectors 35.global Default_Handler 36 37/* start address for the initialization values of the .data section. 38defined in linker script */ 39.word _sidata 40/* start address for the .data section. defined in linker script */ 41.word _sdata 42/* end address for the .data section. defined in linker script */ 43.word _edata 44/* start address for the .bss section. defined in linker script */ 45.word _sbss 46/* end address for the .bss section. defined in linker script */ 47.word _ebss 48 49.equ BootRAM, 0xF108F85F 50/** 51 * @brief This is the code that gets called when the processor first 52 * starts execution following a reset event. Only the absolutely 53 * necessary set is performed, after which the application 54 * supplied main() routine is called. 55 * @param None 56 * @retval : None 57*/ 58 59 .section .text.Reset_Handler 60 .weak Reset_Handler 61 .type Reset_Handler, %function 62Reset_Handler: 63 64/* Copy the data segment initializers from flash to SRAM */ 65 ldr r0, =_sdata 66 ldr r1, =_edata 67 ldr r2, =_sidata 68 movs r3, #0 69 b LoopCopyDataInit 70 71CopyDataInit: 72 ldr r4, [r2, r3] 73 str r4, [r0, r3] 74 adds r3, r3, #4 75 76LoopCopyDataInit: 77 adds r4, r0, r3 78 cmp r4, r1 79 bcc CopyDataInit 80 81/* Zero fill the bss segment. */ 82 ldr r2, =_sbss 83 ldr r4, =_ebss 84 movs r3, #0 85 b LoopFillZerobss 86 87FillZerobss: 88 str r3, [r2] 89 adds r2, r2, #4 90 91LoopFillZerobss: 92 cmp r2, r4 93 bcc FillZerobss 94 95/* Call the clock system intitialization function.*/ 96 bl SystemInit 97/* Call static constructors */ 98 bl __libc_init_array 99/* Call the application's entry point.*/ 100 bl entry 101 bx lr 102.size Reset_Handler, .-Reset_Handler 103 104/** 105 * @brief This is the code that gets called when the processor receives an 106 * unexpected interrupt. This simply enters an infinite loop, preserving 107 * the system state for examination by a debugger. 108 * 109 * @param None 110 * @retval : None 111*/ 112 .section .text.Default_Handler,"ax",%progbits 113Default_Handler: 114Infinite_Loop: 115 b Infinite_Loop 116 .size Default_Handler, .-Default_Handler 117/****************************************************************************** 118* 119* The minimal vector table for a Cortex M3. Note that the proper constructs 120* must be placed on this to ensure that it ends up at physical address 121* 0x0000.0000. 122* 123******************************************************************************/ 124 .section .isr_vector,"a",%progbits 125 .type g_pfnVectors, %object 126 .size g_pfnVectors, .-g_pfnVectors 127 128 129g_pfnVectors: 130 .word _estack 131 .word Reset_Handler 132 .word NMI_Handler 133 .word HardFault_Handler 134 .word MemManage_Handler 135 .word BusFault_Handler 136 .word UsageFault_Handler 137 .word 0 138 .word 0 139 .word 0 140 .word 0 141 .word SVC_Handler 142 .word DebugMon_Handler 143 .word 0 144 .word PendSV_Handler 145 .word SysTick_Handler 146 .word WWDG_IRQHandler 147 .word PVD_IRQHandler 148 .word TAMPER_STAMP_IRQHandler 149 .word RTC_WKUP_IRQHandler 150 .word FLASH_IRQHandler 151 .word RCC_IRQHandler 152 .word EXTI0_IRQHandler 153 .word EXTI1_IRQHandler 154 .word EXTI2_IRQHandler 155 .word EXTI3_IRQHandler 156 .word EXTI4_IRQHandler 157 .word DMA1_Channel1_IRQHandler 158 .word DMA1_Channel2_IRQHandler 159 .word DMA1_Channel3_IRQHandler 160 .word DMA1_Channel4_IRQHandler 161 .word DMA1_Channel5_IRQHandler 162 .word DMA1_Channel6_IRQHandler 163 .word DMA1_Channel7_IRQHandler 164 .word ADC1_IRQHandler 165 .word USB_HP_IRQHandler 166 .word USB_LP_IRQHandler 167 .word DAC_IRQHandler 168 .word COMP_IRQHandler 169 .word EXTI9_5_IRQHandler 170 .word 0 171 .word TIM9_IRQHandler 172 .word TIM10_IRQHandler 173 .word TIM11_IRQHandler 174 .word TIM2_IRQHandler 175 .word TIM3_IRQHandler 176 .word TIM4_IRQHandler 177 .word I2C1_EV_IRQHandler 178 .word I2C1_ER_IRQHandler 179 .word I2C2_EV_IRQHandler 180 .word I2C2_ER_IRQHandler 181 .word SPI1_IRQHandler 182 .word SPI2_IRQHandler 183 .word USART1_IRQHandler 184 .word USART2_IRQHandler 185 .word USART3_IRQHandler 186 .word EXTI15_10_IRQHandler 187 .word RTC_Alarm_IRQHandler 188 .word USB_FS_WKUP_IRQHandler 189 .word TIM6_IRQHandler 190 .word TIM7_IRQHandler 191 .word 0 192 .word 0 193 .word 0 194 .word 0 195 .word 0 196 .word 0 197 .word 0 198 .word 0 199 .word 0 200 .word 0 201 .word 0 202 .word 0 203 .word 0 204 .word 0 205 .word 0 206 .word 0 207 .word 0 208 .word BootRAM /* @0x108. This is for boot in RAM mode for 209 STM32L151XB devices. */ 210 211/******************************************************************************* 212* 213* Provide weak aliases for each Exception handler to the Default_Handler. 214* As they are weak aliases, any function with the same name will override 215* this definition. 216* 217*******************************************************************************/ 218 219 .weak NMI_Handler 220 .thumb_set NMI_Handler,Default_Handler 221 222 .weak HardFault_Handler 223 .thumb_set HardFault_Handler,Default_Handler 224 225 .weak MemManage_Handler 226 .thumb_set MemManage_Handler,Default_Handler 227 228 .weak BusFault_Handler 229 .thumb_set BusFault_Handler,Default_Handler 230 231 .weak UsageFault_Handler 232 .thumb_set UsageFault_Handler,Default_Handler 233 234 .weak SVC_Handler 235 .thumb_set SVC_Handler,Default_Handler 236 237 .weak DebugMon_Handler 238 .thumb_set DebugMon_Handler,Default_Handler 239 240 .weak PendSV_Handler 241 .thumb_set PendSV_Handler,Default_Handler 242 243 .weak SysTick_Handler 244 .thumb_set SysTick_Handler,Default_Handler 245 246 .weak WWDG_IRQHandler 247 .thumb_set WWDG_IRQHandler,Default_Handler 248 249 .weak PVD_IRQHandler 250 .thumb_set PVD_IRQHandler,Default_Handler 251 252 .weak TAMPER_STAMP_IRQHandler 253 .thumb_set TAMPER_STAMP_IRQHandler,Default_Handler 254 255 .weak RTC_WKUP_IRQHandler 256 .thumb_set RTC_WKUP_IRQHandler,Default_Handler 257 258 .weak FLASH_IRQHandler 259 .thumb_set FLASH_IRQHandler,Default_Handler 260 261 .weak RCC_IRQHandler 262 .thumb_set RCC_IRQHandler,Default_Handler 263 264 .weak EXTI0_IRQHandler 265 .thumb_set EXTI0_IRQHandler,Default_Handler 266 267 .weak EXTI1_IRQHandler 268 .thumb_set EXTI1_IRQHandler,Default_Handler 269 270 .weak EXTI2_IRQHandler 271 .thumb_set EXTI2_IRQHandler,Default_Handler 272 273 .weak EXTI3_IRQHandler 274 .thumb_set EXTI3_IRQHandler,Default_Handler 275 276 .weak EXTI4_IRQHandler 277 .thumb_set EXTI4_IRQHandler,Default_Handler 278 279 .weak DMA1_Channel1_IRQHandler 280 .thumb_set DMA1_Channel1_IRQHandler,Default_Handler 281 282 .weak DMA1_Channel2_IRQHandler 283 .thumb_set DMA1_Channel2_IRQHandler,Default_Handler 284 285 .weak DMA1_Channel3_IRQHandler 286 .thumb_set DMA1_Channel3_IRQHandler,Default_Handler 287 288 .weak DMA1_Channel4_IRQHandler 289 .thumb_set DMA1_Channel4_IRQHandler,Default_Handler 290 291 .weak DMA1_Channel5_IRQHandler 292 .thumb_set DMA1_Channel5_IRQHandler,Default_Handler 293 294 .weak DMA1_Channel6_IRQHandler 295 .thumb_set DMA1_Channel6_IRQHandler,Default_Handler 296 297 .weak DMA1_Channel7_IRQHandler 298 .thumb_set DMA1_Channel7_IRQHandler,Default_Handler 299 300 .weak ADC1_IRQHandler 301 .thumb_set ADC1_IRQHandler,Default_Handler 302 303 .weak USB_HP_IRQHandler 304 .thumb_set USB_HP_IRQHandler,Default_Handler 305 306 .weak USB_LP_IRQHandler 307 .thumb_set USB_LP_IRQHandler,Default_Handler 308 309 .weak DAC_IRQHandler 310 .thumb_set DAC_IRQHandler,Default_Handler 311 312 .weak COMP_IRQHandler 313 .thumb_set COMP_IRQHandler,Default_Handler 314 315 .weak EXTI9_5_IRQHandler 316 .thumb_set EXTI9_5_IRQHandler,Default_Handler 317 318 .weak TIM9_IRQHandler 319 .thumb_set TIM9_IRQHandler,Default_Handler 320 321 .weak TIM10_IRQHandler 322 .thumb_set TIM10_IRQHandler,Default_Handler 323 324 .weak TIM11_IRQHandler 325 .thumb_set TIM11_IRQHandler,Default_Handler 326 327 .weak TIM2_IRQHandler 328 .thumb_set TIM2_IRQHandler,Default_Handler 329 330 .weak TIM3_IRQHandler 331 .thumb_set TIM3_IRQHandler,Default_Handler 332 333 .weak TIM4_IRQHandler 334 .thumb_set TIM4_IRQHandler,Default_Handler 335 336 .weak I2C1_EV_IRQHandler 337 .thumb_set I2C1_EV_IRQHandler,Default_Handler 338 339 .weak I2C1_ER_IRQHandler 340 .thumb_set I2C1_ER_IRQHandler,Default_Handler 341 342 .weak I2C2_EV_IRQHandler 343 .thumb_set I2C2_EV_IRQHandler,Default_Handler 344 345 .weak I2C2_ER_IRQHandler 346 .thumb_set I2C2_ER_IRQHandler,Default_Handler 347 348 .weak SPI1_IRQHandler 349 .thumb_set SPI1_IRQHandler,Default_Handler 350 351 .weak SPI2_IRQHandler 352 .thumb_set SPI2_IRQHandler,Default_Handler 353 354 .weak USART1_IRQHandler 355 .thumb_set USART1_IRQHandler,Default_Handler 356 357 .weak USART2_IRQHandler 358 .thumb_set USART2_IRQHandler,Default_Handler 359 360 .weak USART3_IRQHandler 361 .thumb_set USART3_IRQHandler,Default_Handler 362 363 .weak EXTI15_10_IRQHandler 364 .thumb_set EXTI15_10_IRQHandler,Default_Handler 365 366 .weak RTC_Alarm_IRQHandler 367 .thumb_set RTC_Alarm_IRQHandler,Default_Handler 368 369 .weak USB_FS_WKUP_IRQHandler 370 .thumb_set USB_FS_WKUP_IRQHandler,Default_Handler 371 372 .weak TIM6_IRQHandler 373 .thumb_set TIM6_IRQHandler,Default_Handler 374 375 .weak TIM7_IRQHandler 376 .thumb_set TIM7_IRQHandler,Default_Handler 377 378/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 379 380