avr-gdb, assembly, and JTAG

View: New views
18 Messages — Rating Filter:   Alert me  

avr-gdb, assembly, and JTAG

by Marge Coahran-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can avr-gdb/avarice be used with source written in assembly (eg, can gdb
display values stored in specific registers)? The code would be assembled
with avra.

Also, do I understand correctly that to use JTAG in a Linux environment, I
first need to use ISP once to enable the JTAGEN fuse, but thereafter the
fuse can remain enabled over a sequence of program and debug sessions?

For context, I teach a course in Computer Organization and Architecture
using the AVR, and I specifically want students to work in assembly for
the insight it gives into the inner workings of the processor. I have a
set of STK500's and Dragons for this. I currently have Atmega8515L chips
that came with the STK500's, but I am considering moving to ATmega16L
for JTAG support. (I think debugWIRE is probably not feasible for this
because, if I understand correctly, in Linux it requires using HV
programming to disable the DWEN fuse between each debug and program
operation. But HV and ISP/ICE need different physical connections on the
STK500, and I don't trust every student to do this correctly every time. I
think it would result in fried boards.)

Thanks,
Marge Coahran
Computer Science
Grinnell College


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

RE: avr-gdb, assembly, and JTAG

by Weddington, Eric :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: avr-chat-bounces+eric.weddington=atmel.com@...
> [mailto:avr-chat-bounces+eric.weddington=atmel.com@...]
>  On Behalf Of Marge Coahran
> Sent: Monday, May 04, 2009 5:45 PM
> To: avr-chat@...
> Subject: [avr-chat] avr-gdb, assembly, and JTAG
>
> Can avr-gdb/avarice be used with source written in assembly
> (eg, can gdb
> display values stored in specific registers)? The code would
> be assembled
> with avra.

GDB is for use with the other GNU tools: GCC, and GNU Binutils, which contains the GNU assmebler (also known as "gas"). To be more specific, AVR GDB works with the ELF file format (which is produced by the GNU linker, "ld"), and can work with either the "stabs" debug information (embedded in the ELF file), or sometimes with DWARF-2 debug information embedded in the ELF file. BTW, the ELF file format and DWARF-2 debug information format are publicly available standards.

If avra can produce this kind of ELF file, with the right kind of debug information, then perhaps AVR GDB can then debug that file.


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Graham Davies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Marge Coahran wrote:

> ... do I understand correctly that to use JTAG in a Linux environment, I
> first need to use ISP once to enable the JTAGEN fuse, but thereafter the
> fuse can remain enabled over a sequence of program and debug sessions?

No, I believe that this is incorrect.  The "default" state of the JTAG
enable fuse is clearly stated in the device data sheet, so you could just
look it up.  For the ATmega16 device I checked that it is "programmed", i.e.
JTAG is enabled in devices shipped from Atmel.  So, there is no need to mess
with this fuse and you can plunge straight in with JTAG.  I think this is
also the case with pretty much every other JTAG-enabled device from Atmel.
I am a big fan of JTAG and generally ignore ISP and this always seems to
work.

By the way, I think you'll find that the ATmega16L has been replaced with
the ATmega16A.

I'll probably get in trouble for saying this, but if your objective is to
teach your students about the AVR, you're doing them a great disservice by
insisting on Linux.  All these problems you're trying to clarify just don't
exist in AVR Studio.  Admittedly, debugWIRE isn't as easy to use as JTAG,
but you certainly don't have to rewire to high voltage programming to turn
it on and off.

Graham.




_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

RE: avr-gdb, assembly, and JTAG

by Weddington, Eric :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 

> -----Original Message-----
> From: avr-chat-bounces+eric.weddington=atmel.com@...
> [mailto:avr-chat-bounces+eric.weddington=atmel.com@...]
>  On Behalf Of Graham Davies
> Sent: Monday, May 04, 2009 6:52 PM
> To: avr-chat@...
> Subject: Re: [avr-chat] avr-gdb, assembly, and JTAG
>
> I'll probably get in trouble for saying this, but if your
> objective is to
> teach your students about the AVR, you're doing them a great
> disservice by
> insisting on Linux.  All these problems you're trying to
> clarify just don't
> exist in AVR Studio.

I would also say that you (Marge) are doing students a disservice by having them use avra. The GNU tools are easily available on Linux and are much more widely used, including in industry.


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Graham Davies <ecrostec@...> wrote:

> Admittedly, debugWIRE isn't as easy to use as JTAG, but you
> certainly don't have to rewire to high voltage programming to turn
> it on and off.

Why are you throwing debugWIRE into the debate?  It's completely
irrelevant to an ATmega16 (and btw., isn't an issue with using
Linux either, at least not a different one than using JTAG).

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"Weddington, Eric" <Eric.Weddington@...> wrote:

> If avra can produce this kind of ELF file, with the right kind of
> debug information, then perhaps AVR GDB can then debug that file.

To debug an assembly file, debugging information isn't strictly
needed (you can always debug at the disassembly level), but it's
extremely helpful.

When using the GNU assembler with stabs debugging information, it can
automatically provide line number information (option --gstabs).  This
helps the debugger displaying the respective source file line.

Displaying registers works using the "show register" command.
--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Graham Davies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joerg Wunsch wrote:

> Why are you throwing debugWIRE into the debate?  It's completely
> irrelevant to an ATmega16 (and btw., isn't an issue with using
> Linux either, at least not a different one than using JTAG).

The OP asked a couple of questions, then provided a paragraph of background
information.  Part of this was the reason for the selection of the
microcontroller, which was in part to avoid debugWIRE.  The OP stated that
to turn debugWIRE on and off under her Linux tool set, it is necessary to
rewire to high voltage programming mode.  I don't know if that's true, but
you certainly don't have to do that with AVR Studio.

Graham.




_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As Graham Davies wrote:

> >Why are you throwing debugWIRE into the debate?

> The OP stated that
> to turn debugWIRE on and off under her Linux tool set, it is necessary to
> rewire to high voltage programming mode.

Sorry, I missed that.  Seems I stopped reading the original posting
before that...  He didn't right away state it but he suspected it.

>  I don't know if that's true, but
> you certainly don't have to do that with AVR Studio.

Since the tools hardware involved is the same, the possibilities are
also the same, regardless of the operating system.  Sure, there might
be situations where you can shoot into your foot with debugWIRE
(e.g. if you power-off the SPI in your firmware, the chip is rendered
inoperable until you clear the DWEN fuse and/or chip-erase it using HV
programming), but in general, there are no different limitations of
debugWIRE whether you run it on Windows, Linux, FreeBSD, or Solaris.

Similarly, if you disable both the JTAGEN and the SPEN fuse through
JTAG on a JTAG-capable device, you can no longer program/debug it,
and have to HV reprogram it.

However, the OP was under the wrong assumption anyway that the
ATmega8515 shipping with the STK500 would offer debugWIRE; in fact, it
doesn't.  So as the other AVR shipping with the kit is an ATmega16,
that's certainly a good choice for experimenting.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Graham Davies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joerg Wunsch wrote:

> ... [the] ATmega16 [is] certainly a good choice for experimenting.

I agree completely with this.  I also think that the selection of JTAG is
correct because you can do everything (set fuses, program and debug) in a
"seamless" fashion (at least in AVR Studio, probably also with the right
Linux tool set).  Plus, you can't brick the device by setting the clock
fuses incorrectly.  The ATmega16 also has a good set of peripheral
functions, but the data sheet isn't overwhelming, as data sheets of the
richer devices could appear to students.  Finally, if you need more RAM or
Flash, it has a big brother in the ATmega32.

Graham.




_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Marge Coahran-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks to everyone. All of this has been very helpful information.

I'll go with the ATmega16 and upgrade my thinking from avra to the gnu
toolset. I expect I'll be ordering some STK500 JTAG adapters from Ecros
Tech too. :)

-Marge

On Tue, 5 May 2009, Graham Davies wrote:

> Joerg Wunsch wrote:
>
>> ... [the] ATmega16 [is] certainly a good choice for experimenting.
>
> I agree completely with this.  I also think that the selection of JTAG is
> correct because you can do everything (set fuses, program and debug) in a
> "seamless" fashion (at least in AVR Studio, probably also with the right
> Linux tool set).  Plus, you can't brick the device by setting the clock fuses
> incorrectly.  The ATmega16 also has a good set of peripheral functions, but
> the data sheet isn't overwhelming, as data sheets of the richer devices could
> appear to students.  Finally, if you need more RAM or Flash, it has a big
> brother in the ATmega32.
>
> Graham.
>
>
>
>
> _______________________________________________
> AVR-chat mailing list
> AVR-chat@...
> http://lists.nongnu.org/mailman/listinfo/avr-chat
>


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Marge Coahran <coahranm@...> wrote:

> I expect I'll be ordering some STK500 JTAG adapters from Ecros
> Tech too. :)

Alas, I'm afraid the old JTAG ICE mkI protocol code might slightly
start bit-rotting in the toolchain.  Personally, I haven't been using
a protocol version 1 device for years, so I wouldn't want to make any
promises on that area.  It might still work the way it used to, but
there's always a slight chance that changes in other parts of the code
(namely, in AVaRICE) could negatively affect the old codebase when
it's no longer being tested.

I'm a little sorry for Graham here, but I'd rater recommend using the
AVR Dragon instead since it's a protocol version 2 device.  The only
thing when using it for students is that you should somehow find a
housing for it, to avoid shortcuts.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Graham Davies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In reply to Marge Coahran <coahranm@...> who wrote:
>> I expect I'll be ordering some STK500 JTAG adapters ...

Joerg Wunsch wrote,
> Alas, I'm afraid the old JTAG ICE mkI protocol code might slightly
> start bit-rotting in the toolchain ... I'm a little sorry for Graham here,
> but I'd rater recommend using the AVR Dragon instead

Marge has bought from me just adapters to connect a JTAG interface device to
an STK500 with an ATmega16 or ATmega32 plugged in.  She did not buy the AVR
ICE-Cube, which is what I think you're refering to.  The adapters will work
just fine with the AVR Dragon or any other JTAG interface.

Although I thought that the AVR Dragon spelled the end for the AVR ICE-Cube,
I'm still selling quite a few.  Atmel continue to support it in AVR Studio,
so there is no bit-rot on the Windows side (at least, not yet).

> The only thing when using [the AVR Dragon] for students is that you
> should somehow fnd a housing for it, to avoid shortcuts.

Or, use it with a Dragon Rider 500 instead of the STK500!

Graham.




_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Marge Coahran-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> The only thing when using [the AVR Dragon] for students is that you
>> should somehow fnd a housing for it, to avoid shortcuts.
>
> Or, use it with a Dragon Rider 500 instead of the STK500!

Can I ask what you mean by shortcuts? Short circuits? Can you say more
about where the Dragon is prone to getting them?

-Marge


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Graham Davies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Marge Coahran wrote:

> Can I ask what you mean by shortcuts? Short circuits? Can you say more
> about where the Dragon is prone to getting them?

I'm pretty sure that J"org meant short circuits.  The AVR Dragon has no
enclosure, so if you put it down on something conductive, a metal pen or
rule or something, then the pins poking out on the bottom could get shorted
together.  Or, if you drop something conductive on it, a paper clip or a
ring, the same thing can happen.  People have reported that the AVR Dragon
is not well protected against such things.  We're just advising you to watch
out for accidents like this with your students.  A first step might be to
put feet on the bottom.  Better would be an enclosure of some sort.

Graham.




_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Graham Davies <ecrostec@...> wrote:

> I'm pretty sure that J"org meant short circuits.

Yes, exactly.

> A first step might be to
> put feet on the bottom.  Better would be an enclosure of some sort.

One could "recycle" the package it ships in (the red box with the
golden artwork) as a case, but remove the conductive foam sheets
before.  While it's not highly conductive, it might conduct enough
current to confuse the circuitry on the Dragon.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Graham Davies <ecrostec@...> wrote:

> Marge has bought from me just adapters to connect a JTAG interface
> device to an STK500 with an ATmega16 or ATmega32 plugged in.

Ah, I forgot you don't get such an adapter together with the Dragon,
it only ships as part of the JTAG ICE itself.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Marge Coahran-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 7 May 2009, Joerg Wunsch wrote:
>
> One could "recycle" the package it ships in (the red box with the
> golden artwork) as a case, but remove the conductive foam sheets
> before.  While it's not highly conductive, it might conduct enough
> current to confuse the circuitry on the Dragon.

That's a great idea! Simple. Should I expect an issue with heat buildup
inside the box?

Why is the un-enclosed circuitry on the STK500 less of a concern? Well, it
does have feet. Are there another reasons too? Or just experience says
it's ok?

-Marge


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat

Re: avr-gdb, assembly, and JTAG

by Joerg Wunsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Marge Coahran <coahranm@...> wrote:

> That's a great idea! Simple. Should I expect an issue with heat
> buildup inside the box?

I don't think so.

> Why is the un-enclosed circuitry on the STK500 less of a concern?
> Well, it does have feet. Are there another reasons too?

Since it's a little more heavy, it has a tendency to just sit on the
desk, while the Dragon is more likely to be dragged around (not the
least by the stiff USB cable).  Don't be tempted to make the JTAG
cable too long, otherwise the wires might crosstalk too much.  Try
keeping it down to 10...15 cm length.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)


_______________________________________________
AVR-chat mailing list
AVR-chat@...
http://lists.nongnu.org/mailman/listinfo/avr-chat