This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About different compile address


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



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