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: john . johnson
Subject: Re: Fwd: [avr-gcc-list] Query regarding hard located variables
Date: Wed, 9 Jan 2002 10:06:13 -0500

To Klaus Rudolph,  Scott Finneran, Anton Erasmus, et al.

While I have not (yet) used avr-gcc I have used another compiler for the
AVR uC for code with similar requirements though I have not
yet implemented a bank switching mechanism as described.

I have used a mechanism like that proposed by Scott Finneran but note that
I think you will wind up with three memory "segments",
one before the address or addresses you want to specifically locate, the
area where you want to specifically locate, i.e. the bank switching
register,
and the area above the specifically located segment.

Only one will be used by the compiler as "data space" to freely assign to
variables. I assume this will be the region below the bank switching
register.
The variables (or variable) required to be located at the reserved
location(s) will in the area reserved for this purpose i.e. the one address
segment reserved for the bank switching register.

But now you will have to find a way to make use of the third memory area
which will not be used for freely assigned variables.

In my designs I have "hard" located buffer space and other large structures
in this type of region so as to move these structures out of the area to be
used for freely assigned variables.

Linker control files were used to locate and name the memory segments.
Compiler controls were used to identify the named segments into which
certain variables were assigned.
And, to break all rules, I have also used direct pointer address
assignments such as those described previously in this discussion series.


John Johnson



                                                                                
                                  
                    Klaus Rudolph                                               
                                  
                    <address@hidden        To:     Scott Finneran 
<address@hidden>                    
                    de>                      cc:     avr <address@hidden>       
                           
                    Sent by:                 Subject:     Re: Fwd: 
[avr-gcc-list] Query regarding hard located    
                    owner-avr-gcc-lis        variables                          
                                  
                    address@hidden                                              
                                      
                                                                                
                                  
                                                                                
                                  
                    2002-01-08 15:52                                            
                                  
                                                                                
                                  
                                                                                
                                  




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




avr-gcc-list at http://avr1.org



reply via email to

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