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]

Re: Changing memory segments


Stan Katz wrote:
> 
> 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.

Bit late I know, but have you consideered using a preprocessor (like gcc -E
for the C preprocessor, or perhaps m4). You could define things on the
command line, and do include files as you wanted.
 
> 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.

I'm not clear what you want, but objcopy has a plethora of options to add
and remove sections from object files and executables.
 
Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/

------
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]