Failing to build; region `FLASH' overflowed by 680 bytes

I am in process up migrating a legacy project from SDK v2.4 to v3.2 and going through each revision incrementally to catch all the changes needed to modernize it and maintain functionality.  I am able to build up to SDK v2.6.1 so far but stepping to v2.7.0 I am apparently running out of space, even though none of the configuration or source files have changed.  The target board uses an nrf52840 and what is especially peculiar is that the same code with the same proj.conf file and build configuration but targeting a board with an nrf52832 fits just fine, even though that chip has half the FLASH and a fraction of the RAM.  Clearly I'm missing a setting or something but honestly the Zephyr build environment is painfully opaque and unintuitive so I'm having trouble tracking it down.  For reference, the specific error I'm getting during build is:

[254/259] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/<REDACTED>/mcuboot/zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\ce3b5ff664\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe  -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=C:/<REDACTED>/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/arm/nordic_nrf/lib..__modules__soc-hwmv1__soc__arm__nordic_nrf.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/mbedtls/libmbedTLSBase.a  modules/mbedtls/libmbedTLSCrypto.a  modules/mbedtls/libmbedTLSX509.a  modules/mbedtls/libmodules__mbedtls.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp"  -LC:/<REDACTED>/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  modules/mbedtls/libmbedTLSBase.a  modules/mbedtls/libmbedTLSCrypto.a  modules/mbedtls/libmbedTLSX509.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  C:/ncs/v2.7.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_platform_0.9.19.a
&& cmd.exe /C "cd /D C:\<REDACTED>\mcuboot\zephyr && C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe -E true""c:/ncs/toolchains/ce3b5ff664/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 `rodata' will not fit in region `FLASH'
c:/ncs/toolchains/ce3b5ff664/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 680 bytes
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Parents
  • I tried removing giant swathes of code from my project (both functions and static variables) and it still says I am exactly 680 bytes too big...  Which leads me to believe the problem lies outside of my code, and likely in the bootloader.  Is there an easy way to check how big the bootloader is and how big the container that it is being put into is?

  • You can check the CONFIG_PM_PARTITION_SIZE_MCUBOOT value in the .config file under build/mcuboot/zephyr and try to increase it. 

  • The only line(s) in the build log that maybe seems suspect is:

    === child image mcuboot -  begin ===
    loading initial cache file C:/Projects/<REDACTED>/build/mcuboot/child_image_preload.cmake

    The rest contains a few warnings (most of which I'm already planning to address, after) but none look like they would impact the mcuboot image.  The full (redacted) build log is below.

    -----------------------------------------------------------------------------------

     *  Executing task: nRF Connect: Build [pristine]: <REDACTED>/build (active) 

    Building <REDACTED>
    west build --build-dir c:/Projects/<REDACTED>/build c:/Projects/<REDACTED> --pristine --board my_board --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION="NONE" -DCONF_FILE="prj.conf" -DDEBUG_THREAD_INFO=On -DCONFIG_DEBUG_THREAD_INFO=y -Dmcuboot_EXTRA_CONF_FILE=C:/ncs/v2.7.0/nrf/subsys/partition_manager/partition_manager_enabled.conf -Dmcuboot_CONF_FILE=c:/Projects/<REDACTED>/child_image/mcuboot/prj.conf -DBOARD_ROOT=c:/projects/<REDACTED>

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Projects/<REDACTED>
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache
    -- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: my_board
    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/Projects/<REDACTED>/boards/arm/MyBoard/my_board.dts
    -- Generated zephyr.dts: C:/Projects/<REDACTED>/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Projects/<REDACTED>/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Projects/<REDACTED>/build/zephyr/dts.cmake

    warning: THREAD_MONITOR (defined at kernel/Kconfig:471) was assigned the value 'n' but got the value
    'y'. See docs.zephyrproject.org/.../kconfig.html and/or look up
    THREAD_MONITOR in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.


    warning: Deprecated symbol GPIO_AS_PINRESET is enabled.


    warning: Experimental symbol BT_LL_SW_SPLIT is enabled.

    Parsing C:/ncs/v2.7.0/zephyr/Kconfig
    Loaded configuration 'C:/Projects/<REDACTED>/boards/arm/MyBoard/my_board_defconfig'
    Merged configuration 'C:/Projects/<REDACTED>/prj.conf'
    Merged configuration 'C:/Projects/<REDACTED>/build/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to 'C:/Projects/<REDACTED>/build/zephyr/.config'
    Kconfig header saved to 'C:/Projects/<REDACTED>/build/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Deprecation Warning at C:/ncs/v2.7.0/zephyr/soc/CMakeLists.txt:15 (message):


                ---------------------------------------------------------------------
                --- WARNING: Functionality to describe SoCs in HWMv1 is           ---
                --- deprecated and should be replaced with HWMv2, including       ---
                --- boards. HWMv1 SoCs support remains only to ease the migration ---
                --- of out-of-tree SoCs and associated boards. It will not be     ---
                --- possible to build using HWMv1 SoCs at all in future releases. ---
                ---------------------------------------------------------------------


    CMake Warning at C:/ncs/v2.7.0/zephyr/subsys/bluetooth/controller/CMakeLists.txt:4 (message):
      

      CONFIG_BT_CTLR_ADVANCED_FEATURES=y, Advanced Features' default value change
      could change Zephyr Bluetooth Controller's functional behavior.


    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found version "3.9.13") found components: Interpreter

    === child image mcuboot -  begin ===
    loading initial cache file C:/Projects/<REDACTED>/build/mcuboot/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.7.0/zephyr/.cache
    -- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: my_board
    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/Projects/<REDACTED>/boards/arm/MyBoard/my_board.dts
    -- Found devicetree overlay: C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/app.overlay
    -- Generated zephyr.dts: C:/Projects/<REDACTED>/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Projects/<REDACTED>/build/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Projects/<REDACTED>/build/mcuboot/zephyr/dts.cmake

    warning: PRINTK (defined at subsys/debug/Kconfig:204) was assigned the value 'n' but got the value
    'y'. See docs.zephyrproject.org/.../kconfig.html and/or look up PRINTK in
    the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
    Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.


    warning: Deprecated symbol GPIO_AS_PINRESET is enabled.

    Parsing C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/Projects/<REDACTED>/boards/arm/MyBoard/my_board_defconfig'
    Merged configuration 'c:/Projects/<REDACTED>/child_image/mcuboot/prj.conf'
    Merged configuration 'C:/ncs/v2.7.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration 'C:/Projects/<REDACTED>/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to 'C:/Projects/<REDACTED>/build/mcuboot/zephyr/.config'
    Kconfig header saved to 'C:/Projects/<REDACTED>/build/mcuboot/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Deprecation Warning at C:/ncs/v2.7.0/zephyr/soc/CMakeLists.txt:15 (message):


                ---------------------------------------------------------------------
                --- WARNING: Functionality to describe SoCs in HWMv1 is           ---
                --- deprecated and should be replaced with HWMv2, including       ---
                --- boards. HWMv1 SoCs support remains only to ease the migration ---
                --- of out-of-tree SoCs and associated boards. It will not be     ---
                --- possible to build using HWMv1 SoCs at all in future releases. ---
                ---------------------------------------------------------------------


    CMake Warning at C:/ncs/v2.7.0/nrf/lib/flash_patch/CMakeLists.txt:8 (message):


            ----------------------------------------------------------
            --- WARNING: To maintain the integrity of secure boot, ---
            --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---
            ----------------------------------------------------------


    CMake Deprecation Warning at C:/ncs/v2.7.0/nrf/cmake/partition_manager.cmake:32 (message):


                ---------------------------------------------------------------------
                --- WARNING: Child and parent image functionality is deprecated   ---
                --- and should be replaced with sysbuild. Child and parent image  ---
                --- support remains only to allow existing customer applications  ---
                --- to build and allow porting to sysbuild, it is no longer       ---
                --- receiving updates or new features and it will not be possible ---
                --- to build using child/parent image at all in nRF Connect SDK   ---
                --- version 2.9 onwards.                                          ---
                ---------------------------------------------------------------------
    Call Stack (most recent call first):
      C:/ncs/v2.7.0/zephyr/cmake/modules/kernel.cmake:253 (include)
      C:/ncs/v2.7.0/zephyr/cmake/modules/zephyr_default.cmake:141 (include)
      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:12 (find_package)


    MCUBoot bootloader key file: c:/Projects/<REDACTED>/child_image/mcuboot/my_private_key.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Projects/<REDACTED>/build/mcuboot
    === child image mcuboot -  end ===

    CMake Deprecation Warning at C:/ncs/v2.7.0/nrf/cmake/partition_manager.cmake:32 (message):


                ---------------------------------------------------------------------
                --- WARNING: Child and parent image functionality is deprecated   ---
                --- and should be replaced with sysbuild. Child and parent image  ---
                --- support remains only to allow existing customer applications  ---
                --- to build and allow porting to sysbuild, it is no longer       ---
                --- receiving updates or new features and it will not be possible ---
                --- to build using child/parent image at all in nRF Connect SDK   ---
                --- version 2.9 onwards.                                          ---
                ---------------------------------------------------------------------
    Call Stack (most recent call first):
      C:/ncs/v2.7.0/zephyr/cmake/modules/kernel.cmake:253 (include)
      C:/ncs/v2.7.0/zephyr/cmake/modules/zephyr_default.cmake:141 (include)
      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:2 (find_package)


    CMake Warning at C:/ncs/v2.7.0/nrf/cmake/partition_manager.cmake:102 (message):
      

              ---------------------------------------------------------------------
              --- WARNING: Using a bootloader without pm_static.yml.            ---
              --- There are cases where a deployed product can consist of       ---
              --- multiple images, and only a subset of these images can be     ---
              --- upgraded through a firmware update mechanism. In such cases,  ---
              --- the upgradable images must have partitions that are static    ---
              --- and are matching the partition map used by the bootloader     ---
              --- programmed onto the device.                                   ---
              ---------------------------------------------------------------------
              

    Call Stack (most recent call first):
      C:/ncs/v2.7.0/zephyr/cmake/modules/kernel.cmake:253 (include)
      C:/ncs/v2.7.0/zephyr/cmake/modules/zephyr_default.cmake:141 (include)
      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.7.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:2 (find_package)


    -- Configuring done
    -- Generating done
    CMake Warning:
      Manually-specified variables were not used by the project:

        DEBUG_THREAD_INFO


    -- Build files have been written to: C:/Projects/<REDACTED>/build
    ←[92m-- west build: building application
    [8/383] Generating include/generated/version.h
    -- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr), build: v3.6.99-ncs2
    [13/383] Performing build step for 'mcuboot_subimage'
    [7/259] Generating include/generated/version.h
    -- Zephyr version: 3.6.99 (C:/ncs/v2.7.0/zephyr), build: v3.6.99-ncs2
    [12/259] Building C object zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.7.0/nrfxlib/crypto/nrf_cc310_platform/src/nrf_cc3xx_platform_abort_zephyr.c.o[31/259] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/C_/ncs/v2.7.0/modules/crypto/mbedtls/library/ssl_debug_helpers_gener[44/259] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.7.0/modules/hal/nordic/nrfx/mdk/system_nr[46/259] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.7.0/modules/hal/nordic/nrfx/helpers/nrfx_[48/259] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/C_/ncs/v2.7.0/modules/crypto/mbedtls/library/ssl_debug_helpers_gener[49/259] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.7.0/modules/hal/nordic/nrfx/drivers/src/n[62/259] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.7.0/modules/hal/nordic/nrfx/helpers/nrfx_[136/259] Building ASM object zephyr/soc/soc/arm/nordic_nrf/CMakeFiles/..__modules__soc-hwmv1__soc__arm__nordic_nrf.dir/common/soc_nrf_common.S[138/259] Building C object zephyr/soc/soc/arm/nordic_nrf/CMakeFiles/..__modules__soc-hwmv1__soc__arm__nordic_nrf.dir/validate_enabled_instance[139/259] Building C object zephyr/soc/soc/arm/nordic_nrf/CMakeFiles/..__modules__soc-hwmv1__soc__arm__nordic_nrf.dir/validate_base_addresses.c[179/259] Building C object modules/mcuboot/boot/bootutil/zephyr/CMakeFiles/mcuboot_util.dir/C_/ncs/v2.7.0/bootloader/mcuboot/boot/bootutil/src[254/259] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Projects/<REDACTED>/build/mcuboot/zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\ncs\toolchains\ce3b5ff664\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe  -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=C:/Projects/<REDACTED>/build/mcuboot/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/arm/nordic_nrf/lib..__modules__soc-hwmv1__soc__arm__nordic_nrf.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/mbedtls/libmbedTLSBase.a  modules/mbedtls/libmbedTLSCrypto.a  modules/mbedtls/libmbedTLSX509.a  modules/mbedtls/libmodules__mbedtls.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp"  -LC:/Projects/<REDACTED>/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  modules/mbedtls/libmbedTLSBase.a  modules/mbedtls/libmbedTLSCrypto.a  modules/mbedtls/libmbedTLSX509.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  C:/ncs/v2.7.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/soft-float/no-interrupts/libnrf_cc310_platform_0.9.19.a && cmd.exe /C "cd /D C:\Projects\<REDACTED>\build\mcuboot\zephyr && C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe -E true""c:/ncs/toolchains/ce3b5ff664/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 `rodata' will not fit in region `FLASH'
    c:/ncs/toolchains/ce3b5ff664/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 680 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [56/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [58/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [59/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [60/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [61/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [62/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [63/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [64/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [65/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [66/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [67/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [68/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [70/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [71/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [73/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [74/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [77/383] Building C object CMakeFiles/app.dir/src/<REDACTED>.c.obj
    [366/383] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf C:/Projects/<REDACTED>/build/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build C:/Projects/<REDACTED>/build/mcuboot/zephyr/zephyr.hex C:/Projects/<REDACTED>/build/mcuboot/zephyr/zephyr.elf
    cmd.exe /C "cd /D C:\Projects\<REDACTED>\build\mcuboot && C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe --build . --"
    [368/383] Linking C executable zephyr\zephyr_pre0.elf
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' --build 'c:\Projects\<REDACTED>\build'

     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

  • Try to build with "-Dmcuboot_CONF_FILE=prj_minimal.conf" to see if it helps. 

  • Ok, couple new data points:

    • If I change my build configuration Extra CMake arguments to "-Dmcuboot_CONF_FILE=prj_minimal.conf" it builds without overflowing
    • Changing to "-Dmcuboot_CONF_FILE=C:/ncs/v2.7.0/bootloader/mcuboot/boot/zephyr/prj_minimal.conf" also builds within permitted size
    • Editing the prj.conf file in the local mcuboot subdirectoy to mimic the above and using that builds  within size
    • Experimenting with adding back in the original contents of the local prj.conf, the only line that seems to cause issues (meaning it no longer links within the permitted size) is the removal of "CONFIG_BOOT_USE_MIN_PARTITION_SIZE=y"

    I cannot find any documentation from Google searching on what exactly this directive does or why I would want it set to either yes or no.

  • Ok, but what does that mean?  Why wouldn't it always "Build for a minimal image size"?  What specifically changes if that option is not yes or is omitted altogether?

Reply Children
Related