From 340f0a6a575714c8060cd446d7023ca9e14cbb55 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Mon, 3 Sep 2018 12:20:36 +1000 Subject: [PATCH 1/2] Ensure target bootloader settings can be overridden in mbed_app.json Values like `target.mbed_rom_start` were being replaced by None and then ignored. --- tools/config/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/config/__init__.py b/tools/config/__init__.py index e963fd1b38c..a103e7cc1f6 100644 --- a/tools/config/__init__.py +++ b/tools/config/__init__.py @@ -495,7 +495,8 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None): self.target_labels = self.target.labels for override in BOOTLOADER_OVERRIDES: _, attr = override.split(".") - setattr(self.target, attr, None) + if not hasattr(self.target, attr): + setattr(self.target, attr, None) self.cumulative_overrides = {key: ConfigCumulativeOverride(key) for key in CUMULATIVE_ATTRIBUTES} From a0d7d4eef7566922d702ef992ad470eedff08d10 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Fri, 31 Aug 2018 17:25:26 +1000 Subject: [PATCH 2/2] nrf: allow target.mbed_ram_start and target.mbed_ram_size to override settings in linker --- .../device/TOOLCHAIN_ARM_STD/nRF52832.sct | 14 ++++++++------ .../device/TOOLCHAIN_GCC_ARM/NRF52832.ld | 16 +++++++++------- .../device/TOOLCHAIN_IAR/nRF52832.icf | 14 ++++++++------ .../device/TOOLCHAIN_ARM_STD/nRF52840.sct | 16 +++++++++------- .../device/TOOLCHAIN_GCC_ARM/NRF52840.ld | 16 +++++++++------- .../device/TOOLCHAIN_IAR/nRF52840.icf | 16 +++++++++------- 6 files changed, 52 insertions(+), 40 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct index e33232db837..d9d270be290 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct @@ -10,12 +10,14 @@ #endif /* If softdevice is present, set aside space for it */ -#if defined(SOFTDEVICE_PRESENT) - #define MBED_RAM_START 0x200031D0 - #define MBED_RAM_SIZE 0xCE30 -#else - #define MBED_RAM_START 0x20000000 - #define MBED_RAM_SIZE 0x10000 +#if !defined(MBED_RAM_START) + #if defined(SOFTDEVICE_PRESENT) + #define MBED_RAM_START 0x200031D0 + #define MBED_RAM_SIZE 0xCE30 + #else + #define MBED_RAM_START 0x20000000 + #define MBED_RAM_SIZE 0x10000 + #endif #endif #define MBED_RAM0_START MBED_RAM_START diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld index 1d2bdfc7dfb..b793baf3c9b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld @@ -26,12 +26,14 @@ #endif /* If softdevice is present, set aside space for it */ -#if defined(SOFTDEVICE_PRESENT) - #define MBED_RAM_START 0x200031D0 - #define MBED_RAM_SIZE 0xCE30 -#else - #define MBED_RAM_START 0x20000000 - #define MBED_RAM_SIZE 0x10000 +#if !defined(MBED_RAM_START) + #if defined(SOFTDEVICE_PRESENT) + #define MBED_RAM_START 0x200031D0 + #define MBED_RAM_SIZE 0xCE30 + #else + #define MBED_RAM_START 0x20000000 + #define MBED_RAM_SIZE 0x10000 + #endif #endif #define MBED_RAM0_START MBED_RAM_START @@ -189,7 +191,7 @@ SECTIONS PROVIDE(__start_fs_data = .); KEEP(*(.fs_data)) PROVIDE(__stop_fs_data = .); - + *(.jcr) . = ALIGN(4); /* All data end */ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf index de450f55162..03789113c1e 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_IAR/nRF52832.icf @@ -12,12 +12,14 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) { } /* If softdevice is present, set aside space for it */ -if (isdefinedsymbol(SOFTDEVICE_PRESENT)) { - define symbol MBED_RAM_START = 0x200031D0; - define symbol MBED_RAM_SIZE = 0xCE30; -} else { - define symbol MBED_RAM_START = 0x20000000; - define symbol MBED_RAM_SIZE = 0x10000; +if (!isdefinedsymbol(MBED_RAM_START)) { + if (isdefinedsymbol(SOFTDEVICE_PRESENT)) { + define symbol MBED_RAM_START = 0x200031D0; + define symbol MBED_RAM_SIZE = 0xCE30; + } else { + define symbol MBED_RAM_START = 0x20000000; + define symbol MBED_RAM_SIZE = 0x10000; + } } define symbol MBED_RAM0_START = MBED_RAM_START; diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct index 5c61eecdfcb..da9be7a8d5b 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_ARM_STD/nRF52840.sct @@ -9,13 +9,15 @@ #define MBED_APP_SIZE 0x100000 #endif -/* If app_start is 0, do not set aside space for the softdevice */ -#if MBED_APP_START == 0 - #define MBED_RAM_START 0x20000000 - #define MBED_RAM_SIZE 0x40000 -#else - #define MBED_RAM_START 0x20003188 - #define MBED_RAM_SIZE 0x3CE78 +/* If softdevice is present, set aside space for it */ +#if !defined(MBED_RAM_START) + #if defined(SOFTDEVICE_PRESENT) + #define MBED_RAM_START 0x20003188 + #define MBED_RAM_SIZE 0x3CE78 + #else + #define MBED_RAM_START 0x20000000 + #define MBED_RAM_SIZE 0x40000 + #endif #endif #define MBED_RAM0_START MBED_RAM_START diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld index e42984a8741..f496331aa35 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_GCC_ARM/NRF52840.ld @@ -25,13 +25,15 @@ #define MBED_APP_SIZE 0x100000 #endif -/* If app_start is 0, do not set aside space for the softdevice */ -#if MBED_APP_START == 0 - #define MBED_RAM_START 0x20000000 - #define MBED_RAM_SIZE 0x40000 -#else - #define MBED_RAM_START 0x20003188 - #define MBED_RAM_SIZE 0x3CE78 +/* If softdevice is present, set aside space for it */ +#if !defined(MBED_RAM_START) + #if defined(SOFTDEVICE_PRESENT) + #define MBED_RAM_START 0x20003188 + #define MBED_RAM_SIZE 0x3CE78 + #else + #define MBED_RAM_START 0x20000000 + #define MBED_RAM_SIZE 0x40000 + #endif #endif #define MBED_RAM0_START MBED_RAM_START diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52840.icf b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52840.icf index 522e1f5a33b..c681e88e5aa 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52840.icf +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52840.icf @@ -11,13 +11,15 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x100000; } -/* If app_start is 0, do not set aside space for the softdevice */ -if (MBED_APP_START == 0) { - define symbol MBED_RAM_START = 0x20000000; - define symbol MBED_RAM_SIZE = 0x40000; -} else { - define symbol MBED_RAM_START = 0x20003188; - define symbol MBED_RAM_SIZE = 0x3CE78; +/* If softdevice is present, set aside space for it */ +if (!isdefinedsymbol(MBED_RAM_START)) { + if (isdefinedsymbol(SOFTDEVICE_PRESENT)) { + define symbol MBED_RAM_START = 0x20003188; + define symbol MBED_RAM_SIZE = 0x3CE78; + } else { + define symbol MBED_RAM_START = 0x20000000; + define symbol MBED_RAM_SIZE = 0x40000; + } } define symbol MBED_RAM0_START = MBED_RAM_START;