Use srec_cat to join three binaries and fill holes
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)?
embedded binaryfiles srec-cat
add a comment |
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)?
embedded binaryfiles srec-cat
Does this work:srec_cat bootloader.bin -Binary -fill 0xFF 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -o combined.bin -Binary
?
– kkrambo
Nov 21 '18 at 19:33
I will try once the test environment is fixed but it "looks" wrong.bootloader.bin
needs to be at offset 0x1000. Is the general idea to first fill from 0x0 to 0x10000 then cat bootloader at offset 0x1000, then cat conf at offset 0x8000 and then cat the app at the end?
– Marcel Stör
Nov 21 '18 at 21:03
Out of pure interest: are you doing this from inside a makefile?
– Vroomfondel
Nov 23 '18 at 10:55
No, as post process of what a 3rd-party Makefile produced ;-)
– Marcel Stör
Nov 23 '18 at 10:56
I also tried the "first fill 0xFF up to 0x10000 and then overwrite" approach butsrec_cat
doesn't support that:contradictory 0x00008000 value (previous = 0xFF, this one = 0xAA)
.
– Marcel Stör
Nov 24 '18 at 9:54
add a comment |
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)?
embedded binaryfiles srec-cat
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)?
embedded binaryfiles srec-cat
embedded binaryfiles srec-cat
asked Nov 21 '18 at 13:38
Marcel StörMarcel Stör
14.5k551125
14.5k551125
Does this work:srec_cat bootloader.bin -Binary -fill 0xFF 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -o combined.bin -Binary
?
– kkrambo
Nov 21 '18 at 19:33
I will try once the test environment is fixed but it "looks" wrong.bootloader.bin
needs to be at offset 0x1000. Is the general idea to first fill from 0x0 to 0x10000 then cat bootloader at offset 0x1000, then cat conf at offset 0x8000 and then cat the app at the end?
– Marcel Stör
Nov 21 '18 at 21:03
Out of pure interest: are you doing this from inside a makefile?
– Vroomfondel
Nov 23 '18 at 10:55
No, as post process of what a 3rd-party Makefile produced ;-)
– Marcel Stör
Nov 23 '18 at 10:56
I also tried the "first fill 0xFF up to 0x10000 and then overwrite" approach butsrec_cat
doesn't support that:contradictory 0x00008000 value (previous = 0xFF, this one = 0xAA)
.
– Marcel Stör
Nov 24 '18 at 9:54
add a comment |
Does this work:srec_cat bootloader.bin -Binary -fill 0xFF 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -o combined.bin -Binary
?
– kkrambo
Nov 21 '18 at 19:33
I will try once the test environment is fixed but it "looks" wrong.bootloader.bin
needs to be at offset 0x1000. Is the general idea to first fill from 0x0 to 0x10000 then cat bootloader at offset 0x1000, then cat conf at offset 0x8000 and then cat the app at the end?
– Marcel Stör
Nov 21 '18 at 21:03
Out of pure interest: are you doing this from inside a makefile?
– Vroomfondel
Nov 23 '18 at 10:55
No, as post process of what a 3rd-party Makefile produced ;-)
– Marcel Stör
Nov 23 '18 at 10:56
I also tried the "first fill 0xFF up to 0x10000 and then overwrite" approach butsrec_cat
doesn't support that:contradictory 0x00008000 value (previous = 0xFF, this one = 0xAA)
.
– Marcel Stör
Nov 24 '18 at 9:54
Does this work:
srec_cat bootloader.bin -Binary -fill 0xFF 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -o combined.bin -Binary
?– kkrambo
Nov 21 '18 at 19:33
Does this work:
srec_cat bootloader.bin -Binary -fill 0xFF 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -o combined.bin -Binary
?– kkrambo
Nov 21 '18 at 19:33
I will try once the test environment is fixed but it "looks" wrong.
bootloader.bin
needs to be at offset 0x1000. Is the general idea to first fill from 0x0 to 0x10000 then cat bootloader at offset 0x1000, then cat conf at offset 0x8000 and then cat the app at the end?– Marcel Stör
Nov 21 '18 at 21:03
I will try once the test environment is fixed but it "looks" wrong.
bootloader.bin
needs to be at offset 0x1000. Is the general idea to first fill from 0x0 to 0x10000 then cat bootloader at offset 0x1000, then cat conf at offset 0x8000 and then cat the app at the end?– Marcel Stör
Nov 21 '18 at 21:03
Out of pure interest: are you doing this from inside a makefile?
– Vroomfondel
Nov 23 '18 at 10:55
Out of pure interest: are you doing this from inside a makefile?
– Vroomfondel
Nov 23 '18 at 10:55
No, as post process of what a 3rd-party Makefile produced ;-)
– Marcel Stör
Nov 23 '18 at 10:56
No, as post process of what a 3rd-party Makefile produced ;-)
– Marcel Stör
Nov 23 '18 at 10:56
I also tried the "first fill 0xFF up to 0x10000 and then overwrite" approach but
srec_cat
doesn't support that: contradictory 0x00008000 value (previous = 0xFF, this one = 0xAA)
.– Marcel Stör
Nov 24 '18 at 9:54
I also tried the "first fill 0xFF up to 0x10000 and then overwrite" approach but
srec_cat
doesn't support that: contradictory 0x00008000 value (previous = 0xFF, this one = 0xAA)
.– Marcel Stör
Nov 24 '18 at 9:54
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413319%2fuse-srec-cat-to-join-three-binaries-and-fill-holes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
add a comment |
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
add a comment |
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
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
answered Nov 21 '18 at 22:58
kkrambokkrambo
4,7491818
4,7491818
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413319%2fuse-srec-cat-to-join-three-binaries-and-fill-holes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Does this work:
srec_cat bootloader.bin -Binary -fill 0xFF 0x00000000 0x00008000 conf.bin -Binary -offset 0x00008000 -o combined.bin -Binary
?– kkrambo
Nov 21 '18 at 19:33
I will try once the test environment is fixed but it "looks" wrong.
bootloader.bin
needs to be at offset 0x1000. Is the general idea to first fill from 0x0 to 0x10000 then cat bootloader at offset 0x1000, then cat conf at offset 0x8000 and then cat the app at the end?– Marcel Stör
Nov 21 '18 at 21:03
Out of pure interest: are you doing this from inside a makefile?
– Vroomfondel
Nov 23 '18 at 10:55
No, as post process of what a 3rd-party Makefile produced ;-)
– Marcel Stör
Nov 23 '18 at 10:56
I also tried the "first fill 0xFF up to 0x10000 and then overwrite" approach but
srec_cat
doesn't support that:contradictory 0x00008000 value (previous = 0xFF, this one = 0xAA)
.– Marcel Stör
Nov 24 '18 at 9:54