Use srec_cat to join three binaries and fill holes

3k Views Asked by At

I have three binaries for specific memory addresses that I want to combine with srec_cat filling the holes with 0xFF.

  • bootloader.bin —> 0x1000
  • conf.bin —> 0x8000
  • app.bin —> 0x10000

Memory map

|- pad w/ 0xFF -|- *bootloader* ~~~ pad w/ 0xFF -|- *conf* ~~~ pad w/ 0xFF -| - *app* ~~~|
0            0x1000                           0x8000                    0x10000

~~~ signifies a "fluid" boundary i.e. the binary to the left of it doesn't have a fixed size.

CLI arguments

I am a bit lost between the −fill, -binary and -offset options that I read about on http://srecord.sourceforge.net/man/man1/srec_examples.html#BINARY%20FILES. Is there a way to tell srec_cat to fill anything between 0x1000 and 0x8000 that is not occupied by bootloader.bin (regardless of what size the .bin actually has)?

1

There are 1 best solutions below

0
kkrambo On BEST ANSWER

I tried this myself and I believe this will do what you want.

srec_cat bootloader.bin -Binary -offset 0x00001000 -fill 0xff 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -fill 0xff 0x00008000 0x00010000 app.bin -Binary -offset 0x00010000 -o combined.bin -Binary