MCUBoot : region `FLASH' overflowed by 2540 bytes on Xiao BLE target

Dear support team and community,

I'm trying to activate the OTA update via BLE on the Xiao BLE card developed by Seeed Studio, which uses the Nordic nRF52840 microcontroller.
I'm using the Blinky sample to test this functionality, nRF Connect SDK v2.3.0.

I first compiled for the target nRF52840dk_nrf52840 with MCUboot as bootloader and MCUmgr to acquire the new firmware via the SMP protocol.

So far so good, but when I try to compile on the Xiao BLE target, I get an error during compilation:
insert error

[192/202] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
: && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/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/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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  zephyr/drivers/pinctrl/libdrivers__pinctrl.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/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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/mcuboot/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cd /home/leanvia/Downloads/blinky/build/mcuboot/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `rodata' will not fit in region `FLASH'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 2540 bytes
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:116: undefined reference to `z_impl_k_usleep'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:149: undefined reference to `z_impl_k_yield'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:955: undefined reference to `z_impl_k_mutex_lock'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:971: undefined reference to `z_impl_k_mutex_unlock'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:1089: undefined reference to `z_impl_k_sem_give'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:1072: undefined reference to `z_impl_k_sem_take'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:1089: undefined reference to `z_impl_k_sem_give'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:1055: undefined reference to `z_impl_k_sem_init'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
/home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
/home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:659: undefined reference to `z_impl_k_queue_get'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
/home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:955: undefined reference to `z_impl_k_mutex_lock'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:971: undefined reference to `z_impl_k_mutex_unlock'
/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
/home/leanvia/Downloads/blinky/build/mcuboot/zephyr/include/generated/syscalls/kernel.h:938: undefined reference to `z_impl_k_mutex_init'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Comparing the configuration files of these 2 targets, I modified the "xiao_ble_defconfig" file and deleted "CONFIG_USB_DEVICE_STACK=y" (this configuration not being present in the "nrf52840dk_nrf52840_defconfig" file. Magically, it compiles and the update works, but I no longer have access to the Xiao BLE's serial port, especially to view the logs.

Here's the prj.conf file for my blinky project:

CONFIG_GPIO=y

#Enable bootloader MCUboot
CONFIG_BOOTLOADER_MCUBOOT=y

# Flash config
CONFIG_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y

# BLE config
CONFIG_BT=y
CONFIG_BT_SETTINGS=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=500

# MCUmgr config
CONFIG_MCUMGR=y

# Enable the storage erase command.
CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y

# # Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies.
# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands,
# transmitted with the maximum possible MTU value: 498 bytes.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
CONFIG_MCUMGR_SMP_REASSEMBLY_BT=y
CONFIG_OS_MGMT_MCUMGR_PARAMS=y
CONFIG_MCUMGR_SMP_WORKQUEUE_STACK_SIZE=4608

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

# Disable Bluetooth ping support
CONFIG_BT_CTLR_LE_PING=n

Thanks in advance for any help you can give me on this subject.

Parents
  • Hi,

     When building this sample for build target xiao_ble with NCS v2.3.0 using the VS Code extension everything looks fine on my end. The build does also look correct w.r.t. size and it should not prompt any 

    [179/179] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       40052 B       788 KB      4.96%
                 RAM:       16640 B       256 KB      6.35%
            IDT_LIST:          0 GB         2 KB      0.00%

    1. Are you able to compile a pristine zephyr/blinky sample with the xiao_ble either with the VS Code extension or through command line using west build -b xiao_ble from the sample respository?
    2. Could you verify which OS you're using?
    3. If you've made any modifications to the sample other than removing the USB config, could you state which?

    Kind regards,
    Andreas

  • Hello Andreas,

    Thanks for your reply, yes I can compile a pristine zephyr/blinky sample with the xiao_ble. I modify the sample to be able to perform OTA DFU using MCUboot as a bootloader. Here is my project folder  blinky_dfu_ota.zip

    I only modify the "prj.conf" file (I write the content in my question), regarding the documentation and the SMP Server sample.

    This code compiles for the target nrf52840dk_nrf52840 but not for the xiao_ble. I'm confused since they use the same microcontroller, same RAM, same FLASH.

  • Noted, I will have a look at the project you provided and get back to you tomorrow. 

    In the meanwhile, here's an unofficial repository containing various DFU samples written by a colleague of mine https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples. You might find this repository useful for adding bootloaders and DFU support to your application in combination with the documentation you've linked

    Kind regards,
    Andreas

  • Hi, 

    I tried some samples of the repository you sent me, but I can't make it work unfortunately.

    I saw there that enable the USB_DEVICE_STACK resulted in 10kb increase in firmware size.

    I've restored the file "zephyr/board/arm/xiao_ble/xiao_ble_defconf" to its original state (set CONFIG_USB_DEVICE_STACK) and I have added a mcuboot.conf file to the child_image folder.

    mcuboot.conf:

    CONFIG_USB_DEVICE_STACK=n

    It's working like that (I can compile, flash and perform DFU) but I do not have any logs coming from MCUboot.

    Moreover, my final goal is to add both NSIB (Nordic Secure Immutable Bootloader) and MCUboot to my project to be able to perform update of MCUboot.

    I have adapted the sample : https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader/nsib_mcuboot_smp to my blinky project but get the following error (I got the same error when just compile the sample without modifications) :

    164/174] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 6632 bytes
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    I've read that I have to set CONFIG_MULTITHREADING when using USB_DEVICE_STACK.

    I created a conf file "b0.conf" to configure the NSIB bootloader and tried to increase its partition, I did the same for mcuboot.conf and I commented the CONFIG_USB_DEVICE_STACK line.

    b0.conf :

    CONFIG_PM_PARTITION_SIZE_B0_IMAGE=0x10000

    mcuboot.conf :

    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
    # Required by USB
    CONFIG_MULTITHREADING=y
    # CONFIG_USB_DEVICE_STACK=n

    I get the following error :

    [20/30] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [22/54] Linking C executable zephyr/zephyr_pre0.elf

    I don't understand where those errors are coming from, I've included the necessary files in main.c

    I'm very confuse.

    Thanks for reading me.

Reply
  • Hi, 

    I tried some samples of the repository you sent me, but I can't make it work unfortunately.

    I saw there that enable the USB_DEVICE_STACK resulted in 10kb increase in firmware size.

    I've restored the file "zephyr/board/arm/xiao_ble/xiao_ble_defconf" to its original state (set CONFIG_USB_DEVICE_STACK) and I have added a mcuboot.conf file to the child_image folder.

    mcuboot.conf:

    CONFIG_USB_DEVICE_STACK=n

    It's working like that (I can compile, flash and perform DFU) but I do not have any logs coming from MCUboot.

    Moreover, my final goal is to add both NSIB (Nordic Secure Immutable Bootloader) and MCUboot to my project to be able to perform update of MCUboot.

    I have adapted the sample : https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/updatable_bootloader/nsib_mcuboot_smp to my blinky project but get the following error (I got the same error when just compile the sample without modifications) :

    164/174] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 6632 bytes
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    I've read that I have to set CONFIG_MULTITHREADING when using USB_DEVICE_STACK.

    I created a conf file "b0.conf" to configure the NSIB bootloader and tried to increase its partition, I did the same for mcuboot.conf and I commented the CONFIG_USB_DEVICE_STACK line.

    b0.conf :

    CONFIG_PM_PARTITION_SIZE_B0_IMAGE=0x10000

    mcuboot.conf :

    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
    # Required by USB
    CONFIG_MULTITHREADING=y
    # CONFIG_USB_DEVICE_STACK=n

    I get the following error :

    [20/30] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [22/54] Linking C executable zephyr/zephyr_pre0.elf

    I don't understand where those errors are coming from, I've included the necessary files in main.c

    I'm very confuse.

    Thanks for reading me.

Children
  • Hi,

    1. Could you check how large the partition sizes are by either navigating to your build folder and entering ninja partition_manager_report or to use the memory report action in the VS Code extension?
    2. Could you try to increase the size of MCUboot either by not defining it to be a set size in mcuboot.conf and let it dynamically allocate its own size or by increasing its size?

      I suspect the culprit is that the bootloader partition(s) is too small, but I'm curious to see if the partition map looks correct or if there is something that causes the primary application slot be smaller than it needs to be.

      On the 52840 you should have sufficient space to fit 2x application slots of roughly 50k, MCUboot and b0 without issues. So 

    In addition to the "Adding a bootloader chain" docs you refer to, I would also recommend the partition manager docs w.r.t. setting up your project with multiple bootloaders. For later stages in your project, you may find the static partitioning section very useful. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html#partition-manager 

    Kind regards,
    Andreas

  • Hi,

    Here is the partition manager report, everything seems ok here (I used here the "child_image/b0.conf" and "child_image/mcuboot.conf" I mentionned in my previous message) :

    The errors when I'm compiling it : 

    [164/174] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [274/307] Linking C static library zephyr/kernel/libkernel.a
    FAILED: modules/nrf/samples/b0_subimage-prefix/src/b0_subimage-stamp/b0_subimage-build b0/zephyr/zephyr.hex b0/zephyr/zephyr.elf 
    cd /home/leanvia/Downloads/blinky/build/b0 && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake --build . --
    [276/307] Linking C executable zephyr/zephyr_pre0.elf
    
    ninja: build stopped: subcommand failed.

    ___________________________________________

    If I remove those files to let partition manager dynamically allocates the bootloader partition sizes, here what I get :

    The flash overflow error appears:

    [164/174] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/zephyr_pre0.elf section `text' will not fit in region `FLASH'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: region `FLASH' overflowed by 6632 bytes
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [274/307] Linking C static library zephyr/kernel/libkernel.a
    FAILED: modules/nrf/samples/b0_subimage-prefix/src/b0_subimage-stamp/b0_subimage-build b0/zephyr/zephyr.hex b0/zephyr/zephyr.elf 
    cd /home/leanvia/Downloads/blinky/build/b0 && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake --build . --
    [276/307] Linking C executable zephyr/zephyr_pre0.elf

    ___________________________________________

    Now, I will increase the partitions of the bootloaders.

    b0.conf :

    CONFIG_PM_PARTITION_SIZE_B0_IMAGE=0x30000

    mcuboot.conf :

    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x30000
    # Required by USB
    CONFIG_MULTITHREADING=y
    # CONFIG_USB_DEVICE_STACK=n

    [164/174] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/leanvia/ncs/toolchains/v2.3.0/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  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/leanvia/Downloads/blinky/build/b0/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/lib/libc/minimal/liblib__libc__minimal.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.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/hwinfo/libdrivers__hwinfo.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a  modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a  modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a  modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a  modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.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"/home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m+fp/hard"  -L/home/leanvia/Downloads/blinky/build/b0/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/liboberon_3.0.12.a  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a  -no-pie  -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  /home/leanvia/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m4/hard-float/no-interrupts/libnrf_cc310_platform_0.9.16.a && cd /home/leanvia/Downloads/blinky/build/b0/zephyr && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_usleep':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:115: undefined reference to `z_impl_k_usleep'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_yield':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:148: undefined reference to `z_impl_k_yield'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_device.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_work':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:143: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_ep_callback':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:193: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_take':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1063: undefined reference to `z_impl_k_sem_take'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_give':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1080: undefined reference to `z_impl_k_sem_give'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:251: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfer':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:279: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_cancel_transfers':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:295: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `usb_transfer_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_transfer.c:348: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_transfer.c.obj): in function `k_sem_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:1046: undefined reference to `z_impl_k_sem_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_rx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:618: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_irq_tx_enable':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:572: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_fifo_fill':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:516: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_poll_out':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:1019: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_write_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:213: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj):/home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:221: more undefined references to `k_work_submit_to_queue' follow
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:479: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:480: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_read_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:288: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(cdc_acm.c.obj): in function `cdc_acm_do_cb':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/class/cdc_acm.c:370: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(usb_work_q.c.obj): in function `z_usb_work_q_init':
    /home/leanvia/ncs/v2.3.0/zephyr/subsys/usb/device/usb_work_q.c:21: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_work_schedule':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:377: undefined reference to `k_work_submit_to_queue'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usbd_evt_put':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:399: undefined reference to `k_queue_append'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `usb_init':
    /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1912: undefined reference to `k_work_queue_start'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/ncs/v2.3.0/zephyr/drivers/usb/device/usb_dc_nrfx.c:1918: undefined reference to `k_work_init'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_lock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:946: undefined reference to `z_impl_k_mutex_lock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_unlock':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:962: undefined reference to `z_impl_k_mutex_unlock'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_queue_get':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:650: undefined reference to `z_impl_k_queue_get'
    /home/leanvia/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/usb/device/libdrivers__usb__device.a(usb_dc_nrfx.c.obj): in function `k_mutex_init':
    /home/leanvia/Downloads/blinky/build/b0/zephyr/include/generated/syscalls/kernel.h:929: undefined reference to `z_impl_k_mutex_init'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [275/307] Linking C executable zephyr/zephyr_pre0.elf
    
    FAILED: modules/nrf/samples/b0_subimage-prefix/src/b0_subimage-stamp/b0_subimage-build b0/zephyr/zephyr.hex b0/zephyr/zephyr.elf 
    cd /home/leanvia/Downloads/blinky/build/b0 && /home/leanvia/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake --build . --
    [277/307] Generating dev_handles.c
    ninja: build stopped: subcommand failed.

    It seems to have no effects on the "undefined reference to  xxx" errors.

    Do you have an idea of what is going on ?

    This is my project tree : 

  • Hi,

    Good to see that increasing MCUBoot size atleast removes the overflow error.

    From Build fail using MCUBOOT and SPI on ncs 1.7.1 it's stated that the "spi" driver depends on a multithreaded system, and the errors in linking indicate that your mcuboot config does not have "CONFIG_MULTITHREADING=y" set?

    Do you know if you're using the SPI or QSPI driver in your project? Does adding this configuration change anything on your end?

    If not, could you post your current revision of your blinky with uppgradable bootloaders and I'll have a look?

    Kind regards,
    Andreas

  • Hi,

    Sorry for the delay, I've tested a lot of things for last time.

    I am not using SPI yet, I will add it later to use an external flash. I already have something functional for this feature.

    I updated my blinky project, here it is : blinky_dfu_ota_v1.1.zip

    I have a CMakePresets.json to build 3 different targets : xiao_ble, nrf52840dk_nrf52840 and xiao_custom.

    The xiao_custom is a board I've created, it's a copy of the xiao_ble board, I've just used the UART instead of the USB to communicate between the microcontroller and the computer.

    Everything works fine with xiao_custom target, exactly like the nrf52840dk_nrf52840 target (that use the UART). As I expected, it is the USB stack that the problem.

    For the nrf52840dk_nrf52840 and xiao_custom targets, I've added support for an external flash to store the firmware update. The 2 bootloaders (NSIB and MCUboot) are enabled. This is the final goal.

    For the xiao_ble target, only the MCUboot bootloader is enabled and USB_DEVICE_STACK is unset in the child_image/mcuboot/boards/xiao_ble.conf file. With this configuration, my application compiles and the update via BLE is functional, but I don't have the MCUboot logs on the USB output. How can I get the MCUboot logs on the USB output? I don't want to use the xiao_ble's UART. The NSIB bootloader is disabled by default for this target in the boards/xiao_ble.conf file. When it is enabled, I get the errors of my previous post "unknow reference ..."

    Firstly, I'd like to be able to use MCUboot with the USB stack and secondly to add the NSIB bootloader by enabling CONFIG_SECURE_BOOT on the xiao_ble target.  The xiao_custom board is used for test purposes (because I don't want to use the UART) and has enabled me to understand that these two problems seem to be linked to the USB stack.

Related