Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion when performing the image swap #2146

Open
lefebvresam opened this issue Dec 12, 2024 · 5 comments
Open

Assertion when performing the image swap #2146

lefebvresam opened this issue Dec 12, 2024 · 5 comments

Comments

@lefebvresam
Copy link

lefebvresam commented Dec 12, 2024

I wrote some test programs with mbed-ce and cmake.
After the first run, something is written in de flash chip and after a reboot I always get:

assertion "rc == 0" failed: file "/home/sam/git/mcuboot/mcuboot/boot/bootutil/src/swap_misc.c", line 105, function: swap_status_init

Test projects are open:

git clone [email protected]:saleconix/mcuboot.git
git clone [email protected]:saleconix/mcuboot_app.git

Because there is a mux chip between the MCU and the flash I inserted in mcuboot main, but with no effect:

#define SEL_STM 0
#define SEL_GPU 1
...
DigitalOut sfselect(SPIF_SEL); 
sfselect.write(SEL_STM); // Claim STM access to serial flash

Full log log.txt

@nordicjm
Copy link
Collaborator

The mbed port of MCUboot is not and has not been maintained for quite some time and is unlikely to be looked at again due to the whole project being abandoned. If you cannot replicate said issue without mbed then I would suggest moving to an alternative supported platform

@lefebvresam
Copy link
Author

This is not an option because I spent 2 years in developing a product that once began with mbed when it wtill was active. Then I switched to mbed-ce and the bootloader is now the final part of the development. Of course for next developments or next products I will look to alternatives.

@nordicjm
Copy link
Collaborator

You don't need to build the bootloader in the mbed port to boot an mbed application, depending upon your host MCU, if it's supported in zephyr you could set up your board in zephyr, configure partitions as they are in your mbed application then build the bootloader using zephyr and use it with your mbed application, that is what I would suggest (depending upon effort required), otherwise you would likely have to look at the unmaintained mbed code here to find issues and patch them/post PRs to fix it

@lefebvresam
Copy link
Author

I think it must be a setting somewhere; when I add in bootutil_public.c at the point something is written in the image trailer:

    align = flash_area_align(fap);
    BOOT_LOG_DBG("inlen %d", inlen);
    BOOT_LOG_DBG("align %d", align);
    align = ALIGN_UP(inlen, align);
    BOOT_LOG_DBG("align %d", align);
    BOOT_LOG_DBG("boot_max_align %d", BOOT_MAX_ALIGN);
    if (align > BOOT_MAX_ALIGN) {
        return -1;
    }

I get:

[DBG ][MCUb]: writing swap_info; fa_id=2 off=0x1ffd8 (0x80fffd8), swap_type=0x2 image_num=0x0
[DBG ][MCUb]: inlen 1
[DBG ][MCUb]: align 16
[DBG ][MCUb]: align 16
[DBG ][MCUb]: boot_max_align 8
[DBG ][MCUb]: boot_write_swap_info returns -1
assertion "rc == 0" failed: file "/home/sam/git/mcuboot/mcuboot/boot/bootutil/src/swap_misc.c", line 106, function: swap_status_init

@lefebvresam
Copy link
Author

lefebvresam commented Dec 14, 2024

The solution is to add a config at both in mcuboot as in the app:

    "macros": [
        "MCUBOOT_BOOT_MAX_ALIGN=16"
    ],

Il looks like a setting in the mbed port wich is not provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants