Debugging ATxmega256A3U via PDI - is it possible?

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,
I have inherited a project and want to use PDI to debug an xmega256A3U. (by 'debug' I mean - single step, set breakpoints, view variables)

I have tried with AVRStudio4.19 + JTAGICE MkII as well as AS6 + JTAG3 without success.

FWIW: I am able to program the xmega via PDI without problems.

Has anyone had success in debugging xmegas via PDI?
(Is it even supported?)

Thanks in Advance
Ivan Vernot

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I have debugged that exact part with PDI. I've had no problems.

It looks like your project is set up to compile for a 128A3U instead of a 256A3U. Have you tried changing that?

Jeff Nichols

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The answer should be a qualified "yes".

If you are using assembler - absolutely
If you are using C - Mostly, or with some effort.

If you can afford to turn off ALL optimization, you will have some good chance of successes. (warning - there a some folks that think doing this is not a wise idea)

If you must leave some optimization on, then your best hope is to drop to the compiled code (view assembly). The C code will appear to randomly branch to locations, execute an assignment (or what looks like an assignment) but the variable will not change and other strange behavior.

It's hard to say if this is a debugging issue (my opinion), a compiler issue or just the way things work, but the line numbers seem to get a bit confessed what the processor is really executing and what statement the debugger is on in the source code.

I'm sure others will have other opinions and experiences, but that's my $0.02 worth.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

or just the way things work,

That.

Optimization and the importance of volatile in GCC

Personally I don't see the problem debugging optimized code as long as you have a fair understanding of the compilers code generation model and how it may be re-ordering/splitting code, caching variables to registers and stuff like that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To me, the debug line numbers should have matched with debuggers line numbers.

I've worked in other environments that the debugger will actually follow the C code even with the optimization on. You are correct, you can work around it, but when you do this, your focus changes from your end product to the process. Seems to add a a level of indirection I would rather not deal with.

I guess that happens with age - you hope the tools will work so I don't have to. :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My guess is you're seeing a problem stemming from jump relaxation in the linker causing a shift in code addresses. Do a forum search for relax or mrelax and it should bring up some solutions.

Jeff Nichols

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Do a forum search for relax or mrelax and it should bring up some solutions.

As far as I know the current solution is "don't use relax" ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Has anyone had success in debugging xmegas via PDI?
I have used the xmega256A3BU on the xmega256A3BU Xplain board with PDI and JTAGmk3.

edit I see you have been burning the midnight oil posting in the middle of the night. :-)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have used the ATXMega128A3U in 3 designs so far.
No problem with debugging that have to do with the MCU.

But installing Studio 6.1 made me too burn the midnight oil! Don't upgrade the day before you need to show the customer where the project is at! A lot of up and downgrading of JTAGICE3 boxes that evening. (And finally back to Studio6.0 so I could get to bed before sunrise).

On the first PCB I also had a JTAG interface, but after that I left it out as PDI works just fine.

I also used ATXmega256A3U on some of these boards as I was out of 128's. As mentioned you need to be alert to what chip you actually have on your board. But I believe that have little to do with PDI or not.

Einar Sjaavik

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All, thank you all for such great feedback.
After hours of frustration, in desperation I installed a AS6.1 on another machine and it all just started working!
Thank you again for your help.
Regards
Ivan Vernot