-
Notifications
You must be signed in to change notification settings - Fork 13.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
Update documentation and arduino debug options #8837
Conversation
Describe how to improve Exception Decoder results. Updated build option details.
00da2f9
to
f91d547
Compare
Hmm, maybe the compiler should disable both leaf function handling and sibling call optimization by default when '-Og' is specified. Because the GCC manual entry for that option says first:
|
With
With
Is |
tools/platformio-build.py
Outdated
# | ||
# debug | ||
# | ||
for define in env["CCFLAGS"]: |
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.
definitions are in cppdefines
could use the flattened ones, or loop env[...] but note of possible types (tuple or string)
@d-a-v :
Well, just thought that using '-Og' would generally make debugging less disturbing. From GCC manual again:
|
With other compilers, I have used you get a better matchup between code addresses and the source code when you build with debug option. Would that be true here with -Og? |
I haven't compared the output with 'other compilers'... but I can say that with '-Og' GCC disables some optimizations that make debugging difficult (both machine-independent and dependent, eg. 'constant synthesis' in Xtensa) |
Sounds good to me; however, I have to defer to others for such a change. @d-a-v @earlephilhower |
Updated platform.txt - positioned -Os such that it can be overridden by `build.opt`. Add suggestion of using `-Og` which may improve the Decoder's line number correlation with the problem in the source code. Untested adjustments to platformio-build.py
Previously `-O3` in the example had no effect. It was overridden by later flags. Reording the `-Os` allowed changing optimization to work. Somehow this triggered a new warning "Stream.h:50:7: warning: 'f.Stream::_startMillis' may be used uninitialized in this function". Replaced `-O3` with `-Og`.
Preserves a pathway for `build.opt` override.
Use "Debug Optimization" for menu name. The menu item defines the initial optimization. platform.txt - optimization parameter can be overridden by build.opt.
// Without "-fno-ipa-pure-const", a complete caller list is not on the stack for decoding.
#pragma GCC optimize("Og,no-ipa-pure-const")
// Or this set for -Os
//#pragma GCC optimize("Os,no-inline,no-optimize-sibling-calls,no-ipa-pure-const")
void hideaway() {
asm volatile ("" ::: "a0", "memory");
while(true);
}
void setup() {
Serial.begin(115200);
delay(200);
Serial.printf("\r\n\r\nNow waiting forever ...\r\n");
hideaway();
}
void loop() {} I don't have a lot of experience with the new optimization options to know if this would be a commonly useful option or just a wack-a-mole one-off. Unless someone has some insight into this flag, I am inclined to not change the PR. I think as experience is gained with changing optimization for improved decoding, the refinement list will expand. Maybe later add an |
* Update documentation Describe how to improve Exception Decoder results. Updated build option details. * Added d-a-v's code. And updated description and debug macro. * Update doc Updated platform.txt - positioned -Os such that it can be overridden by `build.opt`. Add suggestion of using `-Og` which may improve the Decoder's line number correlation with the problem in the source code. Untested adjustments to platformio-build.py * Fixed code formatting * Fixed example Previously `-O3` in the example had no effect. It was overridden by later flags. Reording the `-Os` allowed changing optimization to work. Somehow this triggered a new warning "Stream.h:50:7: warning: 'f.Stream::_startMillis' may be used uninitialized in this function". Replaced `-O3` with `-Og`. * Proposed "Debug port" menu change Preserves a pathway for `build.opt` override. * Update boards.txt.py and docs - WIP * Improve organization of optimization content. Use "Debug Optimization" for menu name. The menu item defines the initial optimization. platform.txt - optimization parameter can be overridden by build.opt. * Add fallback value for build.debug_optim to platform.txt * update text and undo changes to platformio-build.py * tweak text * Added ':orphan:' mark to a06-global-build-options.rst * Update doc. Added link in page index to 'Improving Exception Decoder Results' * Update text to reference PR#8868 improvements for leaf function.
Add a section in FAQ for
Improving Exception Decoder Results
Add a description for the
Debug Optimization
menu toideoptions.rst
Added some connecting links between related topics.
Update to
boards.txt.py
to generateboards.txt
with aDebug Optimization
menu.platform.txt
has optimization defaults set bybuild.debug_optim=-Os
The
Debug Optimization
menu selection overrides that.Then an
-O
option inbuild.opt
takes priority over those.No changes to
platformio-build.py
.Status: ready
edited to sync with the current state of the PR