Attaching to Target

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

Is there a way to attach the debugger to a target that already has code in Flash? Everytime I open a COF file, it erases and overwrites the flash, thus wiping anything already there.

For example, I'm trying to test the bootloader/firmware interaction. We use the bootloader for field firmware upgrades and we want to return to the bootloader if an upgrade is initiated. If I load the bootloader, then use the bootloader to load the application, I can't do any source level debug of the application. And vice-versa, if I load the application, I can't do source level debug of the bootloader.

I tried disabling the JTAGICE mkII options (i.e. "Don't reprogram device" under the Program Download options), but it always does.

Any suggestions?

Thanks,
Pete

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

Suudy wrote:
I tried disabling the JTAGICE mkII options (i.e. "Don't reprogram device" under the Program Download options), but it always does.

I hate to say this, but "it works for me". I did have problems with this, but I found that I had to change the JTAGICE mkII options while I was IN debug mode.

A couple of other things to look at/try: Are you running the latest version of AVRStudio 4 with Service Pack 4? Also, which device are you trying to debug (although I don't think that matters).

Keep trying. It really does work!

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

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

> I hate to say this, but "it works for me". I did have problems with
> this, but I found that I had to change the JTAGICE mkII options
> while I was IN debug mode.

...which obviously poses a chicken-and-egg problem. If you've got a
device with valuable firmware you wouldn't like to destroy, but didn't
run that option dialog once before, and unchecked that option, but
want to debug a particular device without destroying it *right now*,
you're at a loss.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

But wouldn't it be possible to use the JTAG programming (not debugging) facilities to read the current code to a hex file before trying to make this switch? If the debugger then downloaded the new image it wouldn't matter.

Cliff

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

Still sounds like a crock to me.

With AVaRICE, I can even attach to a completely running target without
restarting the target code. Useful if you've got an application in the
field that is "free-running", but notice it went astray after 24 hours
of operation, so you'd like to see what happened.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Ok, I figured it out.

The problem is that I need to configure a project, turn off the program download, then when re-connecting to the target, open the project file (.aps) instead of the COF.

I was always opening a COF, which creates a new project, which by default reprograms the device. So I'm now using the project files instead.

I agree with dl8dtl, one must be prepared for such a scenario with a pre-configured project. At least make it an option at project creation time. Having to whack a chunk of firmware before being able to connect can be problematic.

And dl8dtl is right again by indicating irritation over the resetting of the target. It is a much more complex process to debug targets when I have to reset them, run until I get a strange failure (assuming it is easily repeatable), then see where things are. I would like the ability to just attach, halt the processor, look at things, and then detach and have the program continue.

Those two things would be my #1 and #2 suggestions for the next release of AVR Studio (assuming #2 is a software issue, i.e. not a requirement when connecting via JTAG).

But things are working fine for me now that I understand the setup. Thanks for the replies!

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

> assuming #2 is a software issue, i.e. not a requirement when connecting via JTAG).

It must be, because as I wrote, AVaRICE (which also uses the JTAG ICE) *can* handle
it.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
It must be, because as I wrote, AVaRICE (which also uses the JTAG ICE) *can* handle it.
I have noticed that when I attach the JTAG ICE mkII to my running app, it will occasionally reset the app. My assumption has been that I get a glitch on the reset line.

Have you see this, Joerg?

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

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

> Have you see this, Joerg?

No, I haven't so far, but it only happens once in a while that I
need to re-attach an ICE to a running application. Normally, the
ICE is not supposed to pull the reset line unless being instructed
so.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
With AVaRICE, I can even attach to a completely running target without restarting the target code. Useful if you've got an application in the field that is "free-running", but notice it went astray after 24 hours of operation, so you'd like to see what happened.

 

Can I trouble you for the exact sequence/setup you use to do this?

 

I have a need to attach to a running target in the field.

 

So far "Attach to Target" has always been grayed out for me.

 

Interface: JTAG

Studio: 7.0.1188

Processor: ATMega1284P

 

I have tried turning off "use external reset" and using "skip programming" to no avail ...

 

Regards,

 

Chuck Hackett

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

12.5 years?  Nearly a record!

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]