When I compile my code I eventually get Motorola S records (a.mot) with gaps (the whole address range is not covered by code and data).
I want to fill those gaps with the pattern 0x01 0x80
. However, it is important that all of the two-byte pairs must start at even addresses. 0x0180
is an opcode from my micro that I want to be executed if the PC reaches an address of unused flash area.
Before you start answering I'd like to tell you that -repeat-data in srec_cat has an issue:
- Given two sections e.g. C and D put one after another (D after C) in address space.
- Given that last byte of section C ends on address
0x76
and first byte of section D is on address0x78
. In other words there is 1 byte long gap at address0x77
between them.
Under such conditions, if I use -repeat-data 0x01 0x80
option, srec cat will fill that one byte with 0x01
and start filling following gap from 0x80
.
I do not know sizes of those sections because linker handles it.
I would write a simple parser in Windows working like this:
Use srec_cat to create a file covering your required address range filled entirely with the 0x01 0x80 sequence aligned as required.
Then use srec_cat with the
-multiple
and−disable-sequence-warning
options to "merge" the "filler" file with your application image file. You should specify the filler file as the first file so that it is overwritten by the application data specified second.It will issue many warnings, but it should work.