mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #8039 from c1728p9/stack_size_framework
Add framework for configuring boot stack sizepull/7948/head
commit
b7cf1abf81
|
@ -19,5 +19,22 @@
|
||||||
"value": 4096
|
"value": 4096
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,10 @@
|
||||||
#define MBED_APP_SIZE 0x100000
|
#define MBED_APP_SIZE 0x100000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
|
#endif
|
||||||
|
|
||||||
#define m_interrupts_start MBED_APP_START
|
#define m_interrupts_start MBED_APP_START
|
||||||
#define m_interrupts_size 0x00000400
|
#define m_interrupts_size 0x00000400
|
||||||
|
|
||||||
|
@ -86,7 +90,7 @@
|
||||||
#if (defined(__stack_size__))
|
#if (defined(__stack_size__))
|
||||||
#define Stack_Size __stack_size__
|
#define Stack_Size __stack_size__
|
||||||
#else
|
#else
|
||||||
#define Stack_Size 0x0400
|
#define Stack_Size MBED_BOOT_STACK_SIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__heap_size__))
|
#if (defined(__heap_size__))
|
||||||
|
@ -122,4 +126,6 @@ LR_IROM1 m_interrupts_start m_text_start+m_text_size-m_interrupts_start { ; lo
|
||||||
}
|
}
|
||||||
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
|
RW_IRAM1 ImageLimit(RW_m_data_2) { ; Heap region growing up
|
||||||
}
|
}
|
||||||
|
ARM_LIB_STACK m_data_2_start+m_data_2_size EMPTY -Stack_Size { ; Stack region growing down
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,12 +53,6 @@ ENTRY(Reset_Handler)
|
||||||
|
|
||||||
__ram_vector_table__ = 1;
|
__ram_vector_table__ = 1;
|
||||||
|
|
||||||
/* With the RTOS in use, this does not affect the main stack size. The size of
|
|
||||||
* the stack where main runs is determined via the RTOS. */
|
|
||||||
__stack_size__ = 0x400;
|
|
||||||
|
|
||||||
__heap_size__ = 0x6000;
|
|
||||||
|
|
||||||
#if !defined(MBED_APP_START)
|
#if !defined(MBED_APP_START)
|
||||||
#define MBED_APP_START 0
|
#define MBED_APP_START 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,6 +61,16 @@ __heap_size__ = 0x6000;
|
||||||
#define MBED_APP_SIZE 0x100000
|
#define MBED_APP_SIZE 0x100000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_BOOT_STACK_SIZE)
|
||||||
|
#define MBED_BOOT_STACK_SIZE 0x400
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* With the RTOS in use, this does not affect the main stack size. The size of
|
||||||
|
* the stack where main runs is determined via the RTOS. */
|
||||||
|
__stack_size__ = MBED_BOOT_STACK_SIZE;
|
||||||
|
|
||||||
|
__heap_size__ = 0x6000;
|
||||||
|
|
||||||
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
|
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
|
||||||
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
|
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
|
||||||
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
|
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
|
||||||
|
@ -259,7 +263,7 @@ SECTIONS
|
||||||
__end__ = .;
|
__end__ = .;
|
||||||
PROVIDE(end = .);
|
PROVIDE(end = .);
|
||||||
__HeapBase = .;
|
__HeapBase = .;
|
||||||
. += HEAP_SIZE;
|
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
|
||||||
__HeapLimit = .;
|
__HeapLimit = .;
|
||||||
__heap_limit = .; /* Add for _sbrk */
|
__heap_limit = .; /* Add for _sbrk */
|
||||||
} > m_data_2
|
} > m_data_2
|
||||||
|
|
|
@ -49,10 +49,6 @@
|
||||||
*/
|
*/
|
||||||
define symbol __ram_vector_table__ = 1;
|
define symbol __ram_vector_table__ = 1;
|
||||||
|
|
||||||
/* Heap 1/4 of ram and stack 1/8 */
|
|
||||||
define symbol __stack_size__=0x8000;
|
|
||||||
define symbol __heap_size__=0x10000;
|
|
||||||
|
|
||||||
if (!isdefinedsymbol(MBED_APP_START)) {
|
if (!isdefinedsymbol(MBED_APP_START)) {
|
||||||
define symbol MBED_APP_START = 0;
|
define symbol MBED_APP_START = 0;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +57,13 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) {
|
||||||
define symbol MBED_APP_SIZE = 0x100000;
|
define symbol MBED_APP_SIZE = 0x100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
|
||||||
|
define symbol MBED_BOOT_STACK_SIZE = 0x400;
|
||||||
|
}
|
||||||
|
|
||||||
|
define symbol __stack_size__=MBED_BOOT_STACK_SIZE;
|
||||||
|
define symbol __heap_size__=0x10000;
|
||||||
|
|
||||||
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
|
define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000400 : 0;
|
||||||
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
|
define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x000003FF : 0;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
"network-default-interface-type": {
|
"network-default-interface-type": {
|
||||||
"help": "Default network interface type. Typical options: null, ETHERNET, WIFI, CELLULAR, MESH",
|
"help": "Default network interface type. Typical options: null, ETHERNET, WIFI, CELLULAR, MESH",
|
||||||
"value": null
|
"value": null
|
||||||
|
},
|
||||||
|
"boot-stack-size": {
|
||||||
|
"help": "Define the boot stack size in bytes. This value must be a multiple of 8",
|
||||||
|
"value": "0x1000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -742,6 +742,15 @@ class mbedToolchain:
|
||||||
except ConfigException:
|
except ConfigException:
|
||||||
pass
|
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
|
# Set the configuration data
|
||||||
def set_config_data(self, config_data):
|
def set_config_data(self, config_data):
|
||||||
self.config_data = config_data
|
self.config_data = config_data
|
||||||
|
@ -753,6 +762,7 @@ class mbedToolchain:
|
||||||
self.ld.append(define_string)
|
self.ld.append(define_string)
|
||||||
self.flags["ld"].append(define_string)
|
self.flags["ld"].append(define_string)
|
||||||
self.add_regions()
|
self.add_regions()
|
||||||
|
self.add_linker_defines()
|
||||||
|
|
||||||
# Creates the configuration header if needed:
|
# Creates the configuration header if needed:
|
||||||
# - if there is no configuration data, "mbed_config.h" is not create (or deleted if it exists).
|
# - if there is no configuration data, "mbed_config.h" is not create (or deleted if it exists).
|
||||||
|
|
Loading…
Reference in New Issue