[Top][All Lists]

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

[avr-libc-dev] Viewing registers while debugging (plus attachment)

From: Ned Konz
Subject: [avr-libc-dev] Viewing registers while debugging (plus attachment)
Date: Thu, 6 Apr 2006 15:12:48 -0700

Just a helpful hint...

Another thing that the script I mentioned in my prior email (but didn't get around to attaching) is to spit out a linker file that defines the registers so you can do things like print them and set them symbolically from gdb.

p PORTA = 0xFF

x/20b &PORTA


This is very simple (and is something you can do by just linking a text file with your program). It just surprised me that no one seems to mention it when people complain about not seeing the registers in the debugger.

All I did was this:

I made a text file (which I named iom128.a) that contains defines for all the registers:

/* SFR memory addresses */
ACSR = 0x800028;
ADC = 0x800024;
ADCH = 0x800025;
ADCL = 0x800024;
ADCSR = 0x800026;
ADCSRA = 0x800026;
ADCW = 0x800024;
ADMUX = 0x800027;
ASSR = 0x800050;
DDRA = 0x80003a;
DDRB = 0x800037;
DDRC = 0x800034;

And I also came up with a slightly extended linker script (avr5.x), though I'm not sure that it's even needed (it's in the tarball). What it did was just to add two more regions that define the rest of the space:

  text   (rx)       : ORIGIN = 0x000000, LENGTH = 128K
  regs   (!a!irw!x) : ORIGIN = 0x800000, LENGTH = 0x20
  sfrs   (!a!irw!x) : ORIGIN = 0x800020, LENGTH = 0x40
  data   (rw!x)     : ORIGIN = 0x800060, LENGTH = 0xffa0
  eeprom (rw!x)     : ORIGIN = 0x810000, LENGTH = 64K

Then I added this to the linker line:

 -L. -T iom128.a -T avr5.x

which replaces the stock avr5.x with the concatenation of these two files.


Attachment: headerMods.tar.gz
Description: GNU Zip compressed data

Ned Konz

reply via email to

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