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 Problem with Atmel ICE debugging (Read 3993 times)
Roger13
Newbies
*
Offline


Posts: 6
Joined: Jun 23rd, 2017
Problem with Atmel ICE debugging
Jun 23rd, 2017 at 6:00pm
Print Post  
Hi, I am using Atmel Studio 7 with Visual Micro and an original Atmel ICE debugger. 
Basically everything works fine, I can set breakpoints, single step etc. as expected, but there is a problem when I try to set a breakpoint in a cpp file that is part of the project and has been explicitely added to the solution.
When I try to set a breakpoint there, I get a warning "The breakpoint will not currently be hit. Unable to set requested breakpoint on target."
When I single step to the function where I want to set the breakpoint a copy of the original cpp file opens which appears to be in the user directory, e.g. C:\Users\username\AppData\Local\Temp\VMBuilds... 
In this file I can set the breakpoint and it works.

The problem does not occur if the cpp source file is part of a library.
Is there a way to prevent the use of a copy of the source file and set the breakpoint directly in the original cpp file?

Thanks,
Roger
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Problem with Atmel ICE debugging
Reply #1 - Jun 23rd, 2017 at 6:33pm
Print Post  
Is the .cpp in the project folder or directory below the project?
Does your project have a project_name.cpp?
  
Back to top
WWW  
IP Logged
 
Roger13
Newbies
*
Offline


Posts: 6
Joined: Jun 23rd, 2017
Re: Problem with Atmel ICE debugging
Reply #2 - Jun 23rd, 2017 at 7:50pm
Print Post  
The .cpp is in the same folder as the project, the solution, and the .ino files. The project has no project_name.cpp file, just an project_name.ino file. But in the directory bug1 there is a project_name.cpp file.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Problem with Atmel ICE debugging
Reply #3 - Jun 23rd, 2017 at 7:58pm
Print Post  
Yes there will be one in the temp build folder. Multiple .ino files are combined into a .cpp when compiling arduino.

1)
It is possible you have added the .cpp to the project as a short cut/link? can you right click "remove" the .cpp (not delete) then make sure the "show all files" icon above the solution explorer is clicked, then right click the .cpp in the solution explorer and click "Include in project".

2)
1) might be an issue because atmel is fussy...

If you are using atmel hardware debug with visual micro you should be seeing a message in the output window after building that tells you to add a project_name.cpp to the project, copy your .ino code into .cpp making sure you leave a project_name.ino in the project (even if it is empty).

The tip should tell you to use the project_name.cpp from the build folder as a fully working example containing arduino.h include and prototypes for your .ino code function.

When you have a project_name.cpp visual micro will ignore the .ino source in the project and in that case it has no need for a temp build folder which atmel studio is happier with.

3)
A tip is also to make sure you have click "vmicro>toggle hidden files" so that the arduino core short cuts are added to the project. This should also make the debugger work better.

  
Back to top
WWW  
IP Logged
 
Roger13
Newbies
*
Offline


Posts: 6
Joined: Jun 23rd, 2017
Re: Problem with Atmel ICE debugging
Reply #4 - Jun 23rd, 2017 at 8:58pm
Print Post  
Hi, thank you for your help.
I have meanwhile tried solution #1 -> no success (same behavior as before).
Solution #2 sounds promising, but it will take me some time to try it as there are several .ino files that are obviously missing some includes. 
I will try tomorrow and give you feedback then.
Thank you very much so far!

Roger
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Problem with Atmel ICE debugging
Reply #5 - Jun 23rd, 2017 at 9:09pm
Print Post  
Thanks for the update

You will find that only the one #include arduino.h is required regardless of how many .ino files

The project_name.ino.cpp in the temp build folder has it all, except make sure the tool bar is set to Release and not Debug before building. Then grab the project_name.ino.cpp and rename it to project_name.cpp in the project folder.
  
Back to top
WWW  
IP Logged
 
Roger13
Newbies
*
Offline


Posts: 6
Joined: Jun 23rd, 2017
Re: Problem with Atmel ICE debugging
Reply #6 - Jun 24th, 2017 at 6:14pm
Print Post  
Hi,
I have meanwhile tried solution #2 and it works perfectly.
Thank you very much for your immediate help!!! Smiley Smiley Smiley
Btw: The file in the temp build folder is already named project_name.cpp (not project_name.ino.cpp), so there is no need to rename it.

If anybody else encounters the same problem: here is a summary of the steps to solve the problem:
  • Build a Release version of your project.[\olist]
  • Locate the temporary build folder in the User directory, typically somewhere like Release.
  • Copy the project_name.cpp file into your normal project directory.
  • Now you can build a Debug version of your project.
  • Use the project_name.cpp file for debugging and for further development, not the .ino file. Don't delete the .ino file. It must still be there, though its content is no longer relevant. 

Thanks a lot,
Roger
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Problem with Atmel ICE debugging
Reply #7 - Jun 24th, 2017 at 6:20pm
Print Post  
Thanks. One minor note. You can enable menu item "vMicro>Compiler>Show build folder" which shows a link to the build folder. CTRL+Click to view the folder in the IDE

The Atmel page on VisualMicro.com needs an overhaul and should make the points more clearly.

http://www.visualmicro.com/page/Arduino-for-Atmel-Studio-7.aspx
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint