Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Selecting GDBstub attaches -O-flags to build.vm.extra_flags (Read 869 times)
Danie1
Newbies
*
Offline



Posts: 4
Selecting GDBstub attaches -O-flags to build.vm.extra_flags
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
Back to top
« Last Edit: Jan 12th, 2022 at 10:51am by Danie1 »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1578
Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Reply #1 - 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...
Back to top
 
 
IP Logged
 
Danie1
Newbies
*
Offline



Posts: 4
Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Reply #2 - 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...

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
Back to top
 
 
IP Logged
 
Danie1
Newbies
*
Offline



Posts: 4
Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Reply #3 - 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.
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1578
Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Reply #4 - 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=

 


Back to top
 
 
IP Logged
 
Danie1
Newbies
*
Offline



Posts: 4
Re: Selecting GDBstub attaches -O-flags to build.vm.extra_flags
Reply #5 - 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
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print