Hello,
i am currently trying to build a minimal firmware for the nRF5340 on the Thingy:91x.
Unfortunately my build failles to link zephyr/zephyr_pre0.elf:FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map .../app/build/app/zephyr/zephyr_pre0.map
: && ccache .../ncs/toolchains/b81a7cd864/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -Os -DNDEBUG -gdwarf-4 -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=.../app/build/app/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/libarch__arm__core.a zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a zephyr/arch/arch/arm/core/mpu/libarch__arm__core__mpu.a zephyr/lib/libc/picolibc/liblib__libc__picolibc.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/soc/soc/nrf5340/libsoc__nordic.a zephyr/boards/boards/arm/thingy91x/libbmm350_init_minimal.a zephyr/subsys/retention/libsubsys__retention.a zephyr/drivers/usb/device/libdrivers__usb__device.a zephyr/drivers/usb/common/nrf_usbd_common/libdrivers__usb__common__nrf_usbd_common.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/i2c/libdrivers__i2c.a zephyr/drivers/mbox/libdrivers__mbox.a zephyr/drivers/pinctrl/libdrivers__pinctrl.a zephyr/drivers/regulator/libdrivers__regulator.a zephyr/drivers/retained_mem/libdrivers__retained_mem.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/ram_pwrdn/lib..__nrf__lib__ram_pwrdn.a modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a modules/nrf/drivers/hw_cc3xx/lib..__nrf__drivers__hw_cc3xx.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/segger/libmodules__segger.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a -L.../app/build/app/zephyr zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -fuse-ld=bfd -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 -specs=picolibc.specs -DPICOLIBC_LONG_LONG_PRINTF_SCANF .../deps/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.19.a -L".../ncs/toolchains/b81a7cd864/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -lc -lgcc && cd .../app/build/app/zephyr && .../ncs/toolchains/b81a7cd864/usr/local/bin/cmake -E true
.../ncs/toolchains/b81a7cd864/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/boards/boards/arm/thingy91x/libbmm350_init_minimal.a(bmm350_init_minimal.c.obj): in function `i2c_reg_write_byte':
.../deps/zephyr/include/zephyr/drivers/i2c.h:1587: undefined reference to `__device_dts_ord_133'
collect2: error: ld returned 1 exit status
My suspicion is that the libbmm350_init_minimal.a library, that is built for the thingy board to reduce the quiescent current of the BMM350, is only build once (only one libbmm350_init_minimal.a file in the build folder) with the devicetree-handle __device_dts_ord_133 (handle for the ldo powering the sensors), but the multi-image-build actually has multiple devicetree_generated.h files for the different images which use different handles:
~/g/g/a/p/a/a/build $ fd libbmm350_init_minimal app/zephyr/boards/boards/arm/thingy91x/libbmm350_init_minimal.a ~/g/g/a/p/a/a/build $ fd devicetree_generated app/zephyr/include/generated/zephyr/devicetree_generated.h b0/zephyr/include/generated/zephyr/devicetree_generated.h b0n/zephyr/include/generated/zephyr/devicetree_generated.h empty_net_core/zephyr/include/generated/zephyr/devicetree_generated.h mcuboot/zephyr/include/generated/zephyr/devicetree_generated.h s1_image/zephyr/include/generated/zephyr/devicetree_generated.h ~/g/g/a/p/a/a/build $ fd devicetree_generated --exec grep /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 * 134 /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 134, /* /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 */ * Devicetree node: /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 #define DT_N_S_soc_S_peripheral_50000000_S_i2c_b000_S_npm1300_6b_S_regulators_S_ldo2_PATH "/soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2" * 130 /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 130, /* /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 */ * Devicetree node: /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 #define DT_N_S_soc_S_peripheral_50000000_S_i2c_b000_S_npm1300_6b_S_regulators_S_ldo2_PATH "/soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2" * 134 /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 134, /* /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 */ * Devicetree node: /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 #define DT_N_S_soc_S_peripheral_50000000_S_i2c_b000_S_npm1300_6b_S_regulators_S_ldo2_PATH "/soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2" * 133 /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 133, /* /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 */ * Devicetree node: /soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2 #define DT_N_S_soc_S_peripheral_50000000_S_i2c_b000_S_npm1300_6b_S_regulators_S_ldo2_PATH "/soc/peripheral@50000000/i2c@b000/npm1300@6b/regulators/LDO2"
Does anyone know how to solve this problem?
I am building against the sdk-nrf v2.9.1.
Best Regards
Johannes