Skip to content

Commit 0c0692a

Browse files
fixing the issues
1 parent a03f5ff commit 0c0692a

File tree

6 files changed

+715
-0
lines changed

6 files changed

+715
-0
lines changed
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
;******************** (C) COPYRIGHT 2016 STMicroelectronics ********************
2+
;* File Name : startup_stm32l071xx.s
3+
;* Author : MCD Application Team
4+
;* Description : STM32l071xx 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 Cortex-M0+ processor is in Thread mode,
12+
;* priority is Privileged, and the Stack is set to Main.
13+
;*******************************************************************************
14+
;*
15+
;* Redistribution and use in source and binary forms, with or without modification,
16+
;* are permitted provided that the following conditions are met:
17+
;* 1. Redistributions of source code must retain the above copyright notice,
18+
;* this list of conditions and the following disclaimer.
19+
;* 2. Redistributions in binary form must reproduce the above copyright notice,
20+
;* this list of conditions and the following disclaimer in the documentation
21+
;* and/or other materials provided with the distribution.
22+
;* 3. Neither the name of STMicroelectronics nor the names of its contributors
23+
;* may be used to endorse or promote products derived from this software
24+
;* without specific prior written permission.
25+
;*
26+
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27+
;* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28+
;* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29+
;* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30+
;* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31+
;* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32+
;* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33+
;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34+
;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35+
;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
;*
37+
;*******************************************************************************
38+
;
39+
; Amount of memory (in bytes) allocated for Stack
40+
; Tailor this value to your application needs
41+
; <h> Stack Configuration
42+
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
43+
; </h>
44+
45+
Stack_Size EQU 0x00000400
46+
47+
AREA STACK, NOINIT, READWRITE, ALIGN=3
48+
Stack_Mem SPACE Stack_Size
49+
__initial_sp
50+
51+
52+
; <h> Heap Configuration
53+
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
54+
; </h>
55+
56+
Heap_Size EQU 0x00000200
57+
58+
AREA HEAP, NOINIT, READWRITE, ALIGN=3
59+
__heap_base
60+
Heap_Mem SPACE Heap_Size
61+
__heap_limit
62+
63+
PRESERVE8
64+
THUMB
65+
66+
67+
; Vector Table Mapped to Address 0 at Reset
68+
AREA RESET, DATA, READONLY
69+
EXPORT __Vectors
70+
EXPORT __Vectors_End
71+
EXPORT __Vectors_Size
72+
73+
__Vectors DCD __initial_sp ; Top of Stack
74+
DCD Reset_Handler ; Reset Handler
75+
DCD NMI_Handler ; NMI Handler
76+
DCD HardFault_Handler ; Hard Fault Handler
77+
DCD 0 ; Reserved
78+
DCD 0 ; Reserved
79+
DCD 0 ; Reserved
80+
DCD 0 ; Reserved
81+
DCD 0 ; Reserved
82+
DCD 0 ; Reserved
83+
DCD 0 ; Reserved
84+
DCD SVC_Handler ; SVCall Handler
85+
DCD 0 ; Reserved
86+
DCD 0 ; Reserved
87+
DCD PendSV_Handler ; PendSV Handler
88+
DCD SysTick_Handler ; SysTick Handler
89+
90+
; External Interrupts
91+
DCD WWDG_IRQHandler ; Window Watchdog
92+
DCD PVD_IRQHandler ; PVD through EXTI Line detect
93+
DCD RTC_IRQHandler ; RTC through EXTI Line
94+
DCD FLASH_IRQHandler ; FLASH
95+
DCD RCC_IRQHandler ; RCC
96+
DCD EXTI0_1_IRQHandler ; EXTI Line 0 and 1
97+
DCD EXTI2_3_IRQHandler ; EXTI Line 2 and 3
98+
DCD EXTI4_15_IRQHandler ; EXTI Line 4 to 15
99+
DCD 0 ; Reserved
100+
DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1
101+
DCD DMA1_Channel2_3_IRQHandler ; DMA1 Channel 2 and Channel 3
102+
DCD DMA1_Channel4_5_6_7_IRQHandler ; DMA1 Channel 4, Channel 5, Channel 6 and Channel 7
103+
DCD ADC1_COMP_IRQHandler ; ADC1, COMP1 and COMP2
104+
DCD LPTIM1_IRQHandler ; LPTIM1
105+
DCD USART4_5_IRQHandler ; USART4 and USART5
106+
DCD TIM2_IRQHandler ; TIM2
107+
DCD TIM3_IRQHandler ; TIM3
108+
DCD TIM6_IRQHandler ; TIM6
109+
DCD TIM7_IRQHandler ; TIM7
110+
DCD 0 ; Reserved
111+
DCD TIM21_IRQHandler ; TIM21
112+
DCD I2C3_IRQHandler ; I2C3
113+
DCD TIM22_IRQHandler ; TIM22
114+
DCD I2C1_IRQHandler ; I2C1
115+
DCD I2C2_IRQHandler ; I2C2
116+
DCD SPI1_IRQHandler ; SPI1
117+
DCD SPI2_IRQHandler ; SPI2
118+
DCD USART1_IRQHandler ; USART1
119+
DCD USART2_IRQHandler ; USART2
120+
DCD LPUART1_IRQHandler ; LPUART1
121+
DCD 0 ; Reserved
122+
DCD 0 ; Reserved
123+
124+
__Vectors_End
125+
126+
__Vectors_Size EQU __Vectors_End - __Vectors
127+
128+
AREA |.text|, CODE, READONLY
129+
130+
; Reset handler routine
131+
Reset_Handler PROC
132+
EXPORT Reset_Handler [WEAK]
133+
IMPORT __main
134+
IMPORT SystemInit
135+
LDR R0, =SystemInit
136+
BLX R0
137+
LDR R0, =__main
138+
BX R0
139+
ENDP
140+
141+
; Dummy Exception Handlers (infinite loops which can be modified)
142+
143+
NMI_Handler PROC
144+
EXPORT NMI_Handler [WEAK]
145+
B .
146+
ENDP
147+
HardFault_Handler\
148+
PROC
149+
EXPORT HardFault_Handler [WEAK]
150+
B .
151+
ENDP
152+
SVC_Handler PROC
153+
EXPORT SVC_Handler [WEAK]
154+
B .
155+
ENDP
156+
PendSV_Handler PROC
157+
EXPORT PendSV_Handler [WEAK]
158+
B .
159+
ENDP
160+
SysTick_Handler PROC
161+
EXPORT SysTick_Handler [WEAK]
162+
B .
163+
ENDP
164+
165+
Default_Handler PROC
166+
167+
EXPORT WWDG_IRQHandler [WEAK]
168+
EXPORT PVD_IRQHandler [WEAK]
169+
EXPORT RTC_IRQHandler [WEAK]
170+
EXPORT FLASH_IRQHandler [WEAK]
171+
EXPORT RCC_IRQHandler [WEAK]
172+
EXPORT EXTI0_1_IRQHandler [WEAK]
173+
EXPORT EXTI2_3_IRQHandler [WEAK]
174+
EXPORT EXTI4_15_IRQHandler [WEAK]
175+
EXPORT DMA1_Channel1_IRQHandler [WEAK]
176+
EXPORT DMA1_Channel2_3_IRQHandler [WEAK]
177+
EXPORT DMA1_Channel4_5_6_7_IRQHandler [WEAK]
178+
EXPORT ADC1_COMP_IRQHandler [WEAK]
179+
EXPORT LPTIM1_IRQHandler [WEAK]
180+
EXPORT USART4_5_IRQHandler [WEAK]
181+
EXPORT TIM2_IRQHandler [WEAK]
182+
EXPORT TIM3_IRQHandler [WEAK]
183+
EXPORT TIM6_IRQHandler [WEAK]
184+
EXPORT TIM7_IRQHandler [WEAK]
185+
EXPORT TIM21_IRQHandler [WEAK]
186+
EXPORT TIM22_IRQHandler [WEAK]
187+
EXPORT I2C1_IRQHandler [WEAK]
188+
EXPORT I2C2_IRQHandler [WEAK]
189+
EXPORT I2C3_IRQHandler [WEAK]
190+
EXPORT SPI1_IRQHandler [WEAK]
191+
EXPORT SPI2_IRQHandler [WEAK]
192+
EXPORT USART1_IRQHandler [WEAK]
193+
EXPORT USART2_IRQHandler [WEAK]
194+
EXPORT LPUART1_IRQHandler [WEAK]
195+
196+
WWDG_IRQHandler
197+
PVD_IRQHandler
198+
RTC_IRQHandler
199+
FLASH_IRQHandler
200+
RCC_IRQHandler
201+
EXTI0_1_IRQHandler
202+
EXTI2_3_IRQHandler
203+
EXTI4_15_IRQHandler
204+
DMA1_Channel1_IRQHandler
205+
DMA1_Channel2_3_IRQHandler
206+
DMA1_Channel4_5_6_7_IRQHandler
207+
ADC1_COMP_IRQHandler
208+
LPTIM1_IRQHandler
209+
USART4_5_IRQHandler
210+
TIM2_IRQHandler
211+
TIM3_IRQHandler
212+
TIM6_IRQHandler
213+
TIM7_IRQHandler
214+
TIM21_IRQHandler
215+
TIM22_IRQHandler
216+
I2C1_IRQHandler
217+
I2C2_IRQHandler
218+
I2C3_IRQHandler
219+
SPI1_IRQHandler
220+
SPI2_IRQHandler
221+
USART1_IRQHandler
222+
USART2_IRQHandler
223+
LPUART1_IRQHandler
224+
225+
B .
226+
227+
ENDP
228+
229+
ALIGN
230+
231+
;*******************************************************************************
232+
; User Stack and Heap initialization
233+
;*******************************************************************************
234+
IF :DEF:__MICROLIB
235+
236+
EXPORT __initial_sp
237+
EXPORT __heap_base
238+
EXPORT __heap_limit
239+
240+
ELSE
241+
242+
IMPORT __use_two_region_memory
243+
EXPORT __user_initial_stackheap
244+
245+
__user_initial_stackheap
246+
247+
LDR R0, = Heap_Mem
248+
LDR R1, =(Stack_Mem + Stack_Size)
249+
LDR R2, = (Heap_Mem + Heap_Size)
250+
LDR R3, = Stack_Mem
251+
BX LR
252+
253+
ALIGN
254+
255+
ENDIF
256+
257+
END
258+
259+
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#! armcc -E
2+
; Scatter-Loading Description File
3+
;
4+
; SPDX-License-Identifier: BSD-3-Clause
5+
;******************************************************************************
6+
;* @attention
7+
;*
8+
;* Copyright (c) 2016-2020 STMicroelectronics.
9+
;* All rights reserved.
10+
;*
11+
;* This software component is licensed by ST under BSD 3-Clause license,
12+
;* the "License"; You may not use this file except in compliance with the
13+
;* License. You may obtain a copy of the License at:
14+
;* opensource.org/licenses/BSD-3-Clause
15+
;*
16+
;******************************************************************************
17+
18+
#include "../cmsis_nvic.h"
19+
20+
#if !defined(MBED_APP_START)
21+
#define MBED_APP_START MBED_ROM_START
22+
#endif
23+
24+
#if !defined(MBED_APP_SIZE)
25+
#define MBED_APP_SIZE MBED_ROM_SIZE
26+
#endif
27+
28+
#if !defined(MBED_BOOT_STACK_SIZE)
29+
/* This value is normally defined by the tools to 0x1000 for bare metal and 0x400 for RTOS */
30+
#define MBED_BOOT_STACK_SIZE 0x400
31+
#endif
32+
33+
/* Round up VECTORS_SIZE to 8 bytes */
34+
#define VECTORS_SIZE (((NVIC_NUM_VECTORS * 4) + 7) AND ~7)
35+
36+
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
37+
38+
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
39+
*.o (RESET, +First)
40+
*(InRoot$$Sections)
41+
.ANY (+RO)
42+
}
43+
44+
RW_IRAM1 (MBED_RAM_START + VECTORS_SIZE) { ; RW data
45+
.ANY (+RW +ZI)
46+
}
47+
48+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_START + MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE - AlignExpr(ImageLimit(RW_IRAM1), 16)) { ; Heap growing up
49+
}
50+
51+
ARM_LIB_STACK (MBED_RAM_START + MBED_RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; Stack region growing down
52+
}
53+
}

0 commit comments

Comments
 (0)