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 Atmel ICE debugging with symbolic infomation (Read 7259 times)
Chris O
Newbies
*
Offline


Posts: 4
Joined: Jan 13th, 2015
Atmel ICE debugging with symbolic infomation
Jan 13th, 2015 at 4:34pm
Print Post  
I have VM install in Atmel studio and have a question about supporting the ATMEL ICE. If I build an Arduino project using VM, I can load the .elf output file using the Open menu’s Open Object File for Debugging option. Everything loads and source code is found, and I can use the Atmel ICE JTAG debugger to load and step code. The only  problem with this is there is no symbolic information for the debugger, so it can’t display data watch information. I believe there is a linker option most likely enabled (-s) that is suppressing this information from being included in the .elf output file. My questions are.

If I upgrade to the version of VM that supports the usb serial debugger, will symbolic information be included in the output file?

Are there any plans for VM to support the Atmel ICE debugger? From what I can tell there is very little it would have to do to directly support this. (set complier/linker options to include symbol information and tie into Atmel studio such that it can directly start debugging) I would gladly pay the $30.00 for this tool if it allows me to use the Atmel ICE. They have a version of this tool for $50 plus $18 for shipping and to have a hardware debugging solution for under $100 for Arduino is huge, IMO. 
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Atmel ICE debugging with symbolic infomation
Reply #1 - Jan 13th, 2015 at 4:56pm
Print Post  
Paying for vm won't help.

If you want to alter the properties of the .elf that Visual Micro creates you can do that as long as you are using a 1.5.x build of Arduino.

Edit the arduinoide/hardware/arduino/avr/arduino/platform.txt. Find the .recipe or pattern property for the linked and change as required.

This will unfortunately affect all compilations but if you have the mind you can create a new board definition in boards.txt (same folder) and use additional properties as {merge fields} in the platform.txt. This would allow you to have two copies of the same board, one with debug and one without
  
Back to top
IP Logged
 
Chris O
Newbies
*
Offline


Posts: 4
Joined: Jan 13th, 2015
Re: Atmel ICE debugging with symbolic infomation
Reply #2 - Jan 16th, 2015 at 3:23am
Print Post  
Thank you very much for that information. It can be hard to find this kind of thing at times.
  
Back to top
 
IP Logged
 
Berni
Newbies
*
Offline


Posts: 9
Joined: Jan 19th, 2015
Re: Atmel ICE debugging with symbolic infomation
Reply #3 - Jan 29th, 2015 at 1:55pm
Print Post  
Hi Chris,

were you able to figure out how to enable the symbolic information when using the elf file?

Thanks.
  
Back to top
 
IP Logged
 
Berni
Newbies
*
Offline


Posts: 9
Joined: Jan 19th, 2015
Re: Atmel ICE debugging with symbolic infomation
Reply #4 - Jan 30th, 2015 at 4:55pm
Print Post  
I am not sure, but I think I have found a solution.
This is highly experimental! It is a starting point for your own experiments.

I am using the new Atmel-ICE with an Arduino DUE (SAM3X8E) and I have changed

C:\Program Files (x86)\Arduino\hardware\arduino\sam\platform.txt

There are three compiler switch definitions which I have changed:

compiler.c.flags
compiler.S.flags
compiler.cpp.flags

In each line I have changed "-g" to "-g3" and added "-gdwarf-2"

So from "-g"    to    "-g3 -gdwarf-2".

Now, if I use "Open Object File for Debugging" in Atmel Studio and choose the generated elf file, generate debugging solution, I can debug with symbolic information. 
Works great for me.

This might work for the AVR section in Arduino also, because there are similar compiler flags in the platform.txt.

It would be nice if someone is able to test and confirm this.

Please keep in mind, that code optimization can eliminate symbols/variables/code, so debugging could look strange. 

Another problem: The Arduino delay function is not save for debugging because in some situations (with active ICE) it never returns and the Atmel-ICE is watching forever.

All these problems do not exist with the Visual Micro debugger. So there are some real advantages using the Visual Micro USB debugger with Arduino sketches.
« Last Edit: Jan 30th, 2015 at 5:01pm by Berni »  
Back to top
 
IP Logged
 
Chris O
Newbies
*
Offline


Posts: 4
Joined: Jan 13th, 2015
Re: Atmel ICE debugging with symbolic infomation
Reply #5 - Feb 1st, 2015 at 5:37am
Print Post  
A quick story: I did a lot of messing with this after hearing back from VM on this. I looked at the options Atmel Studio used with their system, etc. I had add the -g3 option and actually had something working using the Adafruit capacitive touch demo library. It looked as if the main file and added c/cpp files worked but libraries did not. That made sense to me since libs were not compiled with that option. So off I set on my project; but, when I got into things, once again, no variable information:(  Well, I went out of town for a couple days and got back today. It was on my list to look at this again, but I thought I would check in on this forum. I am sooooo glad I did. I went back and again modified the platform.txt file to add the -gdwarf-2 option. I rebuilt my app and it worked!!! I had looked at those options, but thought that was for a different output format. Thank you so much for replying back to this Berni; I don't think I would have tried those options without seeing this. 

I did notice the delay function use can cause problems. I had not looked into that yet, but I was suspecting it was interrupt related with the interrupts not getting reenabled or something. I have seen an option before in debuggers including Atmel Studio to stop timers when the debugger stops, but that does not seem to be an option when loading an object file for debug. It is not that the ICE does not return if you mean your breakpoint does not get hit. It is just stuck in the delay operation from what I can tell. 

Thanks again Berni
  
Back to top
 
IP Logged
 
Berni
Newbies
*
Offline


Posts: 9
Joined: Jan 19th, 2015
Re: Atmel ICE debugging with symbolic infomation
Reply #6 - Feb 1st, 2015 at 5:43pm
Print Post  
Thank you very much for your confirmation. I did a lot of research in many different forums and a lot of testing. I am glad that it was worth the effort, also for you.

Yes, sometimes the Arduino delay function never returns.

The delay_ms of the Atmel ASF libs works completely different and it seems their solution does not cause these problems.

There is some research necessary.



« Last Edit: Feb 1st, 2015 at 5:45pm by Berni »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint