mirror of https://github.com/ARMmbed/mbed-os.git
Add framework for configuring boot stack size
Add the target config option "boot-stack-size" which is passed to the linker as the define "MBED_BOOT_STACK_SIZE" so the linker can adjust the stack accordingly. On mbed 2 the boot stack becomes the main stack after boot. On mbed 5 the boot stack becomes the ISR stack after boot. Because of these different uses the stack size for mbed 2 is set to 4K by default while on mbed 5 it is set to 1k. Additionally, the NRF5X family requires a larger interrupt stack size due to the softdevice so the size is increased to 2k on mbed 5 builds.pull/8039/head
parent
4c996f0efa
commit
1ead033423
|
|
@ -3,5 +3,22 @@
|
|||
"config": {
|
||||
"present": 1
|
||||
},
|
||||
"macros": ["_RTE_"]
|
||||
"macros": ["_RTE_"],
|
||||
"target_overrides": {
|
||||
"*": {
|
||||
"target.boot-stack-size": "0x400"
|
||||
},
|
||||
"MCU_NRF51": {
|
||||
"target.boot-stack-size": "0x800"
|
||||
},
|
||||
"MCU_NRF52840": {
|
||||
"target.boot-stack-size": "0x800"
|
||||
},
|
||||
"MCU_NRF52832": {
|
||||
"target.boot-stack-size": "0x800"
|
||||
},
|
||||
"MCU_NRF51_UNIFIED": {
|
||||
"target.boot-stack-size": "0x800"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
"network-default-interface-type": {
|
||||
"help": "Default network interface type. Typical options: null, ETHERNET, WIFI, CELLULAR, MESH",
|
||||
"value": null
|
||||
},
|
||||
"boot-stack-size": {
|
||||
"help": "Define the boot stack size in bytes. This value must be a multiple of 8",
|
||||
"value": "0x1000"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -742,12 +742,22 @@ class mbedToolchain:
|
|||
except ConfigException:
|
||||
pass
|
||||
|
||||
def add_linker_defines(self):
|
||||
stack_param = "target.boot-stack-size"
|
||||
params, _ = self.config_data
|
||||
|
||||
if stack_param in params:
|
||||
define_string = self.make_ld_define("MBED_BOOT_STACK_SIZE", int(params[stack_param].value, 0))
|
||||
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
|
||||
# new configuration data can change labels, so clear the cache
|
||||
self.labels = None
|
||||
self.add_regions()
|
||||
self.add_linker_defines()
|
||||
|
||||
# Creates the configuration header if needed:
|
||||
# - if there is no configuration data, "mbed_config.h" is not create (or deleted if it exists).
|
||||
|
|
|
|||
Loading…
Reference in New Issue