Add option to keep post_binary_hook and make it default. It can be disabled by setting it to null

pull/10287/head
Lin Gao 2019-04-25 14:38:36 -05:00
parent 438a52f15a
commit 2c22f549e9
7 changed files with 43 additions and 9 deletions

View File

@ -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",

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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"

View File

@ -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(".")

View File

@ -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