mcu-tools / mcuboot

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

NUCLEO_F767ZI mcuboot bootloader crash while upgrading firmware using swapping and scratch region #1728

Closed MarkEvens closed 9 months ago

MarkEvens commented 1 year ago

We are using NUCLEO_F767ZI board for an ethernet application, we need mcuboot as a bootloader, we have followed mbed-mcuboot-blinky and mbed-mcuboot-demo for refrence.

Everything was compiled and the Main application boots up, and We also got success in writing new firmware in the secondary region(SPI Flash). but on reboot(for updating firmware) bootloader get crashed.

Please guide us to solve this issue.

Below is NUCLEO_F767ZI config:

 "NUCLEO_F767ZI": {
            "target.mbed_app_start": "0x8021000",
            "target.mbed_app_size": "0x90000",
            "mcuboot.primary-slot-address": "0x8020000",
            "mcuboot.slot-size": "0x90000",
            "mcuboot.scratch-address": "0x80B1000",
            "mcuboot.scratch-size": "0x40000",
            "mcuboot.max-img-sectors": "0x180",
            "mcuboot.read-granularity": 1
        },

STM32F767ZI MCUboot bootloder crash log:


[INFO][BL]: Starting MCUboot

[DBG ][MCUb]: flash area 0 open count: 1 (+)

[DBG ][MCUb]: initializing flash area 0...

[DBG ][MCUb]: flash area 1 open count: 1 (+)

[DBG ][MCUb]: initializing flash area 1...

[DBG ][MCUb]: flash area 2 open count: 1 (+)

[DBG ][MCUb]: initializing flash area 2...

[DBG ][MCUb]: flash area 0 open count: 2 (+)

[DBG ][MCUb]: flash area 0 open count: 1 (-)

[DBG ][MCUb]: flash area 1 open count: 2 (+)

[DBG ][MCUb]: flash area 1 open count: 1 (-)

[DBG ][MCUb]: flash area 0 open count: 2 (+)

[DBG ][MCUb]: flash area 0 open count: 1 (-)

[DBG ][MCUb]: flash area 2 open count: 2 (+)

[DBG ][MCUb]: flash area 2 open count: 1 (-)

[INFO][MCUb]: Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x3

[INFO][MCUb]: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3

[INFO][MCUb]: Boot source: primary slot

[DBG ][MCUb]: flash area 0 open count: 2 (+)

[DBG ][MCUb]: flash area 0 open count: 1 (-)

[DBG ][MCUb]: flash area 0 open count: 2 (+)

[DBG ][MCUb]: flash area 0 open count: 1 (-)

[DBG ][MCUb]: flash area 1 open count: 2 (+)

[DBG ][MCUb]: flash area 1 open count: 1 (-)

[INFO][MCUb]: Swap type: test

[DBG ][MCUb]: flash area 1 open count: 2 (+)

[DBG ][MCUb]: flash area 1 open count: 3 (+)

[DBG ][MCUb]: flash area 1 open count: 2 (-)

[DBG ][MCUb]: flash area 1 open count: 1 (-)

[DBG ][MCUb]: flash area 0 open count: 2 (+)

[DBG ][MCUb]: flash area 0 open count: 1 (-)

[DBG ][MCUb]: flash area 1 open count: 2 (+)

[DBG ][MCUb]: flash area 1 open count: 1 (-)

[DBG ][MCUb]: flash area 0 open count: 2 (+)

[DBG ][MCUb]: flash area 1 open count: 2 (+)

[DBG ][MCUb]: flash area 2 open count: 2 (+)

[DBG ][MCUb]: erasing scratch area size:262144

[DBG ][MCUb]: RC: -4001

[DBG ][MCUb]: initializing status; fa_id=2

[DBG ][MCUb]: flash area 1 open count: 3 (+)

[DBG ][MCUb]: flash area 1 open count: 2 (-)

[DBG ][MCUb]: writing swap_info; fa_id=2 off=0x3ffd8 (0x80f0fd8), swap_type=0x2 image_num=0x0

[DBG ][MCUb]: writing swap_size; fa_id=2 off=0x3ffd0 (0x80f0fd0)

[DBG ][MCUb]: writing magic; fa_id=2 off=0x3fff0 (0x80f0ff0)

[ERR ][MCUb]: Invalid read: fa_id 1 offset 0x90000 len 0x400

++ MbedOS Error Info ++
Error Status: 0x80FF0144 Code: 324 Module: 255
Error Message: Assertion failed: rc == 0
Location: 0x800AB93
File: .\mcuboot\boot\bootutil\src\swap_scratch.c+574
Error Value: 0x0
For more info, visit: https://mbed.com/s/error?error=0x80FF0144&tgt=NUCLEO_F767ZI
-- MbedOS Error Info --

= System will be rebooted due to a fatal error =
= Reboot count(=1) reached maximum, system will halt after rebooting =ÿ
github-actions[bot] commented 10 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.