DFU OTA For nrf52840 dongle.

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Dongle-2"
CONFIG_BT_MAX_CONN=20

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_COUNT=12

CONFIG_ZCBOR=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_IMG_MANAGER=y
CONFIG_STREAM_FLASH=y

CONFIG_MCUMGR=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n
CONFIG_BOOTLOADER_MCUBOOT=y


This is my prj.conf file. I want to enable DFU OTA for my dongle. But on compiling I'm getting this error.
/opt/nordic/ncs/toolchains/580e4ef81c/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'
/opt/nordic/ncs/toolchains/580e4ef81c/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 8280 bytes

Parents Reply Children
  • Executing task: nRF Connect: Generate config nrf52840dongle_nrf52840 for /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2 
    
    Building CureFit-Dongle-Code-2
    west build --build-dir /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2 /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2 --pristine --board nrf52840dongle_nrf52840 -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/prj.conf
    
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2
    -- CMake version: 3.21.0
    -- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /Users/arjitpatel/Library/Caches/zephyr
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.2/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf52840dongle_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
    -- Found Dtc: /opt/nordic/ncs/toolchains/580e4ef81c/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") 
    -- Found BOARD.dts: /opt/nordic/ncs/v2.6.2/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
    -- Generated zephyr.dts: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/zephyr/dts.cmake
    Parsing /opt/nordic/ncs/v2.6.2/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v2.6.2/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840_defconfig'
    Merged configuration '/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/prj.conf'
    Configuration saved to '/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/zephyr/.config'
    Kconfig header saved to '/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (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: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v2.6.2/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.2/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
      CONFIG_USB_DEVICE_PID has default value 0x100.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.2/nrf/samples/common/mcumgr_bt_ota_dfu/CMakeLists.txt:14 (message):
      MCUmgr Bluetooth OTA DFU: suboptimal configuration of Bluetooth Controller
      buffers.  Consider using optimal values defined in the
      /opt/nordic/ncs/v2.6.2/nrf/samples/common/mcumgr_bt_ota_dfu/Kconfig file
      for CONFIG_BT_BUF_ACL_TX_SIZE, CONFIG_BT_BUF_ACL_RX_SIZE and
      CONFIG_BT_CTLR_DATA_LENGTH_MAX options
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.2/nrf/samples/common/mcumgr_bt_ota_dfu/CMakeLists.txt:27 (message):
      MCUmgr Bluetooth OTA DFU: suboptimal configuration of Bluetooth Host
      buffers.  Consider using optimal values defined in the
      /opt/nordic/ncs/v2.6.2/nrf/samples/common/mcumgr_bt_ota_dfu/Kconfig file
      for CONFIG_BT_BUF_ACL_TX_SIZE, CONFIG_BT_BUF_ACL_RX_SIZE and
      CONFIG_BT_L2CAP_TX_MTU options
    
    
    -- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found version "3.9.6") found components: Interpreter 
    
    === child image mcuboot -  begin ===
    loading initial cache file /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: /opt/nordic/ncs/v2.6.2/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.21.0
    -- Found Python3: /opt/nordic/ncs/toolchains/580e4ef81c/opt/[email protected]/bin/python3.9 (found suitable version "3.9.6", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /Users/arjitpatel/Library/Caches/zephyr
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.2/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf52840dongle_nrf52840
    -- Found host-tools: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk)
    -- Found Dtc: /opt/nordic/ncs/toolchains/580e4ef81c/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") 
    -- Found BOARD.dts: /opt/nordic/ncs/v2.6.2/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840.dts
    -- Found devicetree overlay: /opt/nordic/ncs/v2.6.2/nrf/modules/mcuboot/usb.overlay
    -- Generated zephyr.dts: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/dts.cmake
    
    warning: LOG_DEFAULT_LEVEL (defined at subsys/logging/Kconfig.filtering:13) was assigned the value
    '0' but got the value ''. Check these unsatisfied dependencies: LOG (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_DEFAULT_LEVEL and/or look up
    LOG_DEFAULT_LEVEL 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: The choice symbol MCUBOOT_LOG_LEVEL_INF (defined at
    subsys/logging/Kconfig.template.log_config:17) was selected (set =y), but no symbol ended up as the
    choice selection. See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MCUBOOT_LOG_LEVEL_INF
    and/or look up MCUBOOT_LOG_LEVEL_INF 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: The choice symbol LOG_MODE_MINIMAL (defined at subsys/logging/Kconfig.mode:28) was selected
    (set =y), but no symbol ended up as the choice selection. See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOG_MODE_MINIMAL and/or look up
    LOG_MODE_MINIMAL 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.
    
    Parsing /opt/nordic/ncs/v2.6.2/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration '/opt/nordic/ncs/v2.6.2/zephyr/boards/arm/nrf52840dongle_nrf52840/nrf52840dongle_nrf52840_defconfig'
    Merged configuration '/opt/nordic/ncs/v2.6.2/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration '/opt/nordic/ncs/v2.6.2/bootloader/mcuboot/boot/zephyr/boards/nrf52840dongle_nrf52840.conf'
    Merged configuration '/opt/nordic/ncs/v2.6.2/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/.config'
    Kconfig header saved to '/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (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: /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v2.6.2/zephyr/subsys/usb/device/CMakeLists.txt:22 (message):
      CONFIG_USB_DEVICE_VID has default value 0x2FE3.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.2/zephyr/subsys/usb/device/CMakeLists.txt:28 (message):
      CONFIG_USB_DEVICE_PID has default value 0x100.
    
      This value is only for testing and MUST be configured for USB products.
    
    
    CMake Warning at /opt/nordic/ncs/v2.6.2/nrf/lib/flash_patch/CMakeLists.txt:8 (message):
      
    
            ----------------------------------------------------------
            --- WARNING: To maintain the integrity of secure boot, ---
            --- enable CONFIG_DISABLE_FLASH_PATCH in production.   ---
            ----------------------------------------------------------
    
    
    -- Using ccache: /opt/nordic/ncs/toolchains/580e4ef81c/bin/ccache
    MCUBoot bootloader key file: /opt/nordic/ncs/v2.6.2/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot
    === child image mcuboot -  end ===
    
    CMake Warning at /opt/nordic/ncs/v2.6.2/nrf/modules/mcuboot/CMakeLists.txt:382 (message):
      
    
              ---------------------------------------------------------
              --- WARNING: Using default MCUBoot key, it should not ---
              --- be used for production.                           ---
              ---------------------------------------------------------
              
    
    
    
    -- Using ccache: /opt/nordic/ncs/toolchains/580e4ef81c/bin/ccache
    CMake Warning at /opt/nordic/ncs/v2.6.2/nrf/cmake/partition_manager.cmake:79 (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):
      /opt/nordic/ncs/v2.6.2/zephyr/cmake/modules/kernel.cmake:248 (include)
      /opt/nordic/ncs/v2.6.2/zephyr/cmake/modules/zephyr_default.cmake:138 (include)
      /opt/nordic/ncs/v2.6.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      /opt/nordic/ncs/v2.6.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:2 (find_package)
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2
    -- west build: building application
    [1/260] Preparing syscall dependency handling
    
    [6/260] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.2/zephyr), build: v3.5.99-ncs1-2
    [1/216] Preparing syscall dependency handling
    
    [4/216] Generating include/generated/version.h
    -- Zephyr version: 3.5.99 (/opt/nordic/ncs/v2.6.2/zephyr), build: v3.5.99-ncs1-2
    [211/216] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/zephyr_pre0.map 
    : && ccache /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc  -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=/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/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/libsoc__arm__nordic_nrf.a  zephyr/boards/boards/arm/nrf52840dongle_nrf52840/libboards__arm__nrf52840dongle_nrf52840.a  zephyr/drivers/usb/device/libdrivers__usb__device.a  zephyr/drivers/usb/common/nrf_usbd_common/libdrivers__usb__common__nrf_usbd_common.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/zcbor/libmodules__zcbor.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m+fp/hard"  -L/Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfpu=fpv4-sp-d16  -mfloat-abi=hard  -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  /opt/nordic/ncs/v2.6.2/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.19.a  /opt/nordic/ncs/v2.6.2/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr && /opt/nordic/ncs/toolchains/580e4ef81c/Cellar/cmake/3.21.0/bin/cmake -E true
    /opt/nordic/ncs/toolchains/580e4ef81c/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'
    /opt/nordic/ncs/toolchains/580e4ef81c/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 7768 bytes
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [243/260] Linking C static library zephyr/libzephyr.a
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/zephyr.hex /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot/zephyr/zephyr.elf 
    cd /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2/mcuboot && /opt/nordic/ncs/toolchains/580e4ef81c/Cellar/cmake/3.21.0/bin/cmake --build . --
    [245/260] Linking C executable zephyr/zephyr_pre0.elf
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/580e4ef81c/bin/cmake --build /Users/arjitpatel/Desktop/CureFit-Dongle-Code-2/build_2
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

  • Seems the flash overflow error is from MCUboot.

    Configure mcuboot in child_image/mcuboot.conf.

    First we can try to just increase space for MCUboot by setting CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000 in this conf file.

    Does that fix the error?

    If so, we can try to reduce MCUboot size later.

Related