This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to convert a BIN into an ELF object image with armlink?

I'm wondering how I could use 'armlink' to combine or merge a binary image into another image. With the ARM GNU tools, I can do the following:

1) Perform a partial linking (switch '-r') of as input file in binary format (switch '-b binary'). This will generate an ELF object file defined by switch '-o':

% arm-linux-gnueabihf-ld -r -o foo.o -b binary foo.bin

2) Then, one can link the resulting object file to generate a final binary. The "-T" switch points to the link script and "-o" defines the resulting output.

% arm-linux-gnueabihf-ld  -T foo.ld foo.o -o output.bin

The linker script may look something like this:

=======

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
SECTIONS
{
    . = 0x0;

    .text : {*(.text)

#if defined(CONFIG_LOOPSELF_PHYS_ADDR)
        __foo_start = .;
        foo.o
        . = ALIGN(4);
        __foo_end = .;
#endif

}

========

How could I do something similar with the ARM tool chain? I understand that 'armlink' allows for partial linking (--partial switch). But I could not find any 'armlink' switch for binary inputs. Am I missing something?

Also, I found this note on "How to use armlik to combine two images":

https://community.arm.com/community-help/f/discussions/2043/how-to-use-armlik-to-combine-two-images

It describes a different method to possibly achieve the same goal. It involves writing some assembler source that includes the binary in a different section as also defined in the scatter file:

area my_code, code
   incbin my_code.bin
   area other_code, code
   incbin other_code.bin
end

Is that the only way I can achieve this?