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.