Hello,
I try to generate SB file from BD file for memory programming. I used i.MX RT 1060 Manufacturing User's Guide and followed the instructions on how to do that.
Generally, it works, except one special word at the beginning of my binary input file. From what I have tested, the error only appears with specific pattern of the first two bytes.
My .bin files are generated from this pattern:
- 4 bytes: my_variable
- 4 bytes: 0x00
- 1 byte: 0x0A
- 3 bytes: 0x00
- 217 bytes: random values, they don't really matter
When my my_variable has really any value, the script works as expected

Binary file when my_variable = 21300

But, when my_variable has value that follows this pattern (in little-endian):
| 0x53 | any number from range [0x30, 0x39] | any number from range [0x00, 0xFE] | any number from range [0x00, 0xFE] |
script fails with error "error: invalid hex digit".
Example:


As you can see, the only thing that changes is the first 4 bytes. Also, what's important is that, first 8 bytes have to be followed by
0A 00 00 00
for the script to fail.
I tried to upgrade my elftosb tool, but i failed to find a new one (https://community.nxp.com/t5/MCUXpresso-Secure-Provisioning/where-to-find-elftosb-sources/m-p/173185...).
Also, I know that elftosb was replaced by nxpimage, but as far as i know it doesn't support my target:

I tried reading this (https://spsdk.readthedocs.io/en/latest/apps/nxpimage.html#nxpimage-sb21) documentation but honestly, I can't find how to use this for my case.
My guess is that this particular byte configuration is read in some mysterious way, but I couldn't find any information about this. Here is a glimpse of some of the bytes that caused script to fail:

I attached my files. There are .bin files that you can use as i did. Change type of .txt file to .bd (i couldn't include .bd file).