From 44bc1234830f05bf4cc9efcc935e43df4ea52603 Mon Sep 17 00:00:00 2001 From: Sarah Marsh Date: Thu, 21 Feb 2019 16:14:16 +0000 Subject: [PATCH] Add bootlader support for NUCLEO_L073RZ on GCC --- .../device/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld | 36 +++++++++++-------- .../device/system_clock.c | 6 +++- targets/targets.json | 1 + 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld index 17d8f13019..6d9f6b0ca6 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/TOOLCHAIN_GCC_ARM/STM32L073XZ.ld @@ -1,17 +1,3 @@ -/* Linker script to configure memory regions. */ - -#if !defined(MBED_BOOT_STACK_SIZE) - #define MBED_BOOT_STACK_SIZE 0x400 -#endif - -STACK_SIZE = MBED_BOOT_STACK_SIZE; - -MEMORY -{ - FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 192k - RAM (rwx) : ORIGIN = 0x200000C0, LENGTH = 20K - 0xC0 -} - /* Linker script to place sections and symbol values. Should be used together * with other linker script that defines memory regions FLASH and RAM. * It references following symbols, which must be defined in code: @@ -39,6 +25,28 @@ MEMORY * __stack * _estack */ + +#if !defined(MBED_APP_START) + #define MBED_APP_START 0x08000000 +#endif + +#if !defined(MBED_APP_SIZE) + #define MBED_APP_SIZE 0x2EE00 +#endif + +#if !defined(MBED_BOOT_STACK_SIZE) + #define MBED_BOOT_STACK_SIZE 0x400 +#endif + +STACK_SIZE = MBED_BOOT_STACK_SIZE; + +/* Linker script to configure memory regions. */ +MEMORY +{ + FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE + RAM (rwx) : ORIGIN = 0x200000C0, LENGTH = 20K - 0xC0 +} + ENTRY(Reset_Handler) SECTIONS diff --git a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/system_clock.c b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/system_clock.c index 7da07379b5..14cdda5ca5 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/system_clock.c +++ b/targets/TARGET_STM/TARGET_STM32L0/TARGET_NUCLEO_L073RZ/device/system_clock.c @@ -82,8 +82,12 @@ void SystemInit (void) #ifdef VECT_TAB_SRAM SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */ #else +#ifdef APPLICATION_ADDR + SCB->VTOR = APPLICATION_ADDR; /* Vector Table Relocation in Internal FLASH to offset application*/ +#else SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */ -#endif +#endif // end APPLICATION_ADDR +#endif // end VECT_TAB_SRAM } diff --git a/targets/targets.json b/targets/targets.json index d2db79b197..8255338c2d 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -3142,6 +3142,7 @@ "MPU" ], "release_versions": ["2", "5"], + "bootloader_supported": true, "device_name": "STM32L073RZ" }, "NUCLEO_L152RE": {