-
Notifications
You must be signed in to change notification settings - Fork 989
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
support for debug/release builds in Arduino IDE 2.x #2159
Comments
Hi @m-mcgowan |
If we implement via the A third option I didn't mention that occurs to me now is to make no change - leave things as they are. This could be acceptable if we document that the "Optimize for Debugging" option does nothing. This wasn't immediately clear to me when I started experimenting with the debug feature. I can appreciate adding the new Optimize for Debugging option with the existing menus is tricky with the limitations of Although debugging is still a "beta" feature, I've been using the debugger quite extensively lately and it seems pretty stable! |
Fixes stm32duino#2159 Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
Hi @m-mcgowan |
Fixes #2159 Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
This is a feature request (which I'm happy to implement) and a request for comments.
Background
Arduino IDE 2.x supports debugging, and with that, has a new menu option Sketch > Optimize for Debugging.
This looks like a convenient way to enable debugging builds with symbols from within the IDE and provides a standard means of compiling a debug build with the CLI.
Under the hood
The
Optimize for Debugging
option sets thecompiler.optimization_flags
placeholder from eithercompiler.optimization_flags.debug
orcompiler.optimization_flags.release
according to the setting chosen. (The debugging section in the platform spec explains this more fully.)boards.txt
currently defines menus for the optimization level, and whether symbols and/or core logs are compiled in. The overlap in functionality between these existing selection and the new "Optimize for Debugging" selection may need to be resolved.Possible Implementation
As a starting point
platform.txt
would have two new placeholders defined, corresponding to the flags used for debug and release builds:The build environment then sets
compiler.optimization_flags
from either of these two, which we could propagate viacompiler.extra_flags
:With this in place, the Debug setting always includes debug symbols, and the Release setting does not include system logs, irrespective of the setting of the
Debug symbols and core logs
menu item. This seems to be the least element of surprise and does "the right thing" for debug and release builds, although it may not be obvious to users that theOptimize for Debugging
menu selection takes precedence over theDebug symbols and core logs
menu selection when it comes to enabling/disabling core logs.Alternatively, the
compiler.optimization_flags.release
value could be left empty, which would mean that a release build uses the selection fromDebug symbols and core logs
exclusively, while the debug build always contains symbols, plus core logs when selected.The latter approach seems somewhat "dangerous" in that it puts the onus on the user to be certain to deselect
core logs
in a release build.If I were asked to make the choice, I would lean more towards the first approach with release builds explicitly excluding core logs, simply because it feels more in line with what a developer would expect for a release build, but that's just my casual suggestion. The community here may see other alternatives, or have good reasons to prefer the second approach, which I look forward to learning about and discussing.
Once we've established the most desirable way forward, I would be happy to make the changes needed and submit a PR.
The text was updated successfully, but these errors were encountered: