[Top][All Lists]

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

Re: [avr-gcc-list] Data RAM Pointers

From: Theodore A. Roth
Subject: Re: [avr-gcc-list] Data RAM Pointers
Date: Fri, 5 Nov 2004 16:36:27 -0800 (PST)

On Fri, 5 Nov 2004, Keith Gudger wrote:

> I have a question about data pointers and gcc / gdb / simulavr.
> A real data pointer is 16 bits long.  In GCC land, data pointers are 24
> bits long (there is an extra byte with "0x80" in it).  I have a structure
> which has an element:
> uint32_t* ram_add;
> 16 bits get reserved for this pointer.  The value written into it is
> 0x800108.  When later using this address, I realize that this is not a
> problem for the "real" chip, but what happens in gdb / simulavr?

GDB always thinks about sram memory with the 0x800000 offset. It sends
the memory read/write requests over the wire to the remote target with
the address offset and it is up to the remote target
(avarice/simulavrxx/simulavr) do decode it into the correct memory
space. GDB can only "visualize" a single, linear memory space. We cheat
by mapping the AVR's various memory spaces into various chunks of a
32-bit space, hoping that there will never be any overlaps.

Remember, what you have above is just a pointer to a 32-bit value.
Pointers are _always_ 16-bits in the avr so the simulator should not be
thinking about it in any other way.

Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden

reply via email to

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