This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Linking to rom code symbols


Hi,

I'm trying to find an efficient and convenient way to link a aplication
to rom code.

The rom code is compiled as a rom.elf file.

I stripped this file to keep only the needed symbol (using strip -K)

Then in my application, I use the following linker script:

SECTIONS
{
        .rom 0x80190000 :
        {
                rom.elf
        }


        .text 0x801e0000:
        {
                _ftext = . ;
                *(.text)
                . = ALIGN(4);
                etext = . ;
        }

        .data 0x801f0000:
        {
                _fdata = . ;
                *(.data)
                . = ALIGN(4);
        }
}

Linking with this works fine and give me an app.elf file.

I can then extra the .text and .data section in binary files and load
the app this way.

I have a couple of (minor) issues with this method though:

a) This requires me to carry around the rom.elf file. The actual code
itself should not be required to link, only the symbol tables i believe.

So I would like to find a way to generate a "symbol file" that I can
easily include in my linking.

I tried to use the "objcopy --extract-symbol" to create a rom.sym file,
which is still an elf file but that contains only the symbol tables.
But this did not work. For some reason, it gets the offset all wrong
when linking. ie, even though readelf or nm return the symbols in the
0x80190000 range when looking at the rom.sym file, after the linking
process, the rom symbols in the app.elf file are in the 0x320000 range.

I'm not sure if thats a bug of the particular toolchain i'm using or
because I'm not doing the right thing.


b) The second issue is that I need to specify the .rom address in my app
linker script, but that information should already be in the rom.elf file.

Is there an easy and clean way to extract this information to give it to
the linker script ?

Thanks

-- Fabrice


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