This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[NCS v1.8.0] netboot build error

Dear friend,

Since the customized nRF5340 board does not have an external 32.768KHz low-frequency crystal oscillator, the following is added to prj.conf in netboot:

# 32kHz clock source
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

The build will appear the following error:

[144/151] Linking C executable zephyr\zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map
cmd.exe /C "cd . && E:\ncs\v1.8.0\toolchain\opt\bin\arm-none-eabi-gcc.exe   zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr\zephyr_prebuilt.elf  -Wl,-T  zephyr/linker_zephyr_prebuilt.cmd  -Wl,-Map=E:/ncs/v1.8.0/nrf/samples/nrf5340/netboot/build_nrf5340dk_nrf5340_cpunet/zephyr/zephyr_prebuilt.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a  zephyr/drivers/flash/libdrivers__flash.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/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/pcd/lib..__nrf__subsys__pcd.a  modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.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"e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main/nofp"  -LE:/ncs/v1.8.0/nrf/samples/nrf5340/netboot/build_nrf5340dk_nrf5340_cpunet/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  E:/ncs/v1.8.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m33+nodsp/soft-float/liboberon_3.0.8.a  -mcpu=cortex-m33+nodsp  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -no-pie  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn && cmd.exe /C "cd /D E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet\zephyr && E:\ncs\v1.8.0\toolchain\opt\bin\cmake.exe -E echo ""
e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_sem_give':
E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet/zephyr/include/generated/syscalls/kernel.h:953: undefined reference to `z_impl_k_sem_give'
e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_sem_init':
E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet/zephyr/include/generated/syscalls/kernel.h:918: undefined reference to `z_impl_k_sem_init'
e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_mutex_init':
E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet/zephyr/include/generated/syscalls/kernel.h:802: undefined reference to `z_impl_k_mutex_init'
e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_mutex_lock':
E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet/zephyr/include/generated/syscalls/kernel.h:820: undefined reference to `z_impl_k_mutex_lock'
e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_sem_take':
E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet/zephyr/include/generated/syscalls/kernel.h:936: undefined reference to `z_impl_k_sem_take'
e:/ncs/v1.8.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a(temp_nrf5.c.obj): in function `k_mutex_unlock':
E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet/zephyr/include/generated/syscalls/kernel.h:836: undefined reference to `z_impl_k_mutex_unlock'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'E:\ncs\v1.8.0\toolchain\opt\bin\cmake.EXE' --build 'E:\ncs\v1.8.0\nrf\samples\nrf5340\netboot\build_nrf5340dk_nrf5340_cpunet'

prj.conf does not add CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y and CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y to build successfully.
why? How to solve?

  • Try adding CONFIG_MULTITHREADING=y as well to the prj.conf of netboot, then it should build fine. By the way, recently I handled another case where a customer was trying to use the external 32.768KHz with the nRF53DK where CONFIG_BOOTLOADER_MCUBOOT=y and CONFIG_SECURE_BOOT=y was set in the prj.conf file. This was all the changes that had to be done (worked on nRF53DK with disabled XTAL):

    top-level, i.e. the Bluetooth project’s proj.conf:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_SECURE_BOOT=y
    CONFIG_BOOTLOADER_MCUBOOT=y

    hci_rpmsg’s proj.conf (hci_rpmsg):

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y

    nrf5340/netboot (hci_rpmsg/b0n):

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_MULTITHREADING=y

    Bootloader (b0):

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y

    mcuboot

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y

    Modifying all these files is not optimal, and the developers are aware of it. Hopefully we can come up with a solution that makes it easier to do this.

    Best regards,

    Simon

Related