VS Arduino
>> >> Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
https://www.visualmicro.com/forums/YaBB.pl?num=1499450808

Message started by RLCook on Jul 7th, 2017 at 6:06pm

Title: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 7th, 2017 at 6:06pm
I just recently installed Atmel Studio 7 and added Visual Micro.

I have a custom Leonardo board with a JTAG connection tha I want to develop code for using the Arduino libraries.

I opened Studio 7 and created a new Visual Micro project. To do so, I selected Start->New Project. Then selected "VM Arduino Sketch". I gave it a name and location and proceeded. Ateml Studio created the project and then I got the "Visual Micro - Undo the changes Atmel 7.0 has made?" and selected YES.

I selected vMicro->Toggle Hidden Files.

I selected vMicro->Debugger->Atmel Studio Debugger

I selected vMicro->Uploader->Programmer->Atmel Studio Device Programming

I selected vMicro->Uploader->Always Use Programmer For Upload

I selected vMicro->Add Code->Add Empty Arduino .cpp and Header. Named them Project.cpp and Project.h. Copied setup() and loop() from Project.ino to Project.cpp.

Build Solution: Success.

In Project select Tool->Atmel-ICE->JTAG Interface

Select Debug->Start Debugging and Break. Device Programming window pops up. Select Atmel-ICE; ATmega32U4; JTAG; Apply. Select Memories->Program. Close the programming window.

Debugger loads and starts and I am shown a "Disassembly" tab pointing to address 00000000 (I assume the vector table). Hit Continue. If I Break All it appears to stop running but I cannot set breakpoints anywhere in my source. It acts like it has no idea how the source relates to what was programmed.

What have I done wrong or forgotten to do?

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 7th, 2017 at 6:15pm
If you project is called "Foo" then you need a Foo.cpp and Foo.h not Project.cpp and Project.h




Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 7th, 2017 at 6:18pm

Tim@Visual Micro wrote on Jul 7th, 2017 at 6:15pm:
If you project is called "Foo" then you need a Foo.cpp and Foo.h not Project.cpp and Project.h





I know. The project is named Test2 and the files are Test2.ino, Test2.cpp and Test2.h.

I should have written the original post that way. My mistake...

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 7th, 2017 at 6:32pm
If you right click and view the atmel project properties what is the tool set to

If you put a breakpoint in setup or loop then upload does it break in known sources?

If you just click build do you see a visual micro build output?


Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 7th, 2017 at 7:10pm

Tim@Visual Micro wrote on Jul 7th, 2017 at 6:32pm:
If you right click and view the atmel project properties what is the tool set to

If you put a breakpoint in setup or loop then upload does it break in known sources?

If you just click build do you see a visual micro build output?



Tool is set to Atmel-ICE Interface: JTAG

It does not break in known source. It always stops in a Disassembly tab after pressing "Start Debugging and Break". When I go look at a breakpoint in the cpp source and hover over it I get a message that reads: "The breakpoint will not currently be hit. Unable to set requested breakpoint on target...." and it is a white circle with Red border rather than a solid red circle. If I do a Break All the breakpoint doesn't change. It still shows the same as above. If I Stop Debugging then the breakpoint shows as solid red and I can set more if I want but they never break when I start debugging.

When I press Build I get an Output window that is labeled: "Show output from: Micro Build" and it looks just like the output from a VS2015 build with Visual Micro installed.

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 8th, 2017 at 11:49am
Please zip your .cppproj file and email to info[at]visualmicro.com

Thanks

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 9th, 2017 at 10:29pm

Tim@Visual Micro wrote on Jul 8th, 2017 at 11:49am:
Please zip your .cppproj file and email to info[at]visualmicro.com

Thanks


The requested file is on its way. Good luck and thanks...

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 9th, 2017 at 11:52pm
Have you included the arduino.h in your project_name.cpp?

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 10th, 2017 at 12:17pm

Tim@Visual Micro wrote on Jul 9th, 2017 at 11:52pm:
Have you included the arduino.h in your project_name.cpp?


Yes I did.

I just sent you the entire project directory. There is not much to it.

Larry

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 10th, 2017 at 12:44pm
if you create a new atmel studio gcc app file>new>project without using arduino/visual micro. It can be with a very simple main. Does that upload and break into the main correctly?


Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 10th, 2017 at 12:55pm

Tim@Visual Micro wrote on Jul 10th, 2017 at 12:44pm:
if you create a new atmel studio gcc app file>new>project without using arduino/visual micro. It can be with a very simple main. Does that upload and break into the main correctly?



Yes, it did. In fact I created an Arduino project and let Atmel Studio convert it to their project format and It worked as expected.

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 10th, 2017 at 1:12pm
Thanks, I'll take a look over the next week. Hopefully the arduino convert gives you what you need for now.

One last question is to try debug with visual micro then stop it, switch the output window to Micro Build and copy/paste post the output.

Thanks


Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 10th, 2017 at 1:38pm

Tim@Visual Micro wrote on Jul 10th, 2017 at 1:12pm:
Thanks, I'll take a look over the next week. Hopefully the arduino convert gives you what you need for now.

One last question is to try debug with visual micro then stop it, switch the output window to Micro Build and copy/paste post the output.

Thanks



Output in attached file. It was too large to post.
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=Test2_MicroBuild_Output.txt ( 16 KB | 1 Download )

Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by Visual Micro on Jul 10th, 2017 at 5:18pm
Thanks, it might be related to optimization. The optimization setting is specified in the arduino build instructions for the selected hardware but can be overridden either as a compiler switch or in parts of the code.

What was the size of the atmel studio project after build?


Title: Re: Lost trying to get debugging working with Atmel Studio 7 and Visual Micro
Post by RLCook on Jul 10th, 2017 at 6:02pm

Tim@Visual Micro wrote on Jul 10th, 2017 at 5:18pm:
Thanks, it might be related to optimization. The optimization setting is specified in the arduino build instructions for the selected hardware but can be overridden either as a compiler switch or in parts of the code.

What was the size of the atmel studio project after build?



Which build are you asking about? The Test2 build is just 4k bytes.

My original project build is just 3600 bytes.

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