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
  • 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
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Debugging Arduino sketch in Visual Studio 2019 (Read 1219 times)
JessR
Newbies
*
Offline


Posts: 2
Joined: May 23rd, 2023
Debugging Arduino sketch in Visual Studio 2019
May 23rd, 2023 at 8:22am
Print Post  
Hello,
I have written a program in Arduino and trying to switch over development to Visual Studio. I have Visual Studio 2019 and the Visual Micro extension. I'm trying to debug through hardware rather than serial and would like to step through the code. I've had a few issues, including library files being missed and having to add:
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSDK_IncludePath)
to the directories every time I change something. 
I've managed to get the project to build without any issues, however, when I click Build & Upload, I get uploader process failed. I will attach the output. I can program the board via both Arduino and Microchip Studio, so I know it's not a board or programmer issue. I'm using the Atmel-ICE programmer.

Any advice on how to get this working?
Thanks in advance!

Regards,
Jessica
  

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging Arduino sketch in Visual Studio 2019
Reply #1 - May 23rd, 2023 at 11:27am
Print Post  
These properties affect intellisense only and should never need to be added by you. What made you believe they were required?
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSDK_IncludePath)

The arduino ide does not use programmer upload unless you specifically click "Upload using programmer". I suggest you switch off he "always use programmer" button in visual micro so that normal serial upload can resume.

  
Back to top
IP Logged
 
JessR
Newbies
*
Offline


Posts: 2
Joined: May 23rd, 2023
Re: Debugging Arduino sketch in Visual Studio 2019
Reply #2 - May 23rd, 2023 at 12:07pm
Print Post  
Thanks for the reply. Without those properties I get errors that none of the header files can be opened, as in math.h, stdio.h etc. When I add those properties the errors go away.

I always upload using programmer in the arduino IDE. I want to debug via the hardware, not serial.

Thanks.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2441
Joined: Feb 13th, 2019
Re: Debugging Arduino sketch in Visual Studio 2019
Reply #3 - May 23rd, 2023 at 12:58pm
Print Post  
The intellisense errors for math.h / stdio.h should vanish after a build is performed, these files come with the AVR toolchain which is referenced by this board package.

The debugging is separate to the upload aspect, so an upload via Serial can be used, when using the Atmel ICE to debug.

Currently there is no available selection for the Atmel ICE to debug the AtMega328 in Visual Micro as to our understanding fuse bits have to be changed on the chip to allow it to work (either in Atmel Studio or via AvrDude), which many users find complex and can potentially break the chip if done incorrectly. We will review what is being done in the Arduino IDE to see what can be done.

We do have GDBStub available for these boards which runs over the Serial Port, but gives limited GDB functionality without any fuse changes, and allows for stepping through the code line by line, moving breakpoints at runtime etc.
Documentation: https://www.visualmicro.com/page/AVR-Debugging.aspx
  
Back to top
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2441
Joined: Feb 13th, 2019
Re: Debugging Arduino sketch in Visual Studio 2019
Reply #4 - May 23rd, 2023 at 2:16pm
Print Post  
Can you confirm which upload menu item you are using in the Arduino IDE?
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint