-
Notifications
You must be signed in to change notification settings - Fork 3k
Optimize debug profile flags for size #11126
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
Total Static RAM memory (data + bss): 71179(+0) bytes Total Flash memory (text + data): 665394(-44680) bytes
@teetak01, thank you for your changes. |
tools/profiles/debug.json
Outdated
@@ -5,7 +5,7 @@ | |||
"-fmessage-length=0", "-fno-exceptions", | |||
"-ffunction-sections", "-fdata-sections", "-funsigned-char", | |||
"-MMD", "-fno-delete-null-pointer-checks", | |||
"-fomit-frame-pointer", "-O0", "-g3", "-DMBED_DEBUG", | |||
"-fomit-frame-pointer", "-O1", "-g3", "-DMBED_DEBUG", |
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.
-Og is what you're looking for.
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.
Thanks @pan- that makes more sense. I changed it to -Og. It only increased the ROM by about 4 kB vs. -O1.
This brings massive ROM savings, and allows to use debug builds also with larger applications (for. ex. Mesh stack). Diff. for mbed-cloud-client-example with Wi-Sun stack. Total Static RAM memory (data + bss): 85120(-216) bytes Total Flash memory (text + data): 592668(-329296) bytes
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.
Looks good for minor release. Can we make sure it doesn't influence full test run results.
This needs more approvals.
💯 |
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.
We've been around this for some time, +1 for the alignment with the client.
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.
Tentative approval, as I'm not really a fan of -Og
.
In practice I've found it to be not as good as advertised. But then, that was with older versions of GCC. Maybe it's improved. And I guess there's nothing stopping anyone from tweaking it to -O0
locally if they need to.
CI started |
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
Tracking issue for exporters failure: #11209 |
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
Adjusts the debug profile to use similar size-optimized configurations.
This allows to compile also larger applications with debug profile. Especially on ROM constrained devices, it often is not possible to use the current speed-optimized profiles.
For example: device management client example with Thread stack (K64F + Thread + GCC)
With default GCC profile => does not fit.
With optimized GCC profile =>
16:01:13 Total Static RAM memory (data + bss): 70300(+70300) bytes
16:01:13 Total Flash memory (text + data): 657209(+657209) bytes
With Wisun stack this saves -321 KiB ROM.
This is similar to changes done for develop profile in #10813
Previously Client has been maintaining its own size-optimized compiler profiles as part of its delivery. It would be better for client to drop those, and Mbed OS to adopt more size-optimized profiles. (https://github.com/ARMmbed/mbed-cloud-client-example/tree/master/profiles).
Pull request type
Reviewers
@TeroJaasko @kjbracey-arm @bulislaw
Release Notes
Changed the Debug compiler profile to favor size optimization over speed optimization.