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.

[544/549] Linking C executable zephyr/zephyr_pre0.elf
...
/home/alexandre/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
/home/alexandre/ncs/toolchains/b77d8c1312/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 154696 bytes
collect2: error: ld returned 1 exit status

Here is the result of the partition manager report.

  flash_primary (0x100000 - 1024kB): 
+--------------------------------------------------+
+---0x0: b0_container (0x8000 - 32kB)--------------+
| 0x0: b0 (0x8000 - 32kB)                          |
+---0x8000: s0 (0xc000 - 48kB)---------------------+
| 0x8000: s0_pad (0x200 - 512B)                    |
+---0x8200: s0_image (0xbe00 - 47kB)---------------+
| 0x8200: mcuboot (0xbe00 - 47kB)                  |
+--------------------------------------------------+
| 0x14000: EMPTY_0 (0x4000 - 16kB)                 |
+---0x18000: s1 (0xc000 - 48kB)--------------------+
| 0x18000: s1_pad (0x200 - 512B)                   |
| 0x18200: s1_image (0xbe00 - 47kB)                |
+--------------------------------------------------+
| 0x24000: EMPTY_1 (0x4000 - 16kB)                 |
+---0x28000: mcuboot_primary (0x68000 - 416kB)-----+
+---0x28000: tfm_secure (0x8000 - 32kB)------------+
| 0x28000: mcuboot_pad (0x200 - 512B)              |
+---0x28200: app_image (0x67e00 - 415kB)-----------+
+---0x28200: mcuboot_primary_app (0x67e00 - 415kB)-+
| 0x28200: tfm (0x7e00 - 31kB)                     |
+---0x30000: tfm_nonsecure (0x60000 - 384kB)-------+
| 0x30000: app (0x60000 - 384kB)                   |
+--------------------------------------------------+
| 0x90000: mcuboot_secondary (0x68000 - 416kB)     |
| 0xf8000: EMPTY_2 (0x6000 - 24kB)                 |
+---0xfe000: nonsecure_storage (0x2000 - 8kB)------+
| 0xfe000: settings_storage (0x2000 - 8kB)         |
+--------------------------------------------------+

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

Related