Use srec_cat to join three binaries and fill holes












1















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)?










share|improve this question























  • 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
















1















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)?










share|improve this question























  • 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














1












1








1


1






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)?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 but srec_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











  • 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

















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












1 Answer
1






active

oldest

votes


















2














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





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    2














    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





    share|improve this answer




























      2














      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





      share|improve this answer


























        2












        2








        2







        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





        share|improve this 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






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 22:58









        kkrambokkrambo

        4,7491818




        4,7491818
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith