AnyCPU
http://anycpu.org/forum/

Splitting & Combining ROM images
http://anycpu.org/forum/viewtopic.php?f=8&t=682
Page 1 of 1

Author:  NotArtyom [ Sat Feb 22, 2020 11:25 am ]
Post subject:  Splitting & Combining ROM images

It surprises me how little information there is online about how to split ROM images into their LO & HI bytes.
Typically with buses 16-bits and wider, multiple 8-bit ROMs are used to cover the entire width of the bus; thus requiring the firmware binary to be split into parts.
The command line tool srec_cat can be used to do what we need:
Code:
srec_cat -o LOW.bin -binary ROM.bin -binary -split 2 0
srec_cat -o HIGH.bin -binary ROM.bin -binary -split 2 0

Bonus example: Combining the LO & HI ROM dumps back into a flat binary:
Code:
srec_cat -o ROM.bin -binary LOW.bin -binary -unsplit 2 0 HIGH.bin -binary -unsplit 2 1

For a more in depth explanation, see my site entry on the topic.

Author:  Garth [ Sat Feb 22, 2020 7:09 pm ]
Post subject:  Re: Splitting & Combining ROM images

I've used that tool at http://srecord.sourceforge.net/. It was a lifesaver.

Author:  robfinch [ Sun Feb 23, 2020 3:08 am ]
Post subject:  Re: Splitting & Combining ROM images

I wrote my own tool a while ago called "split.exe" that as tested now doesn't work in 64-bit Windows. Time to upgrade it. I suspect others have found their own means to split files.
I've also a tool called "RAMBBuster" to convert a binary file into a series of "INST_xxx" definitions for an FPGA constraints file. It can swap the byte order around in the process.
Useful for setting initial block ram contents.

Author:  robfinch [ Sun Feb 23, 2020 4:13 am ]
Post subject:  Re: Splitting & Combining ROM images

Updated split to Windows 64-bit and placed the source code in GitHub under the software/split folder.
split will split a file into up to eight different output binaries.

Code:
split - binary file splitting utility.
2009-2020  Robert Finch
split <filename> <option>
        Splits an input file into up to eight output files.
        <option> has two parts - a character code b,h,w,d and the number of
        output streams
        the character code indicates the output stream (file) width
        (b=byte,h=halfword (16 bits),w=word(32 bits),d=double word (64 bits)
        Example: split test.bin w4
                will treat test.bin as a series of word (32 bit) values
                and split the test.bin file into four output files (test.o0, test.o1, ...)
                from the input file.
        Input file name default extension is '.bin'.

Author:  oldben [ Mon Feb 24, 2020 6:10 pm ]
Post subject:  Re: Splitting & Combining ROM images

Splitting by nibbles (4 bits) might be usefull, if one had to update a machine using really old proms
say for microcode.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/