Search code examples
algorithmfileembeddedhex

Fill pattern of an arbitrary size in Intel hex file


I have been trying to do a fill using the open source Srecord Program. I need to do a fill that is 0xC2AF00. It appears the program can only do fills that are a byte long (ex: 0xff). If this is not possible with the Srecord program, then how would I go about writing my own algorithm to do what I want?

I am not quite sure how to determine what needs a fill and then how I would proceed to go about doing the fill that is needed. And on the off chance that someone could answer the same question for a Tektronix file, that would be just as good or better than how to do what I am asking for on the Intel hex file.


Solution

  • The -repeat-data generator can take multiple bytes as parameters. The following will fill bytes 16 through 31 with C2AF00C2AF00...

    srec_cat -Output -Intel -generate 0x10 0x20 -repeat-data 0xC2 0xAF 0x00
    

    Combine with your actual input, or other generators, to fill the appropriate ranges.