avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] peripheral registers and AVR-GDB


From: Mark Litwack
Subject: Re: [avr-gcc-list] peripheral registers and AVR-GDB
Date: Mon, 21 Apr 2008 22:41:53 -0400
User-agent: KMail/1.9.9

On Monday 21 April 2008 05:18:34 pm fpaolo63 wrote:
> Hi all,
> I'd like to read/set peripheral registers using AVR-GDB.
> Is there a "way"to specify the peripheral address space to the GDB dump
> command?
>
> Thanks in advance
>
> paolo
>


Hi Paolo,

Since the IO registers are mapped to memory, you can just
examine memory from avr-gdb.  You need to add a 0x800000
byte offset to access the memory.

For example, here is register 0xcc (UBRR1L on a at90usb):

  (gdb) x/xb 0x8000cc
  0x8000cc:       0x22

You can set it like this:

  (gdb) set *0x8000cc=0x11
  (gdb) x/xb 0x8000cc
  0x8000cc:       0x11

This also works for the lower IO registers, but the AVR
architecture maps them with a 0x20 byte offset.  So for
example, IO register 0x29 is at memory location 0x49 (this
would be 0x800049 in avr-gdb).

The "Register Summary" section of any AVR datasheet has the
IO register and the memory offset for each listed.

avr-gdb also has the "info io_registers" command which may
do something useful, but I've never been able to get it to
work.

Perhaps there's other ways to twiddle IO registers, but the
above works for me.

-mark




reply via email to

[Prev in Thread] Current Thread [Next in Thread]