-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Heap size adjusted to work for both tls-client and mbed-client #3920
Conversation
@@ -17,7 +17,7 @@ define symbol __ICFEDIT_region_CCMRAM_end__ = 0x1000FFFF; | |||
/*-Sizes-*/ | |||
/*Heap 1/2 of ram and stack 1/8*/ | |||
define symbol __ICFEDIT_size_cstack__ = 0x6000; | |||
define symbol __ICFEDIT_size_heap__ = 0x18000; |
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.
is it 1/2 of RAM (comment says so) ? Is it 1/4 as thats usual number ?
Let's make sure this new number works for all reported issues we had within last days, and any future failure shall be a known issue?
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.
Preferably just remove those /*Heap 1/2 of ram and stack 1/8*/
and just tell the numbers, like /* 64kB of HEAP */
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.
Ok
Why do we reserve 24kB of stack? I still feel like we are trying to tune this just for running the TLS example app. |
The heap size requirement depends on the application usage of mbed-client, if application decides to create huge number of resources it will increase the heap usage. So, this number is just to fit the current example application, but if someone wants to extend this application , they will run into problem again. |
mbed 2 that does not use RTOS, and this files come from cmsis and vendors. Thus I assume this is a default value they set it to.
Correct. This is a fix for the last commit that increased static heap size. It broke some apps as @mazimkhan described above. Thus this should be set for very last time to some sensible default, and apps needs to tune it to their needs (workaround until IAR gets dynamic sized heap). Does that sound fine? @mazimkhan Travis CI does not report anything below. please have a look |
/morph test-nightly |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
Seems like a CI error in ci/morph-test-nightly
|
/morph test-nightly |
@mazimkhan Can you rebase this or just do a small change to restart travis? I manually restarted it yesterday, it's green for this PR but does not report back to github, see the results https://travis-ci.org/ARMmbed/mbed-os/jobs/209713138/config |
This commit reverts back only the F429. Not the Ublox, should it be added here also? |
Also, I'm really skeptical that we would ever need 24kB of stack on RTOS environment. This "stack" is not all stacks combined, it is the main stack. All other thread have their own stacks, reserved at compile time (or dynamically). Why did you come up with the number 24kB? How did you measure it? |
@SeppoTakalo you are right. But to be compatible with mbed 2.0 we need to leave this. If it was GCC or ARM where stack is located on top and can grow it was ok to reduce it. But in IAR the stack is in the middle and need to be fixed. Hence 24kB is only left for mbed 2.0 |
Targets NUCLEO_F429ZI and UBLOX_EVK_ODIN_W2 have 192K RAM. Heap size in PR ARMmbed#3871 was increased from 48K to 96K as tls-client example failed with 48K heap. But this resulted in compilation failures in mbed-client that requires 71K for global/static data. Hence this PR reduces heap to 64K that minimum required by tls-client to work. This also meets mbed-client data segment requirements.
Practically stack always grows down, no matter where it is located. (True on ARM, Thumb/Thumb2, X86. Originally ARM supported growing up) But.. This only one of the stacks. That only stands for mbed OS 2, when there are no threads. So far I have spotted following threads inside mbed OS:
As you can see, all these statically allocate their own space for the stack. And are not part of the 24kB you are allocating. And all of the are "in the middle". And all of them are able to run on smaller than 24kB. The 6kB one is the one that calls mbed TLS. Thats why I want to know what requires 24kB on this exact platform. For me, it looks like we are just wasting memory. |
The linker files in this PR are for IAR. Hence we only need to discuss IAR. Please see IAR stack location explained here https://www.iar.com/kr/support/resources/articles/mastering-stack-and-heap-for-system-reliability/ You are right it is complete waste of memory with RTX in mbed-os 5. 24kB is only specific to IAR on mbed-os 2. We don't know how much stack is used by mbed-os 2. |
Your document does not directly apply. RTX threads:
All those allocate their own stack, somewhere from Have I misunderstood now something, you say that |
@SeppoTakalo I understand what you are saying about the RTX and mbed-os 5. But I don't understand what you are proposing for mbed-os 2 to work. If I ask you a hypothetically question: Assume mbed-os 2 needs 24kB of stack. What should we put in the IAR liker file? |
If mbed OS 2 required 24kB, then we put 24kB. |
For optimal case, this should be configurable by application, because it is application depend. Not even platform depend. |
This is exactly what I have said here ARMmbed/mbed-os-example-client#194 (comment) We didn't come up with this number. It was there by default. |
It's part of the linker file that comes from vendors. They define these values and use those in their apps or drivers. In the most cases, these numbers are not changed for mbed in most cases (my assumption as I even did not change those when I ported a target to mbed). |
OK. This PR fixes the build issue we have in |
Result: FAILUREYour command has finished executing! Here's what you wrote!
OutputTest failed! |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Ports for Upcoming Targets 3934: [Silicon Labs] Update to HAL and devices ARMmbed/mbed-os#3934 Known Issues There is an issue with LPC1768 failing the 'Semihost file system' test with this release. Fixes and Changes 3691: [TLS / hw acceleration] AES ECB for NUCLEO_F439ZI ARMmbed/mbed-os#3691 3869: NCS36510: Default range changed from 0 to 950mV - ADC ARMmbed/mbed-os#3869 3893: [STM32F7] Update STM32 Cube version v1.6.0 ARMmbed/mbed-os#3893 3917: Fix mistake register setting in serial_format() ARMmbed/mbed-os#3917 3927: [DELTA_DFBM_NQ620] Add RC calibration setting and revise mbed_overrides.c ARMmbed/mbed-os#3927 3918: [NUC472/M453] Support unique locally administered MAC address and other driver updates ARMmbed/mbed-os#3918 3920: Heap size adjusted to work for both tls-client and mbed-client ARMmbed/mbed-os#3920 3969: NUCLEO_F302R8: Add missing PB_8/PB_9 CAN pins ARMmbed/mbed-os#3969
Description
Targets NUCLEO_F429ZI and UBLOX_EVK_ODIN_W2 have 192K RAM.
Heap size in PR #3871 was increased from 48K to 96K as tls-client
example failed with 48K heap. But this resulted in compilation failures
in mbed-client that requires 71K for global/static data.
Hence this PR reduces heap to 64K that minimum required by tls-client
to work. This also meets mbed-client data segment requirements.
Migrations
If this PR changes any APIs or behaviors, give a short description of what API users should do when this PR is merged.
NO
Related PRs
#3871
Todos
Deploy notes
Notes regarding the deployment of this PR. These should note any
required changes in the build environment, tools, compilers, etc.
Steps to test or reproduce
It should fix issue ARMmbed/mbed-os-example-client#194 (comment)
and build failure mentioned here ARMmbed/mbed-os-example-client#194 (comment)
@0xc0170 @SeppoTakalo