Sysbuild and MCUboot porting build error

Hi,

I am working on a project with an nrf9160 on a custom board that I first developed with NCS v2.6.1.

I am trying to upgrade to latest NCS v2.9.1 but I am facing an issue a link stage.

I moved my custom board definition to HW model v2 without any (visible) issue and I want to move the build system to sysbuild and use MCUboot as immutable first-stage bootloader.
If followed the different guides and looked at how it has been done in the existing samples in NCS repository but I am facing an issue at link time where it says that a section does not fit in FLASH region.

Here is the result of the partition manager report.

I don't know where to start to investigate this issue. Also I am not sure to fully understand what are the different image built in non-secure mode (b0, s0, s1, ...).

Regards

Alexandre

Parents
  • Hello,

    Please check what the size of the main app was in your  project based on v2.6.1 and also create a partition manager report of that project for comparison. The NSIB bootloader (B0) and the s0 and s1 slots are included when you enable SB_CONFIG_SECURE_BOOT_APPCORE and it results in less available space for the application slots.

    Best regards,

    Vidar

  • Hello and thanks for your answer !

    Unfortunately adding version 2.9.1 broke my 2.6.1 installation.
    I get a cmake error regarding python when trying to build:

  • Hello,

    Have you tried using an older version of the NCS toolchain? It looks like you are currently using v2.8.0.

  • Sorry for the delay,

    I tried to specify the toolchain to use because I have both NCS version 2.6.1 and 2.9.1 installed but it does not work. I end up removing toolchain for 2.9.1 but I still have the same issue with toolchain 2.6:

    It still tries to run interpreter in toolchain b77d8c1312 which correspond to toolchain for 2.9.1 (I think).

    I will try to clean my env and reinstall it.

  • I assume this path does not exist anymore since you have removed the toolcain: /home/alexandre/ncs/toolchains/b77d8c1312/usr/local/bin/python3? Either way, I think you should be able to build the previous project with the new toolchain.

  • Ok finally was able to recreate both 2.6.1 and 2.9.1 working environment.

    The problem is the one described in the error (ofc), my image is too big.

    - With NCS v2.6.1, I was using nrf immutable bootlader with a single app section (~984kB).

    - With NCS v2.9.1 and mcuboot I now have 2 app section much smaller (416kB) wich is not enough for my app (~515kB).

    I will try to reduce my app size but I would like to first use mcuboot in single app image mode in order to get back to a single 900kB section and later I will add an external flash to switch to dual image mode.

    What config do I need to add (and where) to achieve single image mode this (using sysbuild) and where do I define the slot size ? Because of the SPM, defining it in DTS does not work right ?

    Regards,

  • Zoptune said:
    - With NCS v2.6.1, I was using nrf immutable bootlader with a single app section (~984kB).

    The memory report does not show any bootloaders, only TF-M and app. If you want to support DFU with only one bootloader you need to select MCUBoot as your immutable bootloader and make sure you are not enabling SB_CONFIG_SECURE_BOOT_APPCORE in your project configuration.

Reply
  • Zoptune said:
    - With NCS v2.6.1, I was using nrf immutable bootlader with a single app section (~984kB).

    The memory report does not show any bootloaders, only TF-M and app. If you want to support DFU with only one bootloader you need to select MCUBoot as your immutable bootloader and make sure you are not enabling SB_CONFIG_SECURE_BOOT_APPCORE in your project configuration.

Children
  • Yes you are right my bad.

    Now that that I explicitly added SB_CONFIG_SECURE_BOOT_APPCORE=n I am getting a nicer partition report

    Now the problem I have is that I still have 2 "small" mcuboot partitions.

    I want to have only one big mcuboot partition.

    I am trying to use options like CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP or CONFIG_SINGLE_APPLICATION_SLOT but I don't know where to put them (prj.conf, sysbuild.conf, sysbuild/mcuboot/app.conf).
    Or should I also modify the flash0 in the DTS ? I am a bit lost with the partition manager.

  • Single slot DFU is currently only possible with the USB or UART transport. Please have a look at this devacademy course at https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/ for more details about the DFU solution.

  • Thanks.

    Looking at the course I realized that I was using CONFIG_MCUBOOT_BOOTLOADER_MODE_SINGLE_APP instead of SB_CONFIG_MCUBOOT_MODE_SINGLE_APP.

    It works great now :)