-
Notifications
You must be signed in to change notification settings - Fork 3k
rtos: rtx5: ARMCC5: move the variables in .bss.os section to ZI section #7244
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
Conversation
|
This works on my K64F, not tested on other platforms. In practice this will change the relative order of the variables in RAM, but that should not break things. |
d7f863d to
721bacc
Compare
The thread stacks and other large variables in rtx_lib.c were directed to .bss.os section, which puts them to zero initialized section in GCC, but on ARMC5 they were put to data section which consumes precious ROM. In reality the data section compression may make this a NOP change, but it will at least make the total results now more reliable. Effects of this PR on the output of mbed compile of one application: --8<--8<-- --- memory_before_bss_change.txt 2018-06-18 16:45:51.928844313 +0300 +++ memory_after_bss_change.txt 2018-06-18 16:57:27.753532437 +0300 @@ -5,6 +5,9 @@ +----------------------------------------------------------+--------+-------+-------+ | Module | .text | .data | .bss | +----------------------------------------------------------+--------+-------+-------+ @@ -366,7 +369,7 @@ | mbed-os/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_kernel.o | 801 | 164 | 0 | -| mbed-os/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.o | 406 | 2117 | 0 | +| mbed-os/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.o | 406 | 1 | 2116 | | mbed-os/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_memory.o | 260 | 0 | 0 | @@ -412,9 +415,9 @@ -| Subtotals | 163559 | 3380 | 15168 | +| Subtotals | 163559 | 1264 | 17284 | +----------------------------------------------------------+--------+-------+-------+ Total Static RAM memory (data + bss): 18548 bytes -Total Flash memory (text + data): 166939 bytes +Total Flash memory (text + data): 164823 bytes
721bacc to
a25c0ff
Compare
|
@JonatanAntoni Please review |
bulislaw
left a comment
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.
That should be done in RTX not Mbed OS, we try not to modify CMSIS/RTX but pull changes from upstream.
|
@TeroJaasko, can you confirm that you use the linker option |
It isn't at present. The stats for "flash size" are misleading, because of the compression. However, there is actually very little (really) initialised data - so little that the decompression code itself would potentially not be needed for a minimal image, so Tero is partly chasing a potential saving of omitting it. I understand that this will happen automatically once the initialised data is small enough.
The ARM linker works primarily by section attributes, not names, so when you name a section for a data object it has to assume that the named section is potentially initialised - this variable isn't, but maybe something else in the section might be. You need to put the "zeroinit" attribute on to assure it that the entire section is zero-init, not just this variable. |
|
@JonatanAntoni : No, I use just the default Mbed OS' release profile. The same kind of numbers can be reproduced with mbed-os-blinky: Kevin's assessment matches my observations too, although I'm not aiming to get rid of compression code, just to put the binary flash size below target.;) The Flash memory numbers Mbed OS shows do not take the section compression into account, they are just .text+.data numbers added together. Also the padding and compiler generated veneers seems to be omitted, but those are not that meaningful. Just for the reference, here is mbed compile output: and ARMCC's map for same build: |
|
@bulislaw can you provide link for the repo where we should open this PR? |
https://github.com/ARM-software/CMSIS_5/ |
|
@bulislaw : fair enough. Created a PR for CMSIS_5 repo on ARM-software/CMSIS_5#382 |
|
@bulislaw Since the PR is now open against CMSIS, should this one be closed? |
|
@cmonr - Updates from CMSIS to Mbed OS take time, we can merge this PR once it is approved in CMSIS and not wait for full CMSIS/RTX update. |
|
@deepikabhavnani Fine by me. |
|
@deepikabhavnani Any idea how responsive the CMSIS maintainers tend to be? Looking at that repo's activity, I have a feeling this PR will close before any activity is seen in that repo. |
|
Reviving conversation on this PR. Changes are unlikely to be pulled into CMSIS because they're comiler-specific. If we want to bring these in, we'll need to support them as a part of the Mbed OS repo. @JonatanAntoni Does that sound about right? @TeroJaasko @0xc0170 @kjbracey-arm @bulislaw @theotherjimmy @deepikabhavnani @SenRamakri Thoughts? |
|
@c1728p9 Do you know how the CMSIS update PR interacts with this potential fix? Is this PR still needed? |
|
CMSIS update would not be touching this fix, as it is not yet integrated into CMSIS. @TeroJaasko - Shared updated fix by mail, but it is yet not pushed to CMSIS and mbed-os repo. Please apply the update fix to PR's |
|
@deepikabhavnani : CMSIS PR is there: ARM-software/CMSIS_5#407 |
|
@TeroJaasko - Since the fix is approved in CMSIS (ARM-software/CMSIS_5#407 (comment)), we can update and merge here. If you will like to wait for CMSIS merge and update that would be likely in 5.11 (CMSIS updates are merged in mbed-os once every minor release) |
|
As per last update, changes in CMSIS were reverted as it was breaking change for existing projects. |
|
Hi @deepikabhavnani, I admit this is not an ideal situation. Currently we don't see how we could fix this issue. Any solution proposal we discussed so far would lead to negative impact under certain conditions. It looks like there is no global solution to force the sections into ZI memory without touching every occurrence. You can apply the patch (adding Cheers, |
|
Thanks @JonatanAntoni for the update here. I'll close this one. |
Description
The thread stacks and other large variables in rtx_lib.c were directed
to .bss.os section, which puts them to zero initialized section in GCC,
but on ARMC5 they were put to data section which consumes precious ROM.
In reality the data section compression may make this a NOP change,
but it will at least make the total results now more reliable.
Effects of this PR on the output of mbed compile of one application:
Pull request type