I have been trying to generate encrypted bootable XIP images for my MIMXRT1020 EVK.
1. Using MCUBootUtility
- I downloaded latest MCUBootUtility version from https://github.com/JayHeng/NXP-MCUBootUtility by @kerryzhou.
- I could not access the image_enc.exe in the Baidu server. (Honestly, it doesn't make sense to me why the file is not included in the github repo or placed at a more accessible location like Google Drive. If it's something official from NXP, I would expect it to be on NXP website. I came across multiple forum posts asking for the same file). In the end I managed to download it from this forum post: https://community.nxp.com/t5/i-MX-RT/image-enc2-zip-download/m-p/1174074
I guess the versions of MCUBootUtility and the image_enc.exe are not compatible. When I try to generate an encrypted file from the MCUBootUtility, I see an error saying "Unsupported argument" in the terminal. (Screenshot attached)
I tried running the image_enc.exe manually. Turned out that the "hw_eng=bee" option provided by the MCUBootUtility is not supported by image_enc.exe. But even when that is removed, I get the following error when I try to encrypt the image, even though the start and length of the region are multiples of 1024 (0x400).
Command:
image_enc.exe
ifile=ivt_evkmimxrt1020_iled_blinky_unsigned.bin
ofile=ivt_evkmimxrt1020_iled_blinky_unsigned_bee_encrypted.bin
base_addr=0x60000000
region0_key=0123456789abcdeffedcba9876543210
region0_arg=1,[0x60001000,0x2000,0]
region0_lock=0
use_zero_key=1
is_boot_image=1
Result:
Invalid FAC region range, both start and length must be 1024-byte aligned.
2. Using MCUXpresso Secure Provisioning Tool (SPT)
- I managed to generate an unsigned bootable image and run successfully.
- Then I generated images with "Boot Type" set to "XIP Encrypted (BEE User Keys) Unsigned". This generated 3 files.
1. evkmimxrt1020_iled_blinky_bootable.bin
2. evkmimxrt1020_iled_blinky_bootable_nopadding.bin
3. evkmimxrt1020_iled_blinky_nopadding.bin
Of these 3 files, only (3) seems to be encrypted. But when I load it to the EVK, it doesn't run.
Pleas let me know if I am doing something wrong/missing any steps.