Skip to content

Commit 5d59c99

Browse files
committed
STM32L5: TOOLCHAIN automatic updates
1 parent 77e5bb4 commit 5d59c99

File tree

14 files changed

+728
-115
lines changed

14 files changed

+728
-115
lines changed

targets/TARGET_STM/TARGET_STM32L5/STM32Cube_FW/stm32l5xx_hal_conf.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,17 +414,7 @@
414414

415415
/* Exported macro ------------------------------------------------------------*/
416416
#ifdef USE_FULL_ASSERT
417-
/**
418-
* @brief The assert_param macro is used for function's parameters check.
419-
* @param expr If expr is false, it calls assert_failed function
420-
* which reports the name of the source file and the source
421-
* line number of the call that failed.
422-
* If expr is true, it returns no value.
423-
* @retval None
424-
*/
425-
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
426-
/* Exported functions ------------------------------------------------------- */
427-
void assert_failed(uint8_t *file, uint32_t line);
417+
#include "stm32_assert.h" // MBED patch
428418
#else
429419
#define assert_param(expr) ((void)0U)
430420
#endif /* USE_FULL_ASSERT */

targets/TARGET_STM/TARGET_STM32L5/STM32Cube_FW/system_stm32l5xx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ void SystemInit(void)
197197
/* Configure the Vector Table location add offset address ------------------*/
198198
#ifdef VECT_TAB_SRAM
199199
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
200+
#else
201+
#include "nvic_addr.h" // MBED
202+
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; // MBED
200203
#endif
201204
}
202205

targets/TARGET_STM/TARGET_STM32L5/TARGET_STM32L552xx/TOOLCHAIN_ARM_STD/startup_stm32l552xx.S

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,6 @@
2323
;*******************************************************************************
2424
;* <<< Use Configuration Wizard in Context Menu >>>
2525
;
26-
; Amount of memory (in bytes) allocated for Stack
27-
; Tailor this value to your application needs
28-
; <h> Stack Configuration
29-
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
30-
; </h>
31-
32-
Stack_Size EQU 0x00000400
33-
34-
AREA STACK, NOINIT, READWRITE, ALIGN=3
35-
Stack_Mem SPACE Stack_Size
36-
__initial_sp
37-
38-
39-
; <h> Heap Configuration
40-
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
41-
; </h>
42-
43-
Heap_Size EQU 0x00000200
44-
45-
AREA HEAP, NOINIT, READWRITE, ALIGN=3
46-
__heap_base
47-
Heap_Mem SPACE Heap_Size
48-
__heap_limit
49-
50-
5126
PRESERVE8
5227
THUMB
5328

@@ -59,7 +34,8 @@ __heap_limit
5934
EXPORT __Vectors_End
6035
EXPORT __Vectors_Size
6136

62-
__Vectors DCD __initial_sp ; Top of Stack
37+
IMPORT |Image$$ARM_LIB_STACK$$ZI$$Limit|
38+
__Vectors DCD |Image$$ARM_LIB_STACK$$ZI$$Limit| ; Top of Stack
6339
DCD Reset_Handler ; Reset Handler
6440
DCD NMI_Handler ; NMI Handler
6541
DCD HardFault_Handler ; Hard Fault Handler
@@ -480,28 +456,6 @@ ICACHE_IRQHandler
480456
;*******************************************************************************
481457
; User Stack and Heap initialization
482458
;*******************************************************************************
483-
IF :DEF:__MICROLIB
484-
485-
EXPORT __initial_sp
486-
EXPORT __heap_base
487-
EXPORT __heap_limit
488-
489-
ELSE
490-
491-
IMPORT __use_two_region_memory
492-
EXPORT __user_initial_stackheap
493-
494-
__user_initial_stackheap PROC
495-
LDR R0, = Heap_Mem
496-
LDR R1, =(Stack_Mem + Stack_Size)
497-
LDR R2, = (Heap_Mem + Heap_Size)
498-
LDR R3, = Stack_Mem
499-
BX LR
500-
ENDP
501-
502-
ALIGN
503-
504-
ENDIF
505459

506460
END
507461

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+
}

targets/TARGET_STM/TARGET_STM32L5/TARGET_STM32L552xx/TOOLCHAIN_GCC_ARM/startup_stm32l552xx.S

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ LoopFillZerobss:
9292

9393
/* Call the clock system intitialization function.*/
9494
bl SystemInit
95-
/* Call static constructors */
96-
bl __libc_init_array
97-
/* Call the application's entry point.*/
98-
bl main
95+
bl _start
96+
bx lr
9997

10098
LoopForever:
10199
b LoopForever
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/* Linker script to configure memory regions. */
2+
/*
3+
* SPDX-License-Identifier: BSD-3-Clause
4+
******************************************************************************
5+
* @attention
6+
*
7+
* Copyright (c) 2016-2020 STMicroelectronics.
8+
* All rights reserved.
9+
*
10+
* This software component is licensed by ST under BSD 3-Clause license,
11+
* the "License"; You may not use this file except in compliance with the
12+
* License. You may obtain a copy of the License at:
13+
* opensource.org/licenses/BSD-3-Clause
14+
*
15+
******************************************************************************
16+
*/
17+
18+
#include "../cmsis_nvic.h"
19+
20+
21+
#if !defined(MBED_APP_START)
22+
#define MBED_APP_START MBED_ROM_START
23+
#endif
24+
25+
#if !defined(MBED_APP_SIZE)
26+
#define MBED_APP_SIZE MBED_ROM_SIZE
27+
#endif
28+
29+
#if !defined(MBED_BOOT_STACK_SIZE)
30+
/* This value is normally defined by the tools
31+
to 0x1000 for bare metal and 0x400 for RTOS */
32+
#define MBED_BOOT_STACK_SIZE 0x400
33+
#endif
34+
35+
/* Round up VECTORS_SIZE to 8 bytes */
36+
#define VECTORS_SIZE (((NVIC_NUM_VECTORS * 4) + 7) & 0xFFFFFFF8)
37+
38+
MEMORY
39+
{
40+
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
41+
RAM (rwx) : ORIGIN = MBED_RAM_START + VECTORS_SIZE, LENGTH = MBED_RAM_SIZE - VECTORS_SIZE
42+
}
43+
44+
/* Linker script to place sections and symbol values. Should be used together
45+
* with other linker script that defines memory regions FLASH and RAM.
46+
* It references following symbols, which must be defined in code:
47+
* Reset_Handler : Entry of reset handler
48+
*
49+
* It defines following symbols, which code can use without definition:
50+
* __exidx_start
51+
* __exidx_end
52+
* __etext
53+
* __data_start__
54+
* __preinit_array_start
55+
* __preinit_array_end
56+
* __init_array_start
57+
* __init_array_end
58+
* __fini_array_start
59+
* __fini_array_end
60+
* __data_end__
61+
* __bss_start__
62+
* __bss_end__
63+
* __end__
64+
* end
65+
* __HeapLimit
66+
* __StackLimit
67+
* __StackTop
68+
* __stack
69+
* _estack
70+
*/
71+
ENTRY(Reset_Handler)
72+
73+
SECTIONS
74+
{
75+
.text :
76+
{
77+
KEEP(*(.isr_vector))
78+
*(.text*)
79+
80+
KEEP(*(.init))
81+
KEEP(*(.fini))
82+
83+
/* .ctors */
84+
*crtbegin.o(.ctors)
85+
*crtbegin?.o(.ctors)
86+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
87+
*(SORT(.ctors.*))
88+
*(.ctors)
89+
90+
/* .dtors */
91+
*crtbegin.o(.dtors)
92+
*crtbegin?.o(.dtors)
93+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
94+
*(SORT(.dtors.*))
95+
*(.dtors)
96+
97+
*(.rodata*)
98+
99+
KEEP(*(.eh_frame*))
100+
} > FLASH
101+
102+
.ARM.extab :
103+
{
104+
*(.ARM.extab* .gnu.linkonce.armextab.*)
105+
} > FLASH
106+
107+
__exidx_start = .;
108+
.ARM.exidx :
109+
{
110+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
111+
} > FLASH
112+
__exidx_end = .;
113+
114+
/* Location counter can end up 2byte aligned with narrow Thumb code but
115+
__etext is assumed by startup code to be the LMA of a section in RAM
116+
which must be 8-byte aligned */
117+
__etext = ALIGN (8);
118+
_sidata = .;
119+
120+
.data : AT (__etext)
121+
{
122+
__data_start__ = .;
123+
_sdata = .;
124+
*(vtable)
125+
*(.data*)
126+
127+
. = ALIGN(8);
128+
/* preinit data */
129+
PROVIDE_HIDDEN (__preinit_array_start = .);
130+
KEEP(*(.preinit_array))
131+
PROVIDE_HIDDEN (__preinit_array_end = .);
132+
133+
. = ALIGN(8);
134+
/* init data */
135+
PROVIDE_HIDDEN (__init_array_start = .);
136+
KEEP(*(SORT(.init_array.*)))
137+
KEEP(*(.init_array))
138+
PROVIDE_HIDDEN (__init_array_end = .);
139+
140+
. = ALIGN(8);
141+
/* finit data */
142+
PROVIDE_HIDDEN (__fini_array_start = .);
143+
KEEP(*(SORT(.fini_array.*)))
144+
KEEP(*(.fini_array))
145+
PROVIDE_HIDDEN (__fini_array_end = .);
146+
147+
KEEP(*(.jcr*))
148+
. = ALIGN(8);
149+
/* All data end */
150+
__data_end__ = .;
151+
_edata = .;
152+
153+
} > RAM
154+
155+
/* Uninitialized data section
156+
* This region is not initialized by the C/C++ library and can be used to
157+
* store state across soft reboots. */
158+
.uninitialized (NOLOAD):
159+
{
160+
. = ALIGN(32);
161+
__uninitialized_start = .;
162+
*(.uninitialized)
163+
KEEP(*(.keep.uninitialized))
164+
. = ALIGN(32);
165+
__uninitialized_end = .;
166+
} > RAM
167+
168+
.bss :
169+
{
170+
. = ALIGN(8);
171+
__bss_start__ = .;
172+
_sbss = .;
173+
*(.bss*)
174+
*(COMMON)
175+
. = ALIGN(8);
176+
__bss_end__ = .;
177+
_ebss = .;
178+
} > RAM
179+
180+
.heap (COPY):
181+
{
182+
__end__ = .;
183+
PROVIDE(end = .);
184+
*(.heap*)
185+
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
186+
__HeapLimit = .;
187+
} > RAM
188+
189+
/* .stack_dummy section doesn't contains any symbols. It is only
190+
* used for linker to calculate size of stack sections, and assign
191+
* values to stack symbols later */
192+
.stack_dummy (COPY):
193+
{
194+
*(.stack*)
195+
} > RAM
196+
197+
/* Set stack top to end of RAM, and stack limit move down by
198+
* size of stack_dummy section */
199+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
200+
_estack = __StackTop;
201+
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
202+
PROVIDE(__stack = __StackTop);
203+
204+
/* Check if data + heap + stack exceeds RAM limit */
205+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
206+
}

0 commit comments

Comments
 (0)