public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* About different compile address
       [not found] <8F9FD60B99B9D711B1080020ED863EDE2F3BF4@MAILSERVER>
@ 2004-01-31  8:43 ` Xue_Pengyu
  2004-02-05  8:55   ` Jim Wilson
  0 siblings, 1 reply; 2+ messages in thread
From: Xue_Pengyu @ 2004-01-31  8:43 UTC (permalink / raw)
  To: gcc


Dear All, 

I am using arm-elf-gcc to develop a system. Dut to SRAM capacity limitation and MCU perform, I tend to run most binary code in flash, and run the code of JPEG encoder/decoder in SRAM.  So I have to compile some source code to flash, others to SRAM. Can some one give me a Makefile example, which can compile code section of different files to different address ? 
I used  EPSON compiler(C33) several years ago. I remember that the compiler can support virtual code section. Something like this:

-ucode address1 {test.o}  /// address1 is a RAM address
-code   address2 {test.o}  /// address2 is a flash address
test.o will be compiled to address2 in the binary code. But the code section of test.o is started from address1. After system power on, the the binary code from address2 is copied to address1. When system calls a function in test.o, system will run in RAM address space. 

But when using arm-elf-gcc, I don't know how to do it. Can some one do me a favor to solve the problem?
Many thanks!




Sincerely


Xue Pengyu


January 31, 2004


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: About different compile address
  2004-01-31  8:43 ` About different compile address Xue_Pengyu
@ 2004-02-05  8:55   ` Jim Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Jim Wilson @ 2004-02-05  8:55 UTC (permalink / raw)
  To: Xue_Pengyu; +Cc: gcc

Xue_Pengyu wrote:
> I am using arm-elf-gcc to develop a system. Dut to SRAM capacity limitation and MCU perform, I tend to run most binary code in flash, and run the code of JPEG encoder/decoder in SRAM.  So I have to compile some source code to flash, others to SRAM. Can some one give me a Makefile example, which can compile code section of different files to different address ? 

The GNU way of doing this is to use __attribute__ ((section ("sram")) to 
place code in the section sram, and then use a linker script to place 
the sram section at a specific address that corresponds to the static 
ram area on your target board.  It is probably easiest to start with an 
existing linker script, and add a few lines to it to support your sections.

There is some documentation on attribute section in the GCC manual, but 
probably not much to help you.  There is documentation on linker scripts 
in the binutils linker manual, but again, it may not be very useful.

What you really need is docs explaining how to do embedded development, 
and I am not sure if there is any such document publicly available. 
Maybe you can try asking on the gcc-help list, or on the crossgcc list.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-05  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <8F9FD60B99B9D711B1080020ED863EDE2F3BF4@MAILSERVER>
2004-01-31  8:43 ` About different compile address Xue_Pengyu
2004-02-05  8:55   ` Jim Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).