nrf7002dk - region `FLASH' overflowed

Hi,

I am trying to create a Wi-Fi application on nrf7002dk using SMP over Bluetooth LE for Firmware Updates, but I get a "region 'FLASH' overflowed" error when I try to build the project:

[1/11] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
c:/nordicsemi/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: zephyr\zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
c:/nordicsemi/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: region `FLASH' overflowed by 1424 bytes
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[115/263] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/nordicsemi/v2.3.0/modules/hal/nordic/nrfx/drivers/src/nrfx_gpiote.c.obj
FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 

Is there any option to reduce the project's size? I have already disabled the debug options.

Regards,

Candela

Parents Reply Children
  • Hi,

    I followed your recommendations, optimizing flash usage and using an external flash, and I got to reduce significativelly the flash usage. Nevertheless, I still have questions on how to add the mcuboot child image on the external flash. By now, I have used the partition manager to set the mcuboot_secondary region into the external flash, but I still have no enough space for the bootloader and the application on the primary flash. Do I need to move any other region to the external flash?

    I am attaching the output partition manager report.

      external_flash (0x800000 - 8192kB):
    +---------------------------------------------+
    | 0x0: mcuboot_secondary (0xf4000 - 976kB)    |
    | 0xf4000: external_flash (0x70c000 - 7216kB) |
    +---------------------------------------------+
    
      flash_primary (0x100000 - 1024kB):
    +-------------------------------------------------+
    | 0x0: mcuboot (0xc000 - 48kB)                    |
    +---0xc000: mcuboot_primary (0xf4000 - 976kB)-----+
    | 0xc000: mcuboot_pad (0x200 - 512B)              |
    +---0xc200: mcuboot_primary_app (0xf3e00 - 975kB)-+
    | 0xc200: app (0xf3e00 - 975kB)                   |
    +-------------------------------------------------+
    
      otp (0x2fc - 764B):
    +------------------------------+
    | 0xff8100: otp (0x2fc - 764B) |
    +------------------------------+
    
      sram_primary (0x80000 - 512kB):
    +-----------------------------------------------+
    | 0x20000000: pcd_sram (0x2000 - 8kB)           |
    | 0x20002000: sram_primary (0x6e000 - 440kB)    |
    | 0x20070000: rpmsg_nrf53_sram (0x10000 - 64kB) |
    +-----------------------------------------------+
    
     CPUNET flash_primary (0x40000 - 256kB):
    +--------------------------------------------+
    +---0x1000000: b0n_container (0x8800 - 34kB)-+
    | 0x1000000: b0n (0x8580 - 33kB)             |
    | 0x1008580: provision (0x280 - 640B)        |
    +---0x1008800: app (0x37800 - 222kB)---------+
    | 0x1008800: hci_rpmsg (0x37800 - 222kB)     |
    +--------------------------------------------+
    
     CPUNET sram_primary (0x10000 - 64kB):
    +-------------------------------------------+
    | 0x21000000: sram_primary (0x10000 - 64kB) |
    +-------------------------------------------+

    Thanks!

    Candela

  • Candela said:
    but I still have no enough space for the bootloader and the application on the primary flash.

    Can you post the build log showing this?

  • I suspect that this error could be related to MCUboot.
    Try to create the folder child_image in your project, and put this in child_image/mcuboot.conf:

    CONFIG_PM_PARITITON_SIZE_MCUBOOT=0x10000

  • Hi Sigurd, 

    I have tried your proposal, but I am still facing some issues. My setup is as follows:

    child_image/mcuboot.conf file:

    CONFIG_PM_PARITITON_SIZE_MCUBOOT=0x10000

    CMakeLists.txt file:

    cmake_minimum_required(VERSION 3.20.0)
    
    set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/pm.yml)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    
    project(blinky)
    
    add_child_image(
        NAME mcuboot
        SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/child_image
        DOMAIN CPUNET
        )
        
    ...
    

    Doing so, I get the following building error, related to the PM_PARTITION_SIZE_MCUBOOT symbol:

    C:/nordicsemi/Project_Workspace_Realease/Rel/Project_dfu/child_image/mcuboot.conf:1: warning: attempt to assign the value '0x10000' to the undefined symbol PM_PARITITON_SIZE_MCUBOOT
    
    error: Aborting due to Kconfig warnings
    Parsing C:/nordicsemi/v2.3.0/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/nordicsemi/v2.3.0/nrf/boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'C:/nordicsemi/v2.3.0/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration 'C:/nordicsemi/v2.3.0/nrf/subsys/pcd/pcd.conf'
    Merged configuration 'C:/nordicsemi/v2.3.0/nrf/subsys/bootloader/bl_override/override_external_mcuboot.conf'
    Merged configuration 'C:/nordicsemi/v2.3.0/nrf/subsys/partition_manager/ext_flash_mcuboot_secondary.conf'
    Merged configuration 'C:/nordicsemi/v2.3.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration 'C:/nordicsemi/Project_Workspace_Realease/Rel/Project_dfu/child_image/mcuboot.conf'
    Merged configuration 'C:/nordicsemi/Project_Workspace_Realease/Rel/Project_dfu/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    
    CMake Error at C:/nordicsemi/v2.3.0/zephyr/cmake/modules/kconfig.cmake:328 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      C:/nordicsemi/v2.3.0/nrf/cmake/modules/kconfig.cmake:29 (include)
      C:/nordicsemi/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
      C:/nordicsemi/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/nordicsemi/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:44 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    CMake Error at C:/nordicsemi/v2.3.0/nrf/cmake/multi_image.cmake:433 (message):
      CMake generation for mcuboot failed, aborting.  Command: 1
    Call Stack (most recent call first):
      C:/nordicsemi/v2.3.0/nrf/cmake/multi_image.cmake:163 (add_child_image_from_source)
      C:/nordicsemi/v2.3.0/nrf/modules/mcuboot/CMakeLists.txt:234 (add_child_image)
    
    
    -- Configuring incomplete, errors occurred!
    See also "C:/nordicsemi/Project_Workspace_Realease/Rel/Project_dfu/build/CMakeFiles/CMakeOutput.log".
    See also "C:/nordicsemi/Project_Workspace_Realease/Rel/Project_dfu/build/CMakeFiles/CMakeError.log".
    FATAL ERROR: command exited with status 1: 'C:\nordicsemi\toolchains\v2.3.0\opt\bin\cmake.EXE' '-DWEST_PYTHON=C:\nordicsemi\toolchains\v2.3.0\opt\bin\python.exe' '-Bc:\nordicsemi\Project_Workspace_Realease\Rel\Project_dfu\build' -GNinja -DBOARD=nrf7002dk_nrf5340_cpuapp -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONF_FILE:STRING=c:/nordicsemi/Project_Workspace_Realease/Rel/Project_dfu/prj.conf '-Sc:\nordicsemi\Project_Workspace_Realease\Rel\Project_dfu'

    Taking a look into the post you link, I think I would need to add the child image using Zephyr modules, probably because of the use of a multicore architecture of nrf5340 microprocessor.

    I've checked the multicore sample for nrf5340, where Zephyr modules are used to add a different configuration to the CPUNET core, but it is still not clear to me how to use them to add MCUBOOT configurations. Where can I find more info about it?

    Candela

Related