1;/******************** (C) COPYRIGHT 2017 STMicroelectronics ******************** 2;* File Name : startup_stm32l151xba.s 3;* Author : MCD Application Team 4;* Version : 21-April-2017 5;* Date : V2.2.1 6;* Description : STM32L151XBA Devices vector for MDK-ARM toolchain. 7;* This module performs: 8;* - Set the initial SP 9;* - Set the initial PC == Reset_Handler 10;* - Set the vector table entries with the exceptions ISR 11;* address. 12;* - Configure the system clock 13;* - Branches to __main in the C library (which eventually 14;* calls main()). 15;* After Reset the Cortex-M3 processor is in Thread mode, 16;* priority is Privileged, and the Stack is set to Main. 17;******************************************************************************** 18;* 19;* COPYRIGHT(c) 2017 STMicroelectronics 20;* 21;* Redistribution and use in source and binary forms, with or without modification, 22;* are permitted provided that the following conditions are met: 23;* 1. Redistributions of source code must retain the above copyright notice, 24;* this list of conditions and the following disclaimer. 25;* 2. Redistributions in binary form must reproduce the above copyright notice, 26;* this list of conditions and the following disclaimer in the documentation 27;* and/or other materials provided with the distribution. 28;* 3. Neither the name of STMicroelectronics nor the names of its contributors 29;* may be used to endorse or promote products derived from this software 30;* without specific prior written permission. 31;* 32;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 35;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 36;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 38;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 39;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 40;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42; 43;******************************************************************************* 44 45; Amount of memory (in bytes) allocated for Stack 46; Tailor this value to your application needs 47; <h> Stack Configuration 48; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 49; </h> 50 51Stack_Size EQU 0x00000400 52 53 AREA STACK, NOINIT, READWRITE, ALIGN=3 54Stack_Mem SPACE Stack_Size 55__initial_sp 56 57 58; <h> Heap Configuration 59; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 60; </h> 61 62Heap_Size EQU 0x00000200 63 64 AREA HEAP, NOINIT, READWRITE, ALIGN=3 65__heap_base 66Heap_Mem SPACE Heap_Size 67__heap_limit 68 69 PRESERVE8 70 THUMB 71 72 73; Vector Table Mapped to Address 0 at Reset 74 AREA RESET, DATA, READONLY 75 EXPORT __Vectors 76 EXPORT __Vectors_End 77 EXPORT __Vectors_Size 78 79__Vectors DCD __initial_sp ; Top of Stack 80 DCD Reset_Handler ; Reset Handler 81 DCD NMI_Handler ; NMI Handler 82 DCD HardFault_Handler ; Hard Fault Handler 83 DCD MemManage_Handler ; MPU Fault Handler 84 DCD BusFault_Handler ; Bus Fault Handler 85 DCD UsageFault_Handler ; Usage Fault Handler 86 DCD 0 ; Reserved 87 DCD 0 ; Reserved 88 DCD 0 ; Reserved 89 DCD 0 ; Reserved 90 DCD SVC_Handler ; SVCall Handler 91 DCD DebugMon_Handler ; Debug Monitor Handler 92 DCD 0 ; Reserved 93 DCD PendSV_Handler ; PendSV Handler 94 DCD SysTick_Handler ; SysTick Handler 95 96 ; External Interrupts 97 DCD WWDG_IRQHandler ; Window Watchdog 98 DCD PVD_IRQHandler ; PVD through EXTI Line detect 99 DCD TAMPER_STAMP_IRQHandler ; Tamper and Time Stamp 100 DCD RTC_WKUP_IRQHandler ; RTC Wakeup 101 DCD FLASH_IRQHandler ; FLASH 102 DCD RCC_IRQHandler ; RCC 103 DCD EXTI0_IRQHandler ; EXTI Line 0 104 DCD EXTI1_IRQHandler ; EXTI Line 1 105 DCD EXTI2_IRQHandler ; EXTI Line 2 106 DCD EXTI3_IRQHandler ; EXTI Line 3 107 DCD EXTI4_IRQHandler ; EXTI Line 4 108 DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 109 DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2 110 DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3 111 DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4 112 DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5 113 DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6 114 DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7 115 DCD ADC1_IRQHandler ; ADC1 116 DCD USB_HP_IRQHandler ; USB High Priority 117 DCD USB_LP_IRQHandler ; USB Low Priority 118 DCD DAC_IRQHandler ; DAC 119 DCD COMP_IRQHandler ; COMP through EXTI Line 120 DCD EXTI9_5_IRQHandler ; EXTI Line 9..5 121 DCD 0 ; Reserved 122 DCD TIM9_IRQHandler ; TIM9 123 DCD TIM10_IRQHandler ; TIM10 124 DCD TIM11_IRQHandler ; TIM11 125 DCD TIM2_IRQHandler ; TIM2 126 DCD TIM3_IRQHandler ; TIM3 127 DCD TIM4_IRQHandler ; TIM4 128 DCD I2C1_EV_IRQHandler ; I2C1 Event 129 DCD I2C1_ER_IRQHandler ; I2C1 Error 130 DCD I2C2_EV_IRQHandler ; I2C2 Event 131 DCD I2C2_ER_IRQHandler ; I2C2 Error 132 DCD SPI1_IRQHandler ; SPI1 133 DCD SPI2_IRQHandler ; SPI2 134 DCD USART1_IRQHandler ; USART1 135 DCD USART2_IRQHandler ; USART2 136 DCD USART3_IRQHandler ; USART3 137 DCD EXTI15_10_IRQHandler ; EXTI Line 15..10 138 DCD RTC_Alarm_IRQHandler ; RTC Alarm through EXTI Line 139 DCD USB_FS_WKUP_IRQHandler ; USB FS Wakeup from suspend 140 DCD TIM6_IRQHandler ; TIM6 141 DCD TIM7_IRQHandler ; TIM7 142 143__Vectors_End 144 145__Vectors_Size EQU __Vectors_End - __Vectors 146 147 AREA |.text|, CODE, READONLY 148 149; Reset handler routine 150Reset_Handler PROC 151 EXPORT Reset_Handler [WEAK] 152 IMPORT __main 153 IMPORT SystemInit 154 LDR R0, =SystemInit 155 BLX R0 156 LDR R0, =__main 157 BX R0 158 ENDP 159 160; Dummy Exception Handlers (infinite loops which can be modified) 161 162NMI_Handler PROC 163 EXPORT NMI_Handler [WEAK] 164 B . 165 ENDP 166HardFault_Handler\ 167 PROC 168 EXPORT HardFault_Handler [WEAK] 169 B . 170 ENDP 171MemManage_Handler\ 172 PROC 173 EXPORT MemManage_Handler [WEAK] 174 B . 175 ENDP 176BusFault_Handler\ 177 PROC 178 EXPORT BusFault_Handler [WEAK] 179 B . 180 ENDP 181UsageFault_Handler\ 182 PROC 183 EXPORT UsageFault_Handler [WEAK] 184 B . 185 ENDP 186SVC_Handler PROC 187 EXPORT SVC_Handler [WEAK] 188 B . 189 ENDP 190DebugMon_Handler\ 191 PROC 192 EXPORT DebugMon_Handler [WEAK] 193 B . 194 ENDP 195PendSV_Handler PROC 196 EXPORT PendSV_Handler [WEAK] 197 B . 198 ENDP 199SysTick_Handler PROC 200 EXPORT SysTick_Handler [WEAK] 201 B . 202 ENDP 203 204Default_Handler PROC 205 206 EXPORT WWDG_IRQHandler [WEAK] 207 EXPORT PVD_IRQHandler [WEAK] 208 EXPORT TAMPER_STAMP_IRQHandler [WEAK] 209 EXPORT RTC_WKUP_IRQHandler [WEAK] 210 EXPORT FLASH_IRQHandler [WEAK] 211 EXPORT RCC_IRQHandler [WEAK] 212 EXPORT EXTI0_IRQHandler [WEAK] 213 EXPORT EXTI1_IRQHandler [WEAK] 214 EXPORT EXTI2_IRQHandler [WEAK] 215 EXPORT EXTI3_IRQHandler [WEAK] 216 EXPORT EXTI4_IRQHandler [WEAK] 217 EXPORT DMA1_Channel1_IRQHandler [WEAK] 218 EXPORT DMA1_Channel2_IRQHandler [WEAK] 219 EXPORT DMA1_Channel3_IRQHandler [WEAK] 220 EXPORT DMA1_Channel4_IRQHandler [WEAK] 221 EXPORT DMA1_Channel5_IRQHandler [WEAK] 222 EXPORT DMA1_Channel6_IRQHandler [WEAK] 223 EXPORT DMA1_Channel7_IRQHandler [WEAK] 224 EXPORT ADC1_IRQHandler [WEAK] 225 EXPORT USB_HP_IRQHandler [WEAK] 226 EXPORT USB_LP_IRQHandler [WEAK] 227 EXPORT DAC_IRQHandler [WEAK] 228 EXPORT COMP_IRQHandler [WEAK] 229 EXPORT EXTI9_5_IRQHandler [WEAK] 230 EXPORT TIM9_IRQHandler [WEAK] 231 EXPORT TIM10_IRQHandler [WEAK] 232 EXPORT TIM11_IRQHandler [WEAK] 233 EXPORT TIM2_IRQHandler [WEAK] 234 EXPORT TIM3_IRQHandler [WEAK] 235 EXPORT TIM4_IRQHandler [WEAK] 236 EXPORT I2C1_EV_IRQHandler [WEAK] 237 EXPORT I2C1_ER_IRQHandler [WEAK] 238 EXPORT I2C2_EV_IRQHandler [WEAK] 239 EXPORT I2C2_ER_IRQHandler [WEAK] 240 EXPORT SPI1_IRQHandler [WEAK] 241 EXPORT SPI2_IRQHandler [WEAK] 242 EXPORT USART1_IRQHandler [WEAK] 243 EXPORT USART2_IRQHandler [WEAK] 244 EXPORT USART3_IRQHandler [WEAK] 245 EXPORT EXTI15_10_IRQHandler [WEAK] 246 EXPORT RTC_Alarm_IRQHandler [WEAK] 247 EXPORT USB_FS_WKUP_IRQHandler [WEAK] 248 EXPORT TIM6_IRQHandler [WEAK] 249 EXPORT TIM7_IRQHandler [WEAK] 250 251WWDG_IRQHandler 252PVD_IRQHandler 253TAMPER_STAMP_IRQHandler 254RTC_WKUP_IRQHandler 255FLASH_IRQHandler 256RCC_IRQHandler 257EXTI0_IRQHandler 258EXTI1_IRQHandler 259EXTI2_IRQHandler 260EXTI3_IRQHandler 261EXTI4_IRQHandler 262DMA1_Channel1_IRQHandler 263DMA1_Channel2_IRQHandler 264DMA1_Channel3_IRQHandler 265DMA1_Channel4_IRQHandler 266DMA1_Channel5_IRQHandler 267DMA1_Channel6_IRQHandler 268DMA1_Channel7_IRQHandler 269ADC1_IRQHandler 270USB_HP_IRQHandler 271USB_LP_IRQHandler 272DAC_IRQHandler 273COMP_IRQHandler 274EXTI9_5_IRQHandler 275TIM9_IRQHandler 276TIM10_IRQHandler 277TIM11_IRQHandler 278TIM2_IRQHandler 279TIM3_IRQHandler 280TIM4_IRQHandler 281I2C1_EV_IRQHandler 282I2C1_ER_IRQHandler 283I2C2_EV_IRQHandler 284I2C2_ER_IRQHandler 285SPI1_IRQHandler 286SPI2_IRQHandler 287USART1_IRQHandler 288USART2_IRQHandler 289USART3_IRQHandler 290EXTI15_10_IRQHandler 291RTC_Alarm_IRQHandler 292USB_FS_WKUP_IRQHandler 293TIM6_IRQHandler 294TIM7_IRQHandler 295 296 B . 297 298 ENDP 299 300 ALIGN 301 302;******************************************************************************* 303; User Stack and Heap initialization 304;******************************************************************************* 305 IF :DEF:__MICROLIB 306 307 EXPORT __initial_sp 308 EXPORT __heap_base 309 EXPORT __heap_limit 310 311 ELSE 312 313 IMPORT __use_two_region_memory 314 EXPORT __user_initial_stackheap 315 316__user_initial_stackheap 317 318 LDR R0, = Heap_Mem 319 LDR R1, =(Stack_Mem + Stack_Size) 320 LDR R2, = (Heap_Mem + Heap_Size) 321 LDR R3, = Stack_Mem 322 BX LR 323 324 ALIGN 325 326 ENDIF 327 328 END 329 330;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****