ARM Technical Support Knowledge Articles

Merging binary images together

Applies to: DS-5, RealView Development Suite (RVDS)


It is sometimes necessary to join distinct pieces of executable code or data to create a single application or ROMable image. For example you may need to:

There are different ways to achieve this:

Use armasm's INCBIN

The INCBIN directive of armasm includes a file into an assembler file. The file is included as it is, without being assembled. You can use INCBIN to include executable files, literals, or any arbitrary data. The contents of the file are added in place, byte for byte, without being interpreted in any way. For more information, please see the FAQ: "How do I use INCBIN two merge multiple binaries images?".

Use the fromelf option --bincombined

If you have an ELF executable image that contains more than one load region, it is possible to create a single binary image by using the --bincombined option.  For more information, please see the fromelf User Guide.

Using DOS 'copy' or Unix 'cat'

To concatenate binaries using DOS or Unix, use:

(DOS) copy /b app.bin+data.bin romimage
(Unix) cat app.bin data.bin > romimage

This produces one combined image from two (or more) code/data files. Note that this method simply joins images together. It does not perform any 'intelligent' placement of areas, as the linker does.

Use a debugger to load two binary images

If the absolute address locations of each image are known in advance, then one simple way to merge them is to use the restore or append commands in DS-5. See the DS-5 Command Reference documentation for more information.


Article last edited on: 2014-08-01 10:24:56

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential