mcu-tools / mcuboot

Secure boot for 32-bit Microcontrollers!
Apache License 2.0
1.32k stars 668 forks source link

Encountered **USAGE FAULT** while Booting up with new firmware image. #1667

Closed Shrini-007 closed 11 months ago

Shrini-007 commented 1 year ago

We are using STM32H753 with zephyr v2.7.2 along with MCUBoot v1.8.0 with some changes backported related to flash alignment and boot magic.

We are using IS25LP128 external 16MB flash for storing the new firmware image(signed .bin file). Here is our flash partitions for internal and external flash looks like.

&flash0 { partitions { compatible = "fixed-partitions"; boot_partition: partition@0 { label = "mcuboot"; reg = <0x00000000 0x00032000>; read-only; }; scratch_partition: partition@32000 { label = "image-scratch"; reg = <0x00032000 0x00020000>; }; info_partition: partition@52000 { label = "info"; reg = <0x00052000 0x800>; }; slot0_partition: partition@52800 { label = "image-0"; reg = <0x0052800 0x0015B800>; }; }; };

&is25lp128 { partitions { compatible = "fixed-partitions"; storage_partition: partition@0 { label = "storage"; reg = <0x00000000 0x00020000>; }; slot1_partition: partition@20000 { label = "image-1"; reg = <0x00020000 0x0015B800>; }; ota0_partition: partition_ota@1C0000 { label = "ota-0"; reg = <0x001C0000 0x00070000>; }; ota1_partition: partition_ota@230000 { label = "ota-1"; reg = <0x00230000 0x00070000>; }; }; };

We are using MCUmgr tool to upload new signed FW(.bin file) to secondary slot (i.e slot1 partition). We are using SWAP USING SCRATCH algorithm for upgrading the FW.

Note: We are using MCUBoot v1.9.0 script for signing FW.

Please see below logs for referance.

I: IS25LP128: SFDP v 1.6 AP ff with 2 PH I: PH0: ff00 rev 1.6: 16 DW @ 30 I: IS25LP128: 16 MiBy flash I: PH1: 029d rev 1.5: 3 DW @ 80 I: Device IS25LP128 initialized Booting Zephyr OS build zephyr-v2.7.2  I: Starting bootloader I: Loaded encryption key I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Boot source: primary slot I: Swap type: perm I: Starting swap using scratch algorithm. I: Bootloader chainload address offset: 0x52800 I: Jumping to the first image slot E: SPSEL in thread mode does not indicate PSP E: USAGE FAULT E:   Attempt to execute undefined instruction E: r0/a1:  0x82192d2d  r1/a2:  0xcc06454e  r2/a3:  0x78bc4d3f E: r3/a4:  0xde0fa02c r12/ip:  0xc205f193 r14/lr:  0x7890a176 E:  xpsr:  0x2ae16200 E: Faulting instruction address (r15/pc): 0xfcd8ad85 E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0 E: Current thread: 0x240003e0 (unknown) E: Halting system

Not getting what is exactly causing the issue. Please do let us know any thoughts or suggestions.

Thanks in advance.

ilyhcg commented 1 year ago

I also encountered the same problem,But it's when the program is running

github-actions[bot] commented 12 months ago

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.