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

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

Re: Fwd: [avr-gcc-list] Query regarding hard located variables


From: Klaus Rudolph
Subject: Re: Fwd: [avr-gcc-list] Query regarding hard located variables
Date: Tue, 08 Jan 2002 21:52:07 +0100

Scott Finneran wrote:
> 
> Hello Torsten,
> 
> Thankyou for your suggestion, unfortunately it does not answer my
> question. What you have suggested will work but has problems.
> 
> Perhaps I did not explain my problem well enough. I have a hardware
> register which is in data memory space. It overlays a single memory
> location. It is not at the begining or end of memory, so I cannot simply
> change the MEMORY section of linker script to begin after it or stop
> just before it (I would lose approx 20% of my RAM doing this). Accessing
> the location is not a problem, it is a simple pointer operation (as you
> have indicated). However, as the register lives in the middle of my data
> space (ie it overlays one location of my external SRAM device), it is
> quite likely that the linker will assign the memory address to an
> unrelated variable. As you can imagine, this will cause all kinds of
> mysterious behaviour of the system when I modify this variable.
> 
> What I would like to do is either:
> A) Assign a specific variable to this memory location (which I can then
> use to access the register).
> 
> or
> 
> B) Reserve the memory location so that the linker does not use it. I can
> then safely access it with a pointer as you have suggested.
> 
> Does anyone know how to do either of these things?
> 

I would build a second data section in the linker script after your
hard located register. You can use this data2 section through the
normal section statements from assembler or C with pragma.

There is no way from linker scripts to reserve a varible in the
address space of the section for other use i think.

What you want to have is one section (data) and reserve there one
address with one, lets say static c variable, so the compiler
can decide where the compiler generated vars should go. Mmmh.
No idea. 
Is that what you really mean?
avr-gcc-list at http://avr1.org



reply via email to

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