diff --git a/features/lwipstack/mbed_lib.json b/features/lwipstack/mbed_lib.json index 72e5efc0cd..c5989bb41a 100644 --- a/features/lwipstack/mbed_lib.json +++ b/features/lwipstack/mbed_lib.json @@ -114,7 +114,7 @@ }, "tcpip-thread-stacksize": { "help": "Stack size for lwip TCPIP thread", - "value": 1200 + "value": 2048 }, "default-thread-stacksize": { "help": "Stack size for lwip system threads", diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_ARM_STD/stm32f411re.sct b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_ARM_STD/stm32f411re.sct index eb1e29e13d..597f6fa080 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_ARM_STD/stm32f411re.sct +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_ARM_STD/stm32f411re.sct @@ -29,11 +29,19 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #if !defined(MBED_APP_START) - #define MBED_APP_START 0x08000000 + #ifdef DISABLE_POST_BINARY_HOOK + #define MBED_APP_START 0x08000000 + #else + #define MBED_APP_START 0x08010000 + #endif #endif #if !defined(MBED_APP_SIZE) - #define MBED_APP_SIZE 0x80000 + #ifdef DISABLE_POST_BINARY_HOOK + #define MBED_APP_SIZE 0x80000 + #else + #define MBED_APP_SIZE (0x80000 - 0x10000) + #endif #endif #if !defined(MBED_BOOT_STACK_SIZE) @@ -47,9 +55,10 @@ #define MBED_VECTTABLE_RAM_START (MBED_RAM_START) #define MBED_VECTTABLE_RAM_SIZE 0x198 #define MBED_RAM0_START (MBED_RAM_START + MBED_VECTTABLE_RAM_SIZE) -#define MBED_RAM0_SIZE (MBED_RAM_SIZE- MBED_VECTTABLE_RAM_SIZE) +#define MBED_RAM0_SIZE (MBED_RAM_SIZE - MBED_VECTTABLE_RAM_SIZE) -; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000) +; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000) if not using MTS bootloader +; If using MTS bootloader, FIRST 64 KB FLASH FOR BOOTLOADER, REST 448 KB FLASH FOR APPLICATION LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/NUCLEO_F411RE.ld b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/NUCLEO_F411RE.ld index 1a6b97a139..30801b6a60 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/NUCLEO_F411RE.ld +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/NUCLEO_F411RE.ld @@ -1,11 +1,19 @@ /* Linker script for STM32F411 */ #if !defined(MBED_APP_START) - #define MBED_APP_START 0x08000000 + #ifdef DISABLE_POST_BINARY_HOOK + #define MBED_APP_START 0x08000000 + #else + #define MBED_APP_START 0x08010000 + #endif #endif #if !defined(MBED_APP_SIZE) - #define MBED_APP_SIZE 512K + #ifdef DISABLE_POST_BINARY_HOOK + #define MBED_APP_SIZE 0x80000 + #else + #define MBED_APP_SIZE (0x80000 - 0x10000) + #endif #endif #if !defined(MBED_BOOT_STACK_SIZE) diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_IAR/stm32f411xe.icf b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_IAR/stm32f411xe.icf index a69a7f8500..f26111bbc6 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_IAR/stm32f411xe.icf +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_IAR/stm32f411xe.icf @@ -1,5 +1,7 @@ -if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; } -if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x80000; } +if ((!isdefinedsymbol(MBED_APP_START)) && isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_START = 0x08000000; } +if ((!isdefinedsymbol(MBED_APP_START)) && !isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_START = 0x08010000; } +if ((!isdefinedsymbol(MBED_APP_SIZE)) && isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_SIZE = 0x80000; } +if ((!isdefinedsymbol(MBED_APP_SIZE)) && !isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_SIZE = 0x70000; } /* [ROM = 512kb = 0x80000] */ define symbol __intvec_start__ = MBED_APP_START; diff --git a/targets/targets.json b/targets/targets.json index 6f394f9448..d19dcb07e2 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -4316,6 +4316,10 @@ }, "overrides": { "lse_available": 0 }, "macros_add": ["HSE_VALUE=26000000"], + "post_binary_hook": { + "function": "MTSCode.combine_bins_mts_dragonfly", + "toolchains": ["GCC_ARM", "ARM_STD", "ARM_MICRO", "IAR"] + }, "device_has_add": ["MPU", "FLASH"], "device_has_remove": [ "SERIAL_FC" diff --git a/tools/targets/__init__.py b/tools/targets/__init__.py index 8df0fd5639..ca07f69127 100644 --- a/tools/targets/__init__.py +++ b/tools/targets/__init__.py @@ -404,6 +404,9 @@ class Target(namedtuple( hook_data = self.post_binary_hook except AttributeError: return None + # If hook is null, also return + if hook_data is None: + return None # A hook was found. The hook's name is in the format # "classname.functionname" temp = hook_data["function"].split(".") diff --git a/tools/toolchains/mbed_toolchain.py b/tools/toolchains/mbed_toolchain.py index 2100865f76..9110472267 100755 --- a/tools/toolchains/mbed_toolchain.py +++ b/tools/toolchains/mbed_toolchain.py @@ -255,6 +255,7 @@ class mbedToolchain: "COMPONENT_" + data + "=1" for data in self.target.components ] + # Add extra symbols passed via 'macros' parameter self.cxx_symbols += self.macros @@ -949,6 +950,13 @@ class mbedToolchain: self.ld.append(define_string) self.flags["ld"].append(define_string) + if hasattr(self.target, 'post_binary_hook'): + if self.target.post_binary_hook is None: + define_string = self.make_ld_define( + "DISABLE_POST_BINARY_HOOK", 1) + self.ld.append(define_string) + self.flags["ld"].append(define_string) + # Set the configuration data def set_config_data(self, config_data): self.config_data = config_data