This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Changing memory segments


Is there any way to change the default segments used by the compiler. I am
working on an embedded system with several types of ROM and RAM (Internal
and External - different speeds, static Ram and DRAM, etc.) and am often
shuffling code and data into specific memory regions for improved
performance.

Currently I have 2 ways of doing this, one is a set of preprocessor macros
that set the section attribute e.g. 

#define SLOWROM __attribute__ ((section (".slowrom")))

and I set the attributes (segments)of functions and variables individually
and make sure that they are handled properly in my link script. 
I also use the link script to force all the code or data from a particular
file into a memory region.

The problem is that I need to have a different link script for every
different configuration and any changes to the files needs to change not
only the makefile but also the link script. Ideally I would like to have a
single link script for each hardware version and handle the software options
in the makefile only.

I can see two ways of doing this, the easiest would be to be able to change
the segments used by the compiler, either with command line options or with
a utility that took an object file and renamed segments, e.g. change the
.text segment to be .fastrom or .code, etc. Then I could configure the
makefile to generate the correct segments in the object file to be linked.
However I can't find such a utility and I'm not sure how easy it would be to
write.

Alternatively, if I could use macros in the linker file, I could use a
common include file to define the groups of object modules for both the
makefile and the linker and then specify the files to be forced into a
memory region using the macro, however this would need significant changes
to the linker.

Any suggestions ?

TIA
Stan Katz

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]