VS Arduino
>> >> Selecting GDBstub attaches -O-flags to build.vm.extra_flags
https://www.visualmicro.com/forums/YaBB.pl?num=1641984222

Message started by Daniel Kr on Jan 12th, 2022 at 10:43am

Title: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Post by Daniel Kr on Jan 12th, 2022 at 10:43am
Hi all,
first of all, Visual Micro is a great tool. Using Visual Studio for developing and debugging my projects (Arduino on Teensy 4.1) is a charm!
But I found an issue where I am not able to find a workaround, hopefully you can help me:
Attached you find two files

  • debug-hardware-gdbstub: I selected the gdb stub with "No Project + Library Optimization" in the Debug toolbar.
  • debug-off: I selected the off-option with same optimization level.


I want to use the gdb stub variant but my issue is that this option automagically adds options to the build.vm.extra_flags for all three types core, library and project:
These are my options I have defined by myself and are used with Debug:off

Code (javascript):

build.vm.extra_flags.core=-Os
build.vm.extra_flags.library=-Os

These are the options when I select the gdbstub:

Code (javascript):

build.vm.extra_flags.core=-Os  -Og
build.vm.extra_flags.library=-Os  -Og
build.vm.extra_flags.project= -Og

As you can see, the -Og override my -Os which I need to put everything onto the teensy (see teensy-size output).

I have not found a setting to eliminate the "-Og" at the end. I do not want to debug the core and library so I would be happy to have an option to switch the "-Og" off also for gdbstub.
Can you help me here?

I am using Visual Studio 2022 Community, Arduino IDE 1.8.19 and Teensyduino 1.56. So https://www.visualmicro.com/forums/YaBB.pl?num=1640379082 does not help in my case.

Best Regards
Daniel
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=debug-hardware-gdbstub.txt ( 140 KB | 4 Downloads )
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=debug-off.txt ( 1267 KB | 3 Downloads )

Title: Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Post by Simon@Visual Micro on Jan 12th, 2022 at 12:06pm
Thanks for the report.

If Hardware Debugging is enabled then the -Og flag is automatically added last, and this cannot be overridden at present.  We can look a way of altering this in the future.

The best alternative to the GDBStub will be to use the Serial Debugger in vMicro in the interim:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-Walkthrough-Start.html

Title: Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Post by Danie1 on Jan 12th, 2022 at 12:37pm

Simon@Visual Micro wrote on Jan 12th, 2022 at 12:06pm:
Thanks for the report.

If Hardware Debugging is enabled then the -Og flag is automatically added last, and this cannot be overridden at present.  We can look a way of altering this in the future.

The best alternative to the GDBStub will be to use the Serial Debugger in vMicro in the interim:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-Walkthrough-Start.html

Thanks for the quick answer. A configurable option here would be highly appreciated as the teensy even has its own settings (which I can modify easily).
Best Regards
Daniel

Title: Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Post by Danie1 on Jan 12th, 2022 at 12:59pm
An while you are working in that area:
Selecting hardware debugging and "No Optimization" adds "-O0" to the extra flags, resulting in "-Os-O0" in my case (notice the missing space). All other options add " -O..." with the extra space.

Title: Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Post by Simon@Visual Micro on Jan 13th, 2022 at 1:17pm
This has been made available in the latest release 21.11.08-14, available from the top of the below board:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

This allows you to override (or remove) the -Og flag which is added during the Hardware Debug compilation.

This can be done by adding a local board.txt (vMicro > Add Code > Add Local board.txt), and adding the below property:
[code]
# Alter or remove Optimization for Hardware Debugging
# Can be used in Conjunction with Project Properties > Configuration Defines

# Default is -Og
# ide.compiler_flags_debug=-Og

# Remove added flags by setting to blank:
ide.compiler_flags_debug=

[/code]

Title: Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Post by Danie1 on Jan 13th, 2022 at 1:29pm
Absolutely amazing, thanks for the super fast update. I can confirm that my problem is now solved.
Thanks
Daniel

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.