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:
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).
Hi @mbora
I hope that you are doing well.
The MCUXpresso Secure Provisioning tool (SPT for short )v7.0 implements elftosb to generated signed (HAB) images, v8 now implements nxpimage instead. The SPT v7.0 runs elftosb 5.1.19. You could download our SPTv7.0 and take the elftosb.exe from there and test.
I saw that you are using kinetis command , rather than i.MX command when generating your SB file. Another thing is that I do not recognize your input binaries as raw i.MX RT application images, apparently, you are working on a custom file, not a raw i.MX RT application image. This could limit our support ability for this scenario. Could you clarify? The SPT v7 or V8, should support you to generate signed images for High Assurance Boot (HAB)
Thanks for your patience.
Diego
Hi @mbora
Many thanks for your response!
I understand and thanks for your report. Since elftosb is now deprecated, I can not compromise to solve this issue. If you are still willing to get an example of the use of nxpimage for SB2.1 please generate a signed image for the LPC55s69 with the SPT v8.0. Below an example.
nxpimage succeeded
### Create SB file ###
nxpimage sb21 export -c "C:\...\gen_sb\sb2_config.yaml" -o "C:\..\bootable_images\led_blinky_0x00000000.sb"
RKTH: 28ae2d68f21fd1c34f8f47ddd5c12c4b9f3d1baffa4d89eb1387307bc7cd8dcf
Success.
(Secure binary 2.1: C:\...\bootable_images\led_blinky_0x00000000.sb created.)
nxpimage succeeded)
I hope this could help you!
Diego
Hi Maria,
Thanks for your reply! the sb 21 export command generates a sb file using a config template (Generate Secure Binary v2.1 Image, according to documentation ) My apologies, I have not explained why I mentioned the LPC55s69, I showed this MCU since its signed images are in sb2.1 and that is it. Currently, I do not have more examples to show, rather than recommend you look at the SPT log output. I cannot guarantee that the nxpimage will be able to generate a sb for a custom binary. But feel free to test with our tools, to see if they work for you. Let me know if there is anything else I could do for you.
Diego
Hi Diego,
according to the documentation:
I should be able to use binary files. My .bd configuration file starts with:
thus, everything should work fine. But I come with an issue:
Could you tell me what the error means?
Thanks,
Maria
Hi Maria,
I have not used this command before; I presume that you may have been missing keys? Did you had success using the LPC55s69 example?
There is another tool that you might use. it is the image tool from the open source MCU bootloader project. I think this tool might also be a choice for you since, it is not specifically dedicated for NXP MCUs. We use the image tool for a project called SBL, please check to this command in the MCUOTASBLSFWUG
My apologies for the delay, I hope this could help.
Diego