This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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: dividing the elf object file file in to two binary files


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


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