Undefined initialization levels used

minimal_log_spi$ west build -b custom_nrf52832

[235/256] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
: && ccache /home/henry/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/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/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/subsys/bluetooth/common/libsubsys__bluetooth__common.a zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a zephyr/subsys/bluetooth/crypto/libsubsys__bluetooth__crypto.a zephyr/subsys/net/libsubsys__net.a zephyr/subsys/random/libsubsys__random.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/i2c/libdrivers__i2c.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/drivers/timer/libdrivers__timer.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a modules/nrf/lib/multithreading_lock/lib..__nrf__lib__multithreading_lock.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/nrf/subsys/bluetooth/controller/lib..__nrf__subsys__bluetooth__controller.a modules/nrf/subsys/mpsl/init/lib..__nrf__subsys__mpsl__init.a modules/nrf/subsys/mpsl/fem/lib..__nrf__subsys__mpsl__fem.a modules/nrf/drivers/mpsl/clock_control/lib..__nrf__drivers__mpsl__clock_control.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/segger/libmodules__segger.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m/nofp" -L/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr -lgcc zephyr/arch/common/libisr_tables.a /home/henry/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/soft-float/liboberon_3.0.12.a -no-pie -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 /home/henry/ncs/v2.3.0/nrfxlib/softdevice_controller/lib/cortex-m4/soft-float/libsoftdevice_controller_peripheral.a /home/henry/ncs/v2.3.0/nrfxlib/mpsl/lib/cortex-m4/soft-float/libmpsl.a && cd /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr && /home/henry/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: orphan section `.z_device_POST_KERNELCONFIG_SPI_NOR_INIT_PRIORITY_' from `app/libapp.a(flash_nor.c.obj)' being placed in section `.z_device_POST_KERNELCONFIG_SPI_NOR_INIT_PRIORITY_'
/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: Undefined initialization levels used.
/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(flash_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_91'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /home/henry/ncs/toolchains/v2.3.0/usr/local/bin/cmake --build /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build

  • minimal_log_spi$ west build -b custom_nrf52832
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi
    -- Using NCS Toolchain 2.3.0 for building. (/home/henry/ncs/toolchains/v2.3.0/cmake)
    -- Cache files will be written to: /home/henry/.cache/zephyr
    -- Zephyr version: 3.2.99 (/home/henry/ncs/v2.3.0/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: custom_nrf52832
    -- Found host-tools: zephyr 0.15.2 (/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.2 (/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found Dtc: /home/henry/ncs/toolchains/v2.3.0/usr/local/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: /home/henry/ncs/v2.3.0/nrf/boards/arm/custom_nrf52832/custom_nrf52832.dts
    -- Generated zephyr.dts: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr/dts.cmake
    
    warning: BT_SETTINGS (defined at subsys/bluetooth/host/Kconfig:183,
    subsys/bluetooth/host/Kconfig:183) was assigned the value 'y' but got the value 'n'. Check these
    unsatisfied dependencies: ((SETTINGS && BT_HCI_HOST && BT_RPC_STACK) || (SETTINGS && BT_HCI_HOST &&
    BT_HCI && BT)) (=n). See http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_SETTINGS and/or
    look up BT_SETTINGS in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.
    
    Parsing /home/henry/ncs/v2.3.0/zephyr/Kconfig
    Loaded configuration '/home/henry/ncs/v2.3.0/nrf/boards/arm/custom_nrf52832/custom_nrf52832_defconfig'
    Merged configuration '/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/prj.conf'
    Configuration saved to '/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr/.config'
    Kconfig header saved to '/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /home/henry/ncs/v2.3.0/zephyr/subsys/bluetooth/host/CMakeLists.txt:99 (message):
      CONFIG_BT_FIXED_PASSKEY is enabled
    
        A fixed passkey is easy to deduce during the pairing procedure, do not use in
        production.
    
    
    -- Found Python3: /home/henry/ncs/toolchains/v2.3.0/usr/local/bin/python3 (found version "3.8.2") found components: Interpreter 
    
    === child image mcuboot -  begin ===
    loading initial cache file /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base).
    -- Application: /home/henry/ncs/v2.3.0/bootloader/mcuboot/boot/zephyr
    -- Using NCS Toolchain 2.3.0 for building. (/home/henry/ncs/toolchains/v2.3.0/cmake)
    -- Found Python3: /home/henry/ncs/toolchains/v2.3.0/usr/local/bin/python3 (found suitable exact version "3.8.2") found components: Interpreter 
    -- Cache files will be written to: /home/henry/.cache/zephyr
    -- Zephyr version: 3.2.99 (/home/henry/ncs/v2.3.0/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: custom_nrf52832
    -- Found host-tools: zephyr 0.15.2 (/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.2 (/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found Dtc: /home/henry/ncs/toolchains/v2.3.0/usr/local/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: /home/henry/ncs/v2.3.0/nrf/boards/arm/custom_nrf52832/custom_nrf52832.dts
    -- Found devicetree overlay: /home/henry/ncs/v2.3.0/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/zephyr/dts.cmake
    
    warning: BOOTLOADER_MCUBOOT (defined at /home/henry/ncs/v2.3.0/nrf/modules/trusted-
    firmware-m/Kconfig:206, Kconfig.zephyr:745) was assigned the value 'y' but got the value 'n'. Check
    these unsatisfied dependencies: (BUILD_WITH_TFM || !MCUBOOT) (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BOOTLOADER_MCUBOOT and/or look up
    BOOTLOADER_MCUBOOT in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.
    
    Parsing /home/henry/ncs/v2.3.0/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration '/home/henry/ncs/v2.3.0/nrf/boards/arm/custom_nrf52832/custom_nrf52832_defconfig'
    Merged configuration '/home/henry/ncs/v2.3.0/bootloader/mcuboot/boot/zephyr/prj.conf'
    Merged configuration '/home/henry/ncs/v2.3.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration '/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
    Configuration saved to '/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/zephyr/.config'
    Kconfig header saved to '/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 12.1.0
    -- The CXX compiler identification is GNU 12.1.0
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
    CMake Warning at /home/henry/ncs/v2.3.0/zephyr/CMakeLists.txt:824 (message):
      No SOURCES given to Zephyr library: drivers__console
    
      Excluding target from build.
    
    
    MCUBoot bootloader key file: /home/henry/ncs/v2.3.0/bootloader/mcuboot/root-rsa-2048.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/mcuboot
    === child image mcuboot -  end ===
    
    CMake Warning at /home/henry/ncs/v2.3.0/nrf/modules/mcuboot/CMakeLists.txt:286 (message):
      
    
              ---------------------------------------------------------
              --- WARNING: Using default MCUBoot key, it should not ---
              --- be used for production.                           ---
              ---------------------------------------------------------
              
    
    
    
    CMake Warning at /home/henry/ncs/v2.3.0/zephyr/CMakeLists.txt:824 (message):
      No SOURCES given to Zephyr library: drivers__console
    
      Excluding target from build.
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build
    -- west build: building application
    [1/256] Preparing syscall dependency handling
    
    [2/256] Generating include/generated/version.h
    -- Zephyr version: 3.2.99 (/home/henry/ncs/v2.3.0/zephyr), build: v3.2.99-ncs2
    [8/256] Performing build step for 'mcuboot_subimage'
    [1/269] Preparing syscall dependency handling
    
    [2/269] Generating include/generated/version.h
    -- Zephyr version: 3.2.99 (/home/henry/ncs/v2.3.0/zephyr), build: v3.2.99-ncs2
    [259/269] Linking C executable zephyr/zephyr_pre0.elf
    
    [263/269] Linking C executable zephyr/zephyr_pre1.elf
    
    [269/269] Linking C executable zephyr/zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       30198 B        48 KB     61.44%
                 RAM:       22400 B        64 KB     34.18%
            IDT_LIST:          0 GB         2 KB      0.00%
    [23/256] Building C object CMakeFiles/app.dir/src/flash_nor.c.obj
    ../src/flash_nor.c: In function 'spi_nor_process_sfdp':
    ../src/flash_nor.c:1031:16: warning: 'rc' is used uninitialized [-Wuninitialized]
     1031 |         return rc;
          |                ^~
    ../src/flash_nor.c:958:13: note: 'rc' was declared here
      958 |         int rc;
          |             ^~
    [235/256] Linking C executable zephyr/zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map 
    : && ccache /home/henry/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/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/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/subsys/bluetooth/common/libsubsys__bluetooth__common.a  zephyr/subsys/bluetooth/host/libsubsys__bluetooth__host.a  zephyr/subsys/bluetooth/crypto/libsubsys__bluetooth__crypto.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/random/libsubsys__random.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/i2c/libdrivers__i2c.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/entropy/libdrivers__entropy.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/nrf/lib/multithreading_lock/lib..__nrf__lib__multithreading_lock.a  modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a  modules/nrf/subsys/bluetooth/controller/lib..__nrf__subsys__bluetooth__controller.a  modules/nrf/subsys/mpsl/init/lib..__nrf__subsys__mpsl__init.a  modules/nrf/subsys/mpsl/fem/lib..__nrf__subsys__mpsl__fem.a  modules/nrf/drivers/mpsl/clock_control/lib..__nrf__drivers__mpsl__clock_control.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  modules/segger/libmodules__segger.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -L"/home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/thumb/v7e-m/nofp"  -L/home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  /home/henry/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/lib/cortex-m4/soft-float/liboberon_3.0.12.a  -no-pie  -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  /home/henry/ncs/v2.3.0/nrfxlib/softdevice_controller/lib/cortex-m4/soft-float/libsoftdevice_controller_peripheral.a  /home/henry/ncs/v2.3.0/nrfxlib/mpsl/lib/cortex-m4/soft-float/libmpsl.a && cd /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build/zephyr && /home/henry/ncs/toolchains/v2.3.0/usr/local/lib/python3.8/site-packages/cmake/data/bin/cmake -E echo
    /home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: warning: orphan section `.z_device_POST_KERNELCONFIG_SPI_NOR_INIT_PRIORITY_' from `app/libapp.a(flash_nor.c.obj)' being placed in section `.z_device_POST_KERNELCONFIG_SPI_NOR_INIT_PRIORITY_'
    /home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: Undefined initialization levels used.
    /home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(flash_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_91'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /home/henry/ncs/toolchains/v2.3.0/usr/local/bin/cmake --build /home/henry/ncs/v2.3.0/nrf/samples/minimal_log_spi/build
    

  • Hello

    /home/henry/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(flash_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_91'

    This sort of error usually means something is wrong with your devicetree. Since you seem to be using a custom board I would assume the error could come from your board definition.

    You can have a look at the generated devicetree in build/zephyr/zephyr.dts to see if anything isn't as expected. The error mentions flash_nor.c and spi_nor_config, so anything related to flash or spi would be a good place to start.

    ../src/flash_nor.c: In function 'spi_nor_process_sfdp':
    ../src/flash_nor.c:1031:16: warning: 'rc' is used uninitialized [-Wuninitialized]
    1031 | return rc;
    | ^~
    ../src/flash_nor.c:958:13: note: 'rc' was declared here
    958 | int rc;
    | ^~

    Looks like specifically what happens with rc in flash_nor.c would be a good place to start.

    Best regards,

    Einar

Related