You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run a Device Firmware Update on an ESP32C3 with MCUBoot using CAN. I am using the flash_img_api to write a new firmware into slot1 partition after which I request a swap to it from MCUBoot using boot_request_upgrade.
The steps that I do are:
Transfer 8-byte CAN messages to the ESP32C3 and copy the data to a 1024-byte buffer.
When the 1024-byte buffer is full I write it to the slot1_partition flash area using flash_img_buffered_write. I get the flash area ID like this:
I clear the 1024-byte buffer and repeat till the whole new firmware is received.
I check that the MCUBoot header is valid using boot_read_bank_header
I request MCUBoot to do a test swap with boot_request_upgrade
Reboot with sys_reboot(SYS_REBOOT_COLD);
All of the functions return 0 i.e. succeed and when rebooting after the swap request I get:
[esp32c3] [INF] Image index: 0, Swap type: test
[esp32c3] [INF] Loading image 0 - slot 0 from flash, area id: 1
There is a noticeable pause after the Swap type: test line during booting which I think means that the swap is happening, but the original image is still loaded. The received firmware is not run. I cannot find similar issues like this online, I have tried looking into how other firmware upgrade libraries and samples do this to no success.
Here is the flash DTS for the ESP32C3:
&flash0 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserve 60kB for the bootloader */
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000F000>;
read-only;
};
/* Reserve 1024kB for the application in slot 0 */
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
/* Reserve 1024kB for the application in slot 1 */
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
/* Reserve 256kB for the scratch partition */
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to run a Device Firmware Update on an ESP32C3 with MCUBoot using CAN. I am using the flash_img_api to write a new firmware into slot1 partition after which I request a swap to it from MCUBoot using boot_request_upgrade.
The steps that I do are:
Transfer 8-byte CAN messages to the ESP32C3 and copy the data to a 1024-byte buffer.
When the 1024-byte buffer is full I write it to the slot1_partition flash area using
flash_img_buffered_write
. I get the flash area ID like this:I clear the 1024-byte buffer and repeat till the whole new firmware is received.
I check that the MCUBoot header is valid using
boot_read_bank_header
I request MCUBoot to do a test swap with
boot_request_upgrade
Reboot with
sys_reboot(SYS_REBOOT_COLD);
All of the functions return 0 i.e. succeed and when rebooting after the swap request I get:
There is a noticeable pause after the
Swap type: test
line during booting which I think means that the swap is happening, but the original image is still loaded. The received firmware is not run. I cannot find similar issues like this online, I have tried looking into how other firmware upgrade libraries and samples do this to no success.Here is the flash DTS for the ESP32C3:
Beta Was this translation helpful? Give feedback.
All reactions