Skip to content

Commit 4b9d07a

Browse files
author
Cruz Monrreal
authored
Merge pull request #9792 from sarahmarshy/nucleo-gcc-bootloader
NUCLEO_L073RZ Bootloader support
2 parents 486f4f5 + 22abea3 commit 4b9d07a

File tree

6 files changed

+59
-23
lines changed

6 files changed

+59
-23
lines changed

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_ARM_MICRO/stm32l073xz.sct

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,18 @@
2727
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2929

30+
#if !defined(MBED_APP_START)
31+
#define MBED_APP_START 0x08000000
32+
#endif
33+
34+
#if !defined(MBED_APP_SIZE)
35+
#define MBED_APP_SIZE 0x30000
36+
#endif
37+
3038
; STM32L073RZ: 192KB FLASH (0x30000) + 20KB RAM (0x5000)
31-
LR_IROM1 0x08000000 0x30000 { ; load region size_region
39+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3240

33-
ER_IROM1 0x08000000 0x30000 { ; load address = execution address
41+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
3442
*.o (RESET, +First)
3543
*(InRoot$$Sections)
3644
.ANY (+RO)

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_ARM_STD/stm32l073xz.sct

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,20 @@
3232
#define MBED_BOOT_STACK_SIZE 0x400
3333
#endif
3434

35+
#if !defined(MBED_APP_START)
36+
#define MBED_APP_START 0x08000000
37+
#endif
38+
39+
#if !defined(MBED_APP_SIZE)
40+
#define MBED_APP_SIZE 0x30000
41+
#endif
42+
3543
#define Stack_Size MBED_BOOT_STACK_SIZE
3644

3745
; STM32L073RZ: 192KB FLASH (0x30000) + 20KB RAM (0x5000)
38-
LR_IROM1 0x08000000 0x30000 { ; load region size_region
46+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
3947

40-
ER_IROM1 0x08000000 0x30000 { ; load address = execution address
48+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
4149
*.o (RESET, +First)
4250
*(InRoot$$Sections)
4351
.ANY (+RO)

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
/* Linker script to configure memory regions. */
2-
3-
#if !defined(MBED_BOOT_STACK_SIZE)
4-
#define MBED_BOOT_STACK_SIZE 0x400
5-
#endif
6-
7-
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8-
9-
MEMORY
10-
{
11-
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 192k
12-
RAM (rwx) : ORIGIN = 0x200000C0, LENGTH = 20K - 0xC0
13-
}
14-
151
/* Linker script to place sections and symbol values. Should be used together
162
* with other linker script that defines memory regions FLASH and RAM.
173
* It references following symbols, which must be defined in code:
@@ -39,6 +25,28 @@ MEMORY
3925
* __stack
4026
* _estack
4127
*/
28+
29+
#if !defined(MBED_APP_START)
30+
#define MBED_APP_START 0x08000000
31+
#endif
32+
33+
#if !defined(MBED_APP_SIZE)
34+
#define MBED_APP_SIZE 0x30000
35+
#endif
36+
37+
#if !defined(MBED_BOOT_STACK_SIZE)
38+
#define MBED_BOOT_STACK_SIZE 0x400
39+
#endif
40+
41+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
42+
43+
/* Linker script to configure memory regions. */
44+
MEMORY
45+
{
46+
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
47+
RAM (rwx) : ORIGIN = 0x200000C0, LENGTH = 20K - 0xC0
48+
}
49+
4250
ENTRY(Reset_Handler)
4351

4452
SECTIONS

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_IAR/stm32l073xx.icf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
/* [ROM = 192kb = 0x30000] */
2-
define symbol __intvec_start__ = 0x08000000;
3-
define symbol __region_ROM_start__ = 0x08000000;
4-
define symbol __region_ROM_end__ = 0x0802FFFF;
1+
if (!isdefinedsymbol(MBED_APP_START)) {
2+
define symbol MBED_APP_START = 0x08000000;
3+
}
4+
5+
if (!isdefinedsymbol(MBED_APP_SIZE)) {
6+
define symbol MBED_APP_SIZE = 0x3000;
7+
}
8+
9+
define symbol __intvec_start__ = MBED_APP_START;
10+
define symbol __region_ROM_start__ = MBED_APP_SIZE;
11+
define symbol __region_ROM_end__ = MBED_APP_START - MBED_APP_SIZE - 1;
512

613
/* [RAM = 20kb = 0x5000] Vector table dynamic copy: 48 vectors = 192 bytes (0xC0) to be reserved in RAM */
714
define symbol __NVIC_start__ = 0x20000000;

targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/system_clock.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,12 @@ void SystemInit (void)
8282
#ifdef VECT_TAB_SRAM
8383
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
8484
#else
85+
#ifdef APPLICATION_ADDR
86+
SCB->VTOR = APPLICATION_ADDR; /* Vector Table Relocation in Internal FLASH to offset application*/
87+
#else
8588
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
86-
#endif
89+
#endif // end APPLICATION_ADDR
90+
#endif // end VECT_TAB_SRAM
8791

8892
}
8993

targets/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,6 +3139,7 @@
31393139
"MPU"
31403140
],
31413141
"release_versions": ["2", "5"],
3142+
"bootloader_supported": true,
31423143
"device_name": "STM32L073RZ"
31433144
},
31443145
"NUCLEO_L152RE": {

0 commit comments

Comments
 (0)