This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: dividing the elf object file file in to two binary files
- From: Martin Laabs <info at martinlaabs dot de>
- To: ganesh kr <krganesh01 at gmail dot com>, eCos Discuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Tue, 21 Jul 2009 14:46:38 +0200
- Subject: Re: [ECOS] dividing the elf object file file in to two binary files
- References: <73f9997f0907192203h77494e62u58b44ccfc7a738f4@mail.gmail.com>
Hi,
ganesh kr wrote:
Hi,
I am using ecos with lwip. I have two flash memory chips of 128 KB
each at addr 0x04000000 and 0x08000000. the binary file is 140KB. I
want to have two binary files from the elf object file so that i can
load one binary file in to each flash. Also I have two libraries
libapp.a and libtarget.a. please let me know how can i do this.
You have to change the linker script to get two sections for .text.
However - you have to give every section an unique name. To assign
functions/files to each section you can use the linker script as well
as the __attribute__ ((section ("<section name>"))) attribute before
any function or variable.
At the end you get one elf file with different section that can be
separated by objcopy/objdump.
Here a short example from an old project:
#define INSRAM_DATA __attribute__ ((section (".sram_data")))
#define INSRAM_TEXT __attribute__ ((section (".sram_text")))
cyg_uint32 rawData[20][64] INSRAM_DATA; //[Channel][TimeSlot]
void INSRAM_TEXT
reader(cyg_addrword_t data)
{
...
}
Greetings,
Martin Laabs
PS: If you call function in one segment out of the other
segment you have to use far jumps like that:
void (*diag_printf_p)( const char *fmt, ... ) = &diag_printf;
and then call
diag_printf_p("calculating: %d %d %d\n", i, j, tap); instead of
diag_printf(....)
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss