Problem using an external flash together with MCUBOOT

I have I custom board based on a NRF52832. I also have an external SPI Nor flash I use to store data.

I want to add MCUBOOT and don't use the external flash to store the second image. In fact I use the serial recovery if the DFU fails.

If I compile my project with

CONFIG_BOOTLOADER_MCUBOOT=n

I get no compiler error.

If I set

CONFIG_BOOTLOADER_MCUBOOT=y

I get the following compiler error (I couldn't insert it as code):

[25/30] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
cmd.exe /C "cd . && C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe  
-gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o
zephyr\zephyr_pre0.elf  -fuse-ld=bfd  -T  zephyr/linker_zephyr_pre0.cmd  
-Wl,-Map=C:/Nordic/my_repo/my-project/my_name/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/lib/libc/common/liblib__libc__common.a  
zephyr/soc/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  
zephyr/soc/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  
zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/flash/libdrivers__flash.a  
zephyr/drivers/gpio/libdrivers__gpio.a  
zephyr/drivers/pinctrl/libdrivers__pinctrl.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/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a  
modules/mbedtls/libmbedTLSBase.a  modules/mbedtls/libmbedTLSCrypto.a  modules/mbedtls/libmbedTLSX509.a  modules/mbedtls/libmodules__mbedtls.a  
modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  
modules/zcbor/libmodules__zcbor.a  -Wl,--no-whole-archive  
zephyr/kernel/libkernel.a  
zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  
-L"c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp"  
-LC:/Nordic/my_repo/my-project/my_name/build/mcuboot/zephyr  
-lgcc  zephyr/arch/common/libisr_tables.a  
modules/mbedtls/libmbedTLSBase.a  
modules/mbedtls/libmbedTLSCrypto.a  
modules/mbedtls/libmbedTLSX509.a  
-mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  
-Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  
-Wl,-u,_OffsetAbsSyms  
-Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  
-Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie && cmd.exe /C
"cd /D C:\Nordic\my_repo\my-project\my_name\build\mcuboot\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj): in function `k_sleep':
C:\Nordic\my_repo\my-project\my_name\build\mcuboot/zephyr/include/generated/syscalls/kernel.h:135: undefined reference to `z_impl_k_sleep'
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:\Nordic\my_repo\my-project\my_name\build\mcuboot/zephyr/include/generated/syscalls/kernel.h:135: undefined reference to `z_impl_k_sleep'
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_90'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

[...]

ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Nordic\my_repo\my_project\My_name\build'

What does this error mean? Especially what means the error undefined reference to `__device_dts_ord_90'

Parents Reply
  • Hi Dejan,

    I am not sure what line you mean but here is the section of ordinal 90:

    /* Node's dependency ordinal: */
    #define DT_N_S_soc_S_spi_40004000_ORD 90
    #define DT_N_S_soc_S_spi_40004000_ORD_STR_SORTABLE 00090
    
    /* Ordinals for what this node depends on directly: */
    #define DT_N_S_soc_S_spi_40004000_REQUIRES_ORDS \
    	4, /* /soc */ \
    	5, /* /soc/interrupt-controller@e000e100 */ \
    	9, /* /soc/gpio@50000000 */ \
    	28, /* /pin-controller/spi1_default */ \
    	30, /* /pin-controller/spi1_sleep */

    Is this the write code line?

    Kind Regards Paul

Children
Related