Hi,
Followed the Readme carefully, but the last step failed. The signed binary file downloaded from the PC but did not move to the primary slot after reboot as expected. For some reason the Bootloader thinks the image is faulty and erased it.
Used both padded and unpadded images.
python imgtool.py sign --key C:\nxp\IMXRT\SDK_2_15_100_MIMXRT1170-EVKB\boards\evkbmimxrt1170\ota_examples\mcuboot_opensource\cm7\keys\sign-rsa2048-priv.pem --align 4 --header-size 0x400 --pad-header --slot-size 0x200000 --max-sectors 800 --version "1.18.0" C:\Users\geo15\Documents\MCUXpressoIDE_11.9.0_2144\workspace\evkbmimxrt1170_ota_mcuboot_client_enet\Debug\evkbmimxrt1170_ota_mcuboot_client_enet.bin ota.bin --pad --confirm
Possible solutions?
Terminal output.
OTA HTTPS client demo (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.164
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ ota 0 /ota.bin 10.1.15.119 4433
Started OTA with:
image = 0
file = /ota.bin
host = 10.1.15.119
port = 4433
. Seeding the random number generator...
. Loading the CA root certificate... ok (0 skipped)
. Loading the client cert. and key... ok
. Connecting to 10.1.15.119:4433
. Setting up the SSL/TLS structure... ok
. SSL state connect : 0
. Performing the SSL/TLS handshake...
[ Protocol is TLSv1.2 ]
[ Ciphersuite is TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384 ]
[ Record expansion is 29 ]
. Verifying peer X.509 certificate... SKIPPED
Getting size of requested file '/ota.bin'
Determined file size is 255016 bytes
Starting download of 255016 bytes with block size of 4096 bytes
...............................................................
Download loop completed with size 255016, expected 255016
MD5 hexdump of downloaded data:
00000000 AE 1E E3 BC FB AA 51 24 E5 88 A9 01 F2 95 E2 CC |......Q$........|
MD5 hexdump of flashed data:
00000000 AE 1E E3 BC FB AA 51 24 E5 88 A9 01 F2 95 E2 CC |......Q$........|
OTA image was downloaded successfully.
$ image info
Image 0; name APP; state Permanent:
Slot 0; slotAddr 30040000; slotSize 2097152
<EMPTY>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253656; version 1.18.0.0>
$ image test 0
write magic number offset = 0x43ff00
$ image info
Image 0; name APP; state ReadyForTest:
Slot 0; slotAddr 30040000; slotSize 2097152
<EMPTY>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253656; version 1.18.0.0>
$ reboot
System reset!
hello sbl.
Disabling flash remapping function
Bootloader Version 1.10.0
Image 0 Primary slot: Image not found
Secondary slot: version=1.18.0+0
Found a candidate in slot 1
writing copy_done; fa_id=1 off=0x1fffe0 (0x43ffe0)
Image 0 loaded from the secondary slot
Bootloader chainload address offset: 0x240000
Reset_Handler address offset: 0x240400
Jumping to the image
Booting the secondary slot - flash remapping is enabled
OTA HTTPS client demo (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.164
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ image info
Image 0; name APP; state Testing:
Slot 0; slotAddr 30040000; slotSize 2097152
<EMPTY>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253656; version 1.18.0.0>
$ hello sbl.
Disabling flash remapping function
Bootloader Version 1.10.0
Image 0 Primary slot: Image not found
Secondary slot: version=1.18.0+0
Erasing faulty image in the secondary slot.
No slot to load for image 0
Unable to find bootable image
Solved! Go to Solution.
Hi @drb55 ,
I'm sorry for the trouble this error has caused you, and for that I sincerely apologize. And thank you for pointing out this discrepancy.
I received a response from the internal team regarding this issue:
This difference is due to the use of the remap function. For platforms like RT1050 and RT1020, they do not have a remap function, so mcuboot needs to move the image from slot2 to slot1. but for platforms that support the remap function, you can choose which slot to jump to by simply enabling or disabling the remap function. Due to the SDK readme generation mechanism, it caused the doc issue.
In the meantime, the issue has been reported and will be fixed in a later released version.
Wish you a nice day.
Best regards,
Gavin
Hi @drb55 ,
Thanks for your interest in NXP MIMXRT series!
I have tested with RT1060EVK on my side, it should be same as RT1170 except the flash address.
Please confirm a few points:
1. Signed application images directly programmed into flash memory by a programmer require additional "--pad --confirm" parameter for imgtool. This parameter adds additional trailer to the signed image and is required by bootloader direct-xip process (see MCUBoot documentation for more information). Signed images used in OTA process do not require "-pad" parameter.
2. Use Jlink to flash the signed client's image to flash at address 0x3004_0000 instead of 0x3004_0400.
I read your log and found that slot0 is always EMPTY, which is not correct.
Here is my log:
Following the steps should result in good news.
Best regards,
Gavin
Hi,
Updated as you suggested, and a different message occurs. Images built without padding and Release configuration.
OTA HTTPS client demo (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.179
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ hello sbl.
Disabling flash remapping function
Bootloader Version 1.10.0
Primary slot: version=1.6.0+0
Secondary slot: version=1.7.0+0
Image 0 loaded from the secondary slot
Bootloader chainload address offset: 0x240000
Reset_Handler address offset: 0x240400
Jumping to the image
Booting the secondary slot - flash remapping is enabled
OTA HTTPS client demo (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.179
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ image info
Image 0; name APP; state Permanent:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 303792; version 1.6.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 303792; version 1.7.0.0>
$ image test 0
write magic number offset = 0x23ff00
$ image info
Image 0; name APP; state ReadyForTest:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 303792; version 1.6.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 303792; version 1.7.0.0>
$ hello sbl.
Disabling flash remapping function
Bootloader Version 1.10.0
Primary slot: version=1.6.0+0
Secondary slot: version=1.7.0+0
Found a candidate in slot 0
writing copy_done; fa_id=0 off=0x1fffe0 (0x23ffe0)
Image 0 loaded from the primary slot
Bootloader chainload address offset: 0x40000
Reset_Handler address offset: 0x40400
Jumping to the image
Booting the primary slot - flash remapping is disabled
OTA HTTPS client demo (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.179
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ image info
Image 0; name APP; state Testing:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 303792; version 1.6.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 303792; version 1.7.0.0>
$ image accept 0
Deleting header of inactive image in secondary slot (downgrade support for direct-xip)
$ image info
Image 0; name APP; state Permanent:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 303792; version 1.6.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<EMPTY>
Hi @drb55 ,
I think your operation should be successful. How do you tell if the operation was successful? By the version information of the two images? I don't see reboot in your second operation.
For me, the distinction is made by two identical IMAGES, with only the difference in print information.(V1 or V2)
image test 0 --> reboot --> image --> image accept 0
On the success of the Reboot step, the candidate image is executed. The subsequent steps are simply to remove the header of the inactive IMAGE.
Best regards,
Gavin
Hi,
Based on your suggestions I now have images in both slots. Why does the Bootloader boot from the image in the Secondary Slot and delete header of inactive image in primary slot (downgrade support for direct-xip) instead of moving the image in the Secondary Slot to the Primary Slot?
The Readme document says the image in the Secondary Slot should be moved to the Primary Slot.
Can you explain the discrepancy between the documentation and the actual result?
Disabling flash remapping function
Bootloader Version 1.10.0
Primary slot: version=2.1.0+0
Image 0 Secondary slot: Image not found
Found a candidate in slot 0
writing copy_done; fa_id=0 off=0x1fffe0 (0x23ffe0)
Image 0 loaded from the primary slot
Bootloader chainload address offset: 0x40000
Reset_Handler address offset: 0x40400
Jumping to the image
Booting the primary slot - flash remapping is disabled
OTA HTTPS client demo V1V1V1 (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.110
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ image info
Image 0; name APP; state None:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 253664; version 2.1.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<EMPTY>
$ ota 0 /ota.bin 10.1.15.119 4433
Started OTA with:
image = 0
file = /ota.bin
host = 10.1.15.119
port = 4433
. Seeding the random number generator...
. Loading the CA root certificate... ok (0 skipped)
. Loading the client cert. and key... ok
. Connecting to 10.1.15.119:4433
. Setting up the SSL/TLS structure... ok
. SSL state connect : 0
. Performing the SSL/TLS handshake...
[ Protocol is TLSv1.2 ]
[ Ciphersuite is TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384 ]
[ Record expansion is 29 ]
. Verifying peer X.509 certificate... SKIPPED
Getting size of requested file '/ota.bin'
Determined file size is 255024 bytes
Starting download of 255024 bytes with block size of 4096 bytes
...............................................................
Download loop completed with size 255024, expected 255024
MD5 hexdump of downloaded data:
00000000 D0 B2 1D E5 3E CD 0C EE D5 DE 5B D3 4B F5 95 49 |....>.....[.K..I|
MD5 hexdump of flashed data:
00000000 D0 B2 1D E5 3E CD 0C EE D5 DE 5B D3 4B F5 95 49 |....>.....[.K..I|
OTA image was downloaded successfully.
$ image info
Image 0; name APP; state None:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 253664; version 2.1.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253664; version 2.2.0.0>
$ image test 0
write magic number offset = 0x43ff00
$ image info
Image 0; name APP; state ReadyForTest:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 253664; version 2.1.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253664; version 2.2.0.0>
$ hello sbl.
Disabling flash remapping function
Bootloader Version 1.10.0
Primary slot: version=2.1.0+0
Secondary slot: version=2.2.0+0
Found a candidate in slot 1
writing copy_done; fa_id=1 off=0x1fffe0 (0x43ffe0)
Image 0 loaded from the secondary slot
Bootloader chainload address offset: 0x240000
Reset_Handler address offset: 0x240400
Jumping to the image
Booting the secondary slot - flash remapping is enabled
OTA HTTPS client demo V2V2V2 (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.110
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ image info
Image 0; name APP; state Testing:
Slot 0; slotAddr 30040000; slotSize 2097152
<IMAGE APP_PRIMARY: size 253664; version 2.1.0.0>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253664; version 2.2.0.0>
$ image accept 0
Deleting header of inactive image in primary slot (downgrade support for direct- xip)
$ hello sbl.
Disabling flash remapping function
Bootloader Version 1.10.0
Image 0 Primary slot: Image not found
Secondary slot: version=2.2.0+0
Image 0 loaded from the secondary slot
Bootloader chainload address offset: 0x240000
Reset_Handler address offset: 0x240400
Jumping to the image
Booting the secondary slot - flash remapping is enabled
OTA HTTPS client demo V2V2V2 (Ethernet)
Initializing PHY...
Obtaining IP address from DHCP...
************************************************
OTA HTTPS Client Example
************************************************
IPv4 Address : 10.1.15.110
IPv4 Subnet mask : 255.255.255.0
IPv4 Gateway : 10.1.15.1
************************************************
Copyright 2022 NXP
$ image info
Image 0; name APP; state Permanent:
Slot 0; slotAddr 30040000; slotSize 2097152
<EMPTY>
Slot 1; slotAddr 30240000; slotSize 2097152
<IMAGE APP_SECONDARY: size 253664; version 2.2.0.0>
$
Hi,
Thanks for pointing this out. I am consulting with internal team and will keep you updating in this thread.
Best regards,
Gavin
Hi,
Does anyone in development actually read the documentation and readme files for accuracy or is NXP hoping the customers will find the errors and point them out.
Hi @drb55 ,
I'm sorry for the trouble this error has caused you, and for that I sincerely apologize. And thank you for pointing out this discrepancy.
I received a response from the internal team regarding this issue:
This difference is due to the use of the remap function. For platforms like RT1050 and RT1020, they do not have a remap function, so mcuboot needs to move the image from slot2 to slot1. but for platforms that support the remap function, you can choose which slot to jump to by simply enabling or disabling the remap function. Due to the SDK readme generation mechanism, it caused the doc issue.
In the meantime, the issue has been reported and will be fixed in a later released version.
Wish you a nice day.
Best regards,
Gavin
Hi,
I think it would have been better to publish accurate documentation instead of me wasting my time asking a question and you answering a question which is probably unnecessary but that's just my opinion. Hoping for better documentation from NXP in the future, not holding my breath.