-
Notifications
You must be signed in to change notification settings - Fork 3k
MCUXpresso: Update ARM linker files to eliminate reserving RAM for stack & heap #4137
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
MCUXpresso: Update ARM linker files to eliminate reserving RAM for stack & heap #4137
Conversation
@mmahadevan108 Again, this is fine for mbed 5 ,but some of these targets that you are changing are enabled for mbed 2 (non rtos applications). |
Is there a way to do this for mbed 5 only. We are wasting memory as this is handled in the RTOS as well. |
What about using MBED_CONF_RTOS_PRESENT given the linkers now support preprocessing? |
This change is relevant to both mbed 2 and 5. Even when the rtos is not present the heap and stack are determined at runtime, similar to with the rtos. These sizes can be decreased, but it would probably be good to set them to non-zero values so you get a compile time error, rather than runtime, on both 2 and 5 if your program is too big. Something like ~1k for both should be sufficient. |
What happens to the symbols defined for the heap in the linker scripts, are they not used ie wasted space? |
These defines aren't used to set the size of a dedicated heap region. Instead they are subtracted off the max size of the RW data section so you have at least |
Thanks Russ. Why do we need this free space? |
This space is for the stack and the heap. If it isn't big enough then the stack will grow into valid data and clobber it leading to a crash. |
I am confused. I thought the stack & heap space is reserved in the RTOS file for both mbed 2 & 5. |
With the ARM compiler the free space starts at the end of RW_IRAM1 and goes to the end of the RAM bank. This is the case both for mbed 2 and mbed 5. |
Thanks Russ. Some of the platform linker files for ARM compiler do not have __stack & __heap defined and no space is not reserved. Setting these to 0 would result in a similar environment. |
It works with the size set to zero, you just get a runtime error rather than a compile time error if your program is too big. If the scatter file has support for this extra level of checking why not use it? |
I understand. I will reduce the stack & heap size but not make them 0. |
…& heap Heap and stack size is determined via the RTOS. Signed-off-by: Mahadevan Mahesh <[email protected]>
d7ab045
to
5b866b7
Compare
Thanks for the update @mmahadevan108. This PR looks good to me. |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Ports for Upcoming Targets Fixes and Changes 4008: [NUC472/M453] Support Bootloader and FlashIAP ARMmbed/mbed-os#4008 4102: Add SCL and SDA defs for I2C[0-2]; redefine I2C_[SCL,SDA] to I2C2 ARMmbed/mbed-os#4102 4118: STM32F4 Internal ADC channels rework ARMmbed/mbed-os#4118 4126: STM32F4 : remove SERIAL_TX and SERIAL_RX from available pins ARMmbed/mbed-os#4126 4148: Revert "STM32F4 Internal ADC channels rework" ARMmbed/mbed-os#4148 4152: STM32F4 Internal ADC channels rework ARMmbed/mbed-os#4152 4074: [Silicon Labs] Update pinout ARMmbed/mbed-os#4074 4133: U-BLOX_C030: Default XTAL is now 12MHz onboard. Option to use Debug 8MHz ARMmbed/mbed-os#4133 4142: EFM32: Fixed `pwmout_all_inactive` being inversed ARMmbed/mbed-os#4142 4016: [NRF5]: fix rtc overflow-while-set-timestamp issue ARMmbed/mbed-os#4016 4031: STM32 increase IAR heap size for big RAM targets ARMmbed/mbed-os#4031 4137: MCUXpresso: Update ARM linker files to eliminate reserving RAM for stack & heap ARMmbed/mbed-os#4137 4176: STM32L4 Internal ADC channels rework ARMmbed/mbed-os#4176 4154: STM32F7 Internal ADC channels rework ARMmbed/mbed-os#4154 4174: [NRF52840]: fix rtc overflow-while-set-timestamp issue ARMmbed/mbed-os#4174 4180: [UBLOX_C030] create target hierarchy for the specific versions of the C030 board ARMmbed/mbed-os#4180 4153: STM32F2: Internal ADC channels rework ARMmbed/mbed-os#4153
Description
Update ARM linker files to eliminate reserving RAM for stack & heap. Heap and stack size is determined via the RTOS. This should fix the below issue:
#3763
Status
**READY
Ran & passed mbed-os tests.