Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this questionI am looking for recommendations for a tool that will let me construct a binary image out of a series of smaller images.
I have an embedded system with a flash ROM that I program using a single image. That image consists of a series of smaller objects (data, compiled code, etc) placed at specific offsets. The build system I inherited uses a disturbing amalgam of old 16-bit DOS utilities to hack the image together. I was hoping to find a modern tool that would do the job in a less arcane (an开发者_如何学运维d less bug-prone) manner.
The tool needs to be able to run from a config file. That is, I specify that file A.bin needs to be placed at offset 4KB, file B.bin needs to be placed at offset 16KB, etc etc in a configuration file so that the tool does not require repeated manual command-line invocations. This is mainly because we have another system that will be auto-generating these config files.
The tool also needs to be open source (or at a minimum, cross-platform). We have developers using Windows and automated build systems using Linux and the tool would need to work on both.
I have debated hacking together my own utility in C, but before I went through all the trouble developing and debugging I wanted to ask and see if someone knew of a tool that was already out there that I missed.
Edit: Cygwin-related tools are unfortunately not an option for us. One of our critical build tools will crash if it is run on a system with Cygwin installed (I think it uses a specific, older cygwin DLL but that's an entirely different fiasco unto itself).
I usually write my own, but via Jack Ganssle's Embedded Muse newsletter No. 184 I came across http://srecord.sourceforge.net/ which will do just about anything with almost any type of binary image file (despite its name it handles far more formats than just Motorola S-Records, including raw binaries). It may save you some time.
dd would be definitively your best friend.
Use cygwin for windows users.
The Elfweaver utility that is distributed with OKL4 may be appropriate for you. From the manual: "Elfweaver is a tool that may be used to manipulate ELF files. Elfweaver is written as a Python 2.3 application that only uses cross-platform libraries. Therefore Elfweaver should run on Linux, Mac-OS X and Windows. The main functionality of Elfweaver is that it allows the user to merge multiple ELF files into a single ELF file" http://wiki.ok-labs.com/downloads/release-3.0/okl4-ref-manual-3.0.pdf
If you think that looks suitable, you can get the tool along with the okl4 source code from the OKL4 website.
精彩评论