Skip to content

Commit 2c22f54

Browse files
committed
Add option to keep post_binary_hook and make it default. It can be disabled by setting it to null
1 parent 438a52f commit 2c22f54

File tree

7 files changed

+43
-9
lines changed

7 files changed

+43
-9
lines changed

features/lwipstack/mbed_lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
},
115115
"tcpip-thread-stacksize": {
116116
"help": "Stack size for lwip TCPIP thread",
117-
"value": 1200
117+
"value": 2048
118118
},
119119
"default-thread-stacksize": {
120120
"help": "Stack size for lwip system threads",

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_ARM_STD/stm32f411re.sct

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,19 @@
2929
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3030

3131
#if !defined(MBED_APP_START)
32-
#define MBED_APP_START 0x08000000
32+
#ifdef DISABLE_POST_BINARY_HOOK
33+
#define MBED_APP_START 0x08000000
34+
#else
35+
#define MBED_APP_START 0x08010000
36+
#endif
3337
#endif
3438

3539
#if !defined(MBED_APP_SIZE)
36-
#define MBED_APP_SIZE 0x80000
40+
#ifdef DISABLE_POST_BINARY_HOOK
41+
#define MBED_APP_SIZE 0x80000
42+
#else
43+
#define MBED_APP_SIZE (0x80000 - 0x10000)
44+
#endif
3745
#endif
3846

3947
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -47,9 +55,10 @@
4755
#define MBED_VECTTABLE_RAM_START (MBED_RAM_START)
4856
#define MBED_VECTTABLE_RAM_SIZE 0x198
4957
#define MBED_RAM0_START (MBED_RAM_START + MBED_VECTTABLE_RAM_SIZE)
50-
#define MBED_RAM0_SIZE (MBED_RAM_SIZE- MBED_VECTTABLE_RAM_SIZE)
58+
#define MBED_RAM0_SIZE (MBED_RAM_SIZE - MBED_VECTTABLE_RAM_SIZE)
5159

52-
; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000)
60+
; STM32F411RE: 512 KB FLASH (0x80000) + 128 KB SRAM (0x20000) if not using MTS bootloader
61+
; If using MTS bootloader, FIRST 64 KB FLASH FOR BOOTLOADER, REST 448 KB FLASH FOR APPLICATION
5362
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
5463

5564
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_GCC_ARM/NUCLEO_F411RE.ld

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
/* Linker script for STM32F411 */
22

33
#if !defined(MBED_APP_START)
4-
#define MBED_APP_START 0x08000000
4+
#ifdef DISABLE_POST_BINARY_HOOK
5+
#define MBED_APP_START 0x08000000
6+
#else
7+
#define MBED_APP_START 0x08010000
8+
#endif
59
#endif
610

711
#if !defined(MBED_APP_SIZE)
8-
#define MBED_APP_SIZE 512K
12+
#ifdef DISABLE_POST_BINARY_HOOK
13+
#define MBED_APP_SIZE 0x80000
14+
#else
15+
#define MBED_APP_SIZE (0x80000 - 0x10000)
16+
#endif
917
#endif
1018

1119
#if !defined(MBED_BOOT_STACK_SIZE)

targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/device/TOOLCHAIN_IAR/stm32f411xe.icf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; }
2-
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x80000; }
1+
if ((!isdefinedsymbol(MBED_APP_START)) && isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_START = 0x08000000; }
2+
if ((!isdefinedsymbol(MBED_APP_START)) && !isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_START = 0x08010000; }
3+
if ((!isdefinedsymbol(MBED_APP_SIZE)) && isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_SIZE = 0x80000; }
4+
if ((!isdefinedsymbol(MBED_APP_SIZE)) && !isdefinedsymbol(DISABLE_POST_BINARY_HOOK)) { define symbol MBED_APP_SIZE = 0x70000; }
35

46
/* [ROM = 512kb = 0x80000] */
57
define symbol __intvec_start__ = MBED_APP_START;

targets/targets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4316,6 +4316,10 @@
43164316
},
43174317
"overrides": { "lse_available": 0 },
43184318
"macros_add": ["HSE_VALUE=26000000"],
4319+
"post_binary_hook": {
4320+
"function": "MTSCode.combine_bins_mts_dragonfly",
4321+
"toolchains": ["GCC_ARM", "ARM_STD", "ARM_MICRO", "IAR"]
4322+
},
43194323
"device_has_add": ["MPU", "FLASH"],
43204324
"device_has_remove": [
43214325
"SERIAL_FC"

tools/targets/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ def get_post_build_hook(self, toolchain_labels):
404404
hook_data = self.post_binary_hook
405405
except AttributeError:
406406
return None
407+
# If hook is null, also return
408+
if hook_data is None:
409+
return None
407410
# A hook was found. The hook's name is in the format
408411
# "classname.functionname"
409412
temp = hook_data["function"].split(".")

tools/toolchains/mbed_toolchain.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def get_symbols(self, for_asm=False):
255255
"COMPONENT_" + data + "=1"
256256
for data in self.target.components
257257
]
258+
258259
# Add extra symbols passed via 'macros' parameter
259260
self.cxx_symbols += self.macros
260261

@@ -949,6 +950,13 @@ def add_linker_defines(self):
949950
self.ld.append(define_string)
950951
self.flags["ld"].append(define_string)
951952

953+
if hasattr(self.target, 'post_binary_hook'):
954+
if self.target.post_binary_hook is None:
955+
define_string = self.make_ld_define(
956+
"DISABLE_POST_BINARY_HOOK", 1)
957+
self.ld.append(define_string)
958+
self.flags["ld"].append(define_string)
959+
952960
# Set the configuration data
953961
def set_config_data(self, config_data):
954962
self.config_data = config_data

0 commit comments

Comments
 (0)