Skip to content

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

Merged
merged 3 commits into from
Aug 15, 2019
Merged

Optimize debug profile flags for size #11126

merged 3 commits into from
Aug 15, 2019

Conversation

teetak01
Copy link
Contributor

@teetak01 teetak01 commented Jul 30, 2019

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

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@TeroJaasko @kjbracey-arm @bulislaw

Release Notes

Changed the Debug compiler profile to favor size optimization over speed optimization.

teetak01 added 2 commits July 30, 2019 09:44
Total Static RAM memory (data + bss): 71179(+0) bytes
Total Flash memory (text + data): 665394(-44680) bytes
@ciarmcom ciarmcom requested review from bulislaw, kjbracey, TeroJaasko and a team July 30, 2019 15:00
@ciarmcom
Copy link
Member

@teetak01, thank you for your changes.
@TeroJaasko @kjbracey-arm @bulislaw @ARMmbed/mbed-os-tools @ARMmbed/mbed-os-maintainers please review.

@@ -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",
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

@bulislaw bulislaw left a 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.

@0xc0170 0xc0170 requested a review from pan- August 8, 2019 09:25
@0xc0170
Copy link
Contributor

0xc0170 commented Aug 8, 2019

This needs more approvals.

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.

💯

Copy link
Contributor

@0xc0170 0xc0170 left a 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.

Copy link
Contributor

@kjbracey kjbracey left a 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.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 12, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Aug 12, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_exporter

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 13, 2019

Tracking issue for exporters failure: #11209

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 14, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Aug 14, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 2
Build artifacts

@adbridge adbridge merged commit 3ede2a9 into ARMmbed:master Aug 15, 2019
@teetak01 teetak01 deleted the optimize-debug-profile branch August 15, 2019 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants