-
Notifications
You must be signed in to change notification settings - Fork 178
porting: Rename MBED_BOOT_STACK_SIZE to MBED_CONF_TARGET_BOOT_STACK_SIZE #1362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ If you are updating your own linker script, you must: | |
- Arm - The boot stack is the `ARM_LIB_STACK` region. | ||
- GCC_ARM - The boot stack starts at the symbol `__StackLimit` and ends at the symbol `__StackTop`. | ||
- Add defines for a relocatable application - `MBED_APP_START` and `MBED_APP_SIZE`. | ||
- Add the define for boot stack size - `MBED_BOOT_STACK_SIZE`. | ||
- Add the define for boot stack size - `MBED_CONF_TARGET_BOOT_STACK_SIZE`. | ||
- Add preprocessing directive `#! armcc -E` (ARM compiler only). | ||
|
||
If you are using the below linker script, then you need to update all the defines in the `/* Device specific values */` section for your target. | ||
|
@@ -54,9 +54,9 @@ If you are using the below linker script, then you need to update all the define | |
#define MBED_APP_SIZE MBED_ROM_SIZE | ||
#endif | ||
|
||
#if !defined(MBED_BOOT_STACK_SIZE) | ||
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really useful? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intended (and likely desired) behavior here is to prefer MBED_CONF_TARGET_BOOT_STACK_SIZE if present, and to fall back to MBED_BOOT_STACK_SIZE if not. If MBED_BOOT_STACK_SIZE is not defined, then we fall back to a hard-coded value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I can see this :-) |
||
/* This value is normally defined by the tools to 0x1000 for bare metal and 0x400 for RTOS */ | ||
#define MBED_BOOT_STACK_SIZE 0x400 | ||
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400 | ||
#endif | ||
|
||
/* Round up VECTORS_SIZE to 8 bytes */ | ||
|
@@ -74,10 +74,10 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { | |
.ANY (+RW +ZI) | ||
} | ||
|
||
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_START + MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE - AlignExpr(ImageLimit(RW_IRAM1), 16)) { ; Heap growing up | ||
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_START + MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE - AlignExpr(ImageLimit(RW_IRAM1), 16)) { ; Heap growing up | ||
} | ||
|
||
ARM_LIB_STACK (RAM_START + RAM_SIZE) EMPTY -MBED_BOOT_STACK_SIZE { ; Stack region growing down | ||
ARM_LIB_STACK (RAM_START + RAM_SIZE) EMPTY -MBED_CONF_TARGET_BOOT_STACK_SIZE { ; Stack region growing down | ||
} | ||
} | ||
``` | ||
|
@@ -102,10 +102,10 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) { | |
define symbol MBED_APP_SIZE = MBED_ROM_SIZE; | ||
} | ||
|
||
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) { | ||
if (!isdefinedsymbol(MBED_CONF_TARGET_BOOT_STACK_SIZE)) { | ||
/* This value is normally defined by the tools | ||
to 0x1000 for bare metal and 0x400 for RTOS */ | ||
define symbol MBED_BOOT_STACK_SIZE = 0x400; | ||
define symbol MBED_CONF_TARGET_BOOT_STACK_SIZE = 0x400; | ||
} | ||
|
||
/* Round up VECTORS_SIZE to 8 bytes */ | ||
|
@@ -117,7 +117,7 @@ define memory mem with size = 4G; | |
define region ROM_region = mem:[from MBED_APP_START size MBED_APP_SIZE]; | ||
define region RAM_region = mem:[from RAM_REGION_START size RAM_REGION_SIZE]; | ||
|
||
define block CSTACK with alignment = 8, size = MBED_BOOT_STACK_SIZE { }; | ||
define block CSTACK with alignment = 8, size = MBED_CONF_TARGET_BOOT_STACK_SIZE { }; | ||
define block HEAP with alignment = 8, size = HEAP_SIZE { }; | ||
|
||
initialize by copy { readwrite }; | ||
|
@@ -150,10 +150,10 @@ GCC linker script template: | |
#define MBED_APP_SIZE MBED_ROM_SIZE | ||
#endif | ||
|
||
#if !defined(MBED_BOOT_STACK_SIZE) | ||
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE) | ||
/* This value is normally defined by the tools | ||
to 0x1000 for bare metal and 0x400 for RTOS */ | ||
#define MBED_BOOT_STACK_SIZE 0x400 | ||
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400 | ||
#endif | ||
|
||
/* Round up VECTORS_SIZE to 8 bytes */ | ||
|
@@ -300,7 +300,7 @@ SECTIONS | |
__end__ = .; | ||
PROVIDE(end = .); | ||
*(.heap*) | ||
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE; | ||
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_CONF_TARGET_BOOT_STACK_SIZE; | ||
__HeapLimit = .; | ||
} > RAM | ||
|
||
|
@@ -315,7 +315,7 @@ SECTIONS | |
/* Set stack top to end of RAM, and stack limit move down by | ||
* size of stack_dummy section */ | ||
__StackTop = ORIGIN(RAM) + LENGTH(RAM); | ||
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE; | ||
__StackLimit = __StackTop - MBED_CONF_TARGET_BOOT_STACK_SIZE; | ||
PROVIDE(__stack = __StackTop); | ||
|
||
/* Check if data + heap + stack exceeds RAM limit */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, indicate that define has to be define in rtos json lib config ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this is required to specified in the Mbed config. The linkerscript can specify a fallback value. I may be wrong about this being optional, though.