RAM overflow migrating from ncs 2.2.0 to v2.4.4

Hi,

I'm working on a project using MCUboot, TFM, and a network core app. We use MCUboot with an external flash module for OTA firmware updates.

Recently, we tried upgrading from ncs v2.2.0 to v2.4.4 but keep hitting a RAM overflow error when compiling the network core firmware.

arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `bss' will not fit in region `RAM'
c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `RAM' overflowed 

We first tried updating pm_static.yml for the new TFM requirements, then using partition manager to create partitions. Both approaches still gave the RAM overflow.

When migrating sdk, we compared the nRF5340 DK board file changes between v2.2.0 and v2.4.4 and applied relevant changes to our board files.

Attached is a modified "TFM - hello world" example with mcuboot, a network core image, and our custom board.

7317.tfm_hello_world.zip

Compiling this firmware with our board yields the error below when building the network core image.

: region `RAM' overflowed by 245896 bytes

However, compiling with the nRF5340 DK board file works fine.

I compared the generated partitions.yml from our custom board vs nRF5430 builds - all RAM partitions look identical. So I'm stumped on why we're getting RAM overflow.

Would anyone be able to give some pointers on what I'm missing?

Thanks,

  • Hi, 

    I can reproduce the issue on nRF53DK with QSPI external flash, but still time to investigate the issue. 

    Regards,
    Amanda H.

  • Hi, 

    The overflow is likely in the bootloader because CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY selects the CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS symbol. Do you see the same if you add CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=n to your project configuration? and also enable CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM in the child_image/mcuboot.conf if you want to support the netcore updates with TFM.

    -Amanda H.

  • Hi Amanda,

    Thanks for your reply.

    Adding CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=n has helped with the RAM overflow issue, however, i'm still having some form of partition issues.

    When I set the config option CONFIG_UPDATEABLE_IMAGE_NUMBER=2 for setting the ability to upgrade both application and network core, I get the following errors

    C:/ncs/v2.4.4/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:52:12: error: 'PM_MCUBOOT_SECONDARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_SECONDARY_ID'?
       52 |            PM_MCUBOOT_SECONDARY_1_ID: \
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.4.4/bootloader/mcuboot/boot/bootutil/src/bootutil_misc.c:161:35: note: in expansion of macro 'FLASH_AREA_IMAGE_SECONDARY'
      161 |         flash_area_get_id(fap) == FLASH_AREA_IMAGE_SECONDARY(image_index)) {
          |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.4.4/bootloader/mcuboot/boot/bootutil/src/bootutil_misc.c: In function 'boot_find_status':
    C:/ncs/v2.4.4/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:45:12: error: 'PM_MCUBOOT_PRIMARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
       45 |            PM_MCUBOOT_PRIMARY_1_ID :         \

    Do you know what could be causing these errors?

    I have managed to recreate the issue on my tfm_hello_world example attached below.
    8233.tfm_hello_world.zip

    Thanks,

  • When adding the thread config options to the example you provided I get RAM and FLASH sizing issues when compiling the network core (see below).

    c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `text' will not fit in region `FLASH'
    
    c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr\zephyr_pre0.elf section `noinit' will not fit in region `RAM'
    
    c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `FLASH' overflowed by 26456 bytes
    
    c:/ncs/toolchains/31f4403e35/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: region `RAM' overflowed by 12284 bytes

    Could this be an issue with including the multiprotocol child image?

    Steps to reproduce issue

    1. Checkout v2.4.4 commit dadbc79f3abc6a2098546885958c3ce9e6286064 of the parent git repository "samples_for_nrf_connect_sdk".

    2. Add multiprotocol config options to "mcuboot_smp_ble_simultaneous"
    prj.conf

    # Generic networking options
    CONFIG_NETWORKING=y
    CONFIG_ASSERT=y
    CONFIG_ASSERT_NO_COND_INFO=y
    # Enable OpenThread features set
    CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y
    CONFIG_OPENTHREAD_SOURCES=y
    CONFIG_NET_L2_OPENTHREAD=y
    CONFIG_ADD_MCUBOOT_MEDIATE_SIM_FLASH_DTS=n #RAM fix

    child_image/mcuboot.conf
    CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y

    3. Compile "mcuboot_smp_ble_simultaneous" for *nrf5340dk_ns

    Thanks,

Related