使用 srec_cat 连接三个二进制文件并填补漏洞

Use srec_cat to join three binaries and fill holes

我有三个用于特定内存地址的二进制文件,我想将它们与 srec_cat 用 0xFF 填充空洞结合起来。

内存映射

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

~~~ 表示 "fluid" 边界,即它左边的二进制文件没有固定大小。

CLI 参数

我在 −fill-binary-offset 选项之间有点迷茫,我在 http://srecord.sourceforge.net/man/man1/srec_examples.html#BINARY%20FILES 上读到过。有没有办法告诉 srec_cat 填充 0x1000 和 0x8000 之间 而不是 bootloader.bin 占用的任何内容(无论 .bin 实际上有多大)?

我自己试过了,我相信这会做你想要的。

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