can't use cdc recovery mode in mcuboot

nrf5340dk

sdk version v2.0.0

windows10 system

hello_world sample

prj.conf:

CONFIG_BOOTLOADER_MCUBOOT=y

child_image/mcuboot.conf:

CONFIG_SINGLE_APPLICATION_SLOT=y
CONFIG_MCUBOOT_SERIAL=y
CONFIG_BOOT_SERIAL_CDC_ACM=y
CONFIG_MCUBOOT_INDICATION_LED=y
CONFIG_MAIN_STACK_SIZE=10240
CONFIG_LOG_DEFAULT_LEVEL=0
CONFIG_NCS_MCUBOOT_IN_BUILD=y
CONFIG_PARTITION_MANAGER_ENABLED=y
CONFIG_FPROTECT=y
CONFIG_FLASH=y
CONFIG_CBPRINTF_NANO=y
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y

build result:  

[278/288] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
cmd.exe /C "cd . && C:\xxxxxx\toolchain\opt\bin\arm-none-eabi-gcc.exe   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=C:/xxx/ncs/workspace/single_slot_CDC_recovery/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/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/drivers/usb/device/libdrivers__usb__device.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/flash/libdrivers__flash.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_cc310/lib..__nrf__drivers__hw_cc310.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/mbedtls/libmodules__mbedtls.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main/nofp"  -LC:/xxx/workspace/single_slot_CDC_recovery/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  C:/xxx/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.13.a  -no-pie  -mcpu=cortex-m33  -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 && cmd.exe /C "cd /D C:\xxx\ncs\workspace\single_slot_CDC_recovery\build\mcuboot\zephyr && C:\xxx\toolchain\opt\bin\cmake.exe -E echo ""
c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr\zephyr_pre0.elf section `text' will not fit in region `FLASH'
c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 9649 bytes
c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/libzephyr.a(serial_adapter.c.obj): in function `boot_console_init':
C:\xxx\bootloader\mcuboot\boot\zephyr\serial_adapter.c:114: undefined reference to `__device_dts_ord_95'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
[113/132] Linking C executable zephyr\zephyr_pre0.elf

[116/132] Linking C executable zephyr\zephyr_pre1.elf

[120/132] Building C object zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj
FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 
cmd.exe /C "cd /D C:\xxx\workspace\single_slot_CDC_recovery\build\mcuboot && C:\xxx\toolchain\opt\bin\cmake.exe --build . --"
[122/132] Linking C executable zephyr\zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       22540 B     998912 B      2.26%
            SRAM:        6200 B       512 KB      1.18%
        IDT_LIST:          0 GB         2 KB      0.00%
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\xxx\toolchain\opt\bin\cmake.EXE' --build 'c:\xxx\ncs\workspace\single_slot_CDC_recovery\build'

how can i check the flash size of the final file  ?

and how can i expend the flash size ?

I try to use config_FLASH_SIZE , but it doesn't seem to work

Parents Reply Children
  • hi  Susheel Nuguru

    i add a dts.overlay file to project

    what about that ?

    [282/295] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/xxx/modules/hal/nordic/nrfx/drivers/src/nrfx_usbd.c.obj
    [283/295] Linking C static library modules\hal_nordic\nrfx\libmodules__hal_nordic__nrfx.a
    [284/295] Linking C static library modules\mbedtls\libmodules__mbedtls.a
    [285/295] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    cmd.exe /C "cd . && C:xxx\toolchain\opt\bin\arm-none-eabi-gcc.exe   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=C:/xxx/workspace/single_slot_CDC_recovery/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/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/drivers/usb/device/libdrivers__usb__device.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/flash/libdrivers__flash.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_cc310/lib..__nrf__drivers__hw_cc310.a  modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  modules/mbedtls/libmodules__mbedtls.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main/nofp"  -LC:/xxx/workspace/single_slot_CDC_recovery/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  C:/xxx/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.13.a  -no-pie  -mcpu=cortex-m33  -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 && cmd.exe /C "cd /D C:\xxx\workspace\single_slot_CDC_recovery\build\mcuboot\zephyr && C:\xxx\toolchain\opt\bin\cmake.exe -E echo ""
    c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr\zephyr_pre0.elf section `text' will not fit in region `FLASH'
    c:/xxx/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: region `FLASH' overflowed by 12820 bytes
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [155/176] Linking C executable zephyr\zephyr_pre0.elf
    
    [159/176] Linking C executable zephyr\zephyr_pre1.elf
    
    [164/176] Building C object zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj
    FAILED: modules/mcuboot/mcuboot_subimage-prefix/src/mcuboot_subimage-stamp/mcuboot_subimage-build mcuboot/zephyr/zephyr.hex mcuboot/zephyr/zephyr.elf 
    cmd.exe /C "cd /D C:\xxx\workspace\single_slot_CDC_recovery\build\mcuboot && C:\xxx\toolchain\opt\bin\cmake.exe --build . --"
    [166/176] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       22540 B     998912 B      2.26%
                SRAM:        6200 B       512 KB      1.18%
            IDT_LIST:          0 GB         2 KB      0.00%
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'c:\xxx\toolchain\opt\bin\cmake.EXE' --build 'c:\xxx\single_slot_CDC_recovery\build'

  • This is a linker error.I am not able to reproduce this without your whole setup, can you please attach your project here?

Related