zephyr/drivers/sensor/lsm6dso/lsm6dso.h: No such file or directory

I have a custom board with the nrf5340 and LSM6DSO accelerometer connected over SPI and I have an issue with the compiler not finding the lsm6dso file even after including the proper configs in prj.conf. I am trying to use the LSM6DSO driver found at ncs\v2.5.0\zephyr\drivers\sensor\lsm6dso (which uses the lsm6dso_reg.h driver in ncs\v2.5.0\modules\hal\st\sensor\stmemsc\lsm6dso_STdC\driver) but even though I have CONFIG_LSM6DSO=y in my prj.conf and I include

#include <zephyr/drivers/sensor/lsm6dso/lsm6dso.h>

I still get "fatal error: zephyr/drivers/sensor/lsm6dso/lsm6dso.h: No such file or directory" when I try to build. In my build/zephyr/.config, all the settings are correctly enabled: 

CONFIG_HAS_STMEMSC=y
CONFIG_USE_STDC_LSM6DSO=y

CONFIG_LSM6DSO=y

CONFIG_DT_HAS_ST_LSM6DSO_ENABLED=y

(I believe the module is also enabled properly in the custom board files but here it is anyway: 

&spi0 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	cs-gpios = <&gpio0 24 GPIO_ACTIVE_LOW>, <&gpio0 23 GPIO_ACTIVE_LOW>; 
	pinctrl-0 = <&spi0_default>;
	pinctrl-1 = <&spi0_sleep>;
	pinctrl-names = "default", "sleep";

	lsm6dso: spi-device@0 {
		status = "okay";
		compatible = "st,lsm6dso"; 
		reg = <0>;
		frame-format = <0>;
		spi-max-frequency = < 8000000U >;
		irq-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>, <&gpio1 8 GPIO_ACTIVE_HIGH>;
	};
};

Here is the build log: 

[0/425] Performing build step for 'tfm'
ninja: no work to do.
[11/422] Building C object CMakeFiles/app.dir/src/lib/accel_gyro/accel_gyro.c.obj
FAILED: CMakeFiles/app.dir/src/lib/accel_gyro/accel_gyro.c.obj 
C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DARM_ALL_FAST_TABLES -DARM_DSP_CONFIG_TABLES -DARM_FAST_ALLOW_TABLES -DARM_FFT_ALLOW_TABLES -DARM_TABLE_RECIP_Q15 -DARM_TABLE_RECIP_Q31 -DARM_TABLE_SIN_F32 -DARM_TABLE_SIN_Q15 -DARM_TABLE_SIN_Q31 -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_DOUBLE_PRINTF_SCANF -DTFM_PSA_API -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I../. -IC:/ncs/v2.5.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.5.0/zephyr/lib/posix/getopt/. -IC:/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.5.0/zephyr/subsys/rtio -IC:/ncs/v2.5.0/zephyr/subsys/bluetooth -IC:/ncs/v2.5.0/zephyr/subsys/settings/include -IC:/ncs/v2.5.0/nrf/include -Itfm/install/interface/include -IC:/ncs/v2.5.0/nrf/include/tfm -IC:/ncs/v2.5.0/nrf/tests/include -Itfm/generated/interface/include -IC:/ncs/v2.5.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.5.0/modules/hal/cmsis/CMSIS/DSP/Include -IC:/ncs/v2.5.0/zephyr/modules/cmsis/. -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.5.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.5.0/modules/hal/st/sensor/stmemsc/lsm6dso_STdC/driver -Imodules/libmetal/libmetal/lib/include -IC:/ncs/v2.5.0/modules/lib/open-amp/open-amp/lib/include -IC:/ncs/v2.5.0/modules/debug/segger/SEGGER -IC:/ncs/v2.5.0/modules/debug/segger/Config -IC:/ncs/v2.5.0/modules/crypto/tinycrypt/lib/include -IC:/ncs/v2.5.0/nrfxlib/nrf_fuel_gauge/include -Imodules/nrf/subsys/nrf_security/src/include/generated -IC:/ncs/v2.5.0/nrf/subsys/nrf_security/include -IC:/ncs/v2.5.0/nrf/ext/oberon/psa/core/include -IC:/ncs/v2.5.0/nrf/ext/oberon/psa/core/library -IC:/ncs/v2.5.0/modules/crypto/mbedtls/include -IC:/ncs/v2.5.0/modules/crypto/mbedtls/library -IC:/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include -IC:/ncs/v2.5.0/nrfxlib/softdevice_controller/include -fno-strict-aliasing -Os -imacros C:/Vitalmark3/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.5.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/Vitalmark3=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.5.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.5.0=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -D_POSIX_THREADS -std=c99 -MD -MT CMakeFiles/app.dir/src/lib/accel_gyro/accel_gyro.c.obj -MF CMakeFiles\app.dir\src\lib\accel_gyro\accel_gyro.c.obj.d -o CMakeFiles/app.dir/src/lib/accel_gyro/accel_gyro.c.obj -c ../src/lib/accel_gyro/accel_gyro.c
In file included from ../src/lib/accel_gyro/accel_gyro.c:5:
../src/lib/accel_gyro/accel_gyro.h:8:10: fatal error: zephyr/drivers/sensor/lsm6dso/lsm6dso.h: No such file or directory
    8 | #include <zephyr/drivers/sensor/lsm6dso/lsm6dso.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[12/422] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DARM_ALL_FAST_TABLES -DARM_DSP_CONFIG_TABLES -DARM_FAST_ALLOW_TABLES -DARM_FFT_ALLOW_TABLES -DARM_TABLE_RECIP_Q15 -DARM_TABLE_RECIP_Q31 -DARM_TABLE_SIN_F32 -DARM_TABLE_SIN_Q15 -DARM_TABLE_SIN_Q31 -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_DOUBLE_PRINTF_SCANF -DTFM_PSA_API -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I../. -IC:/ncs/v2.5.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.5.0/zephyr/lib/posix/getopt/. -IC:/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.5.0/zephyr/subsys/rtio -IC:/ncs/v2.5.0/zephyr/subsys/bluetooth -IC:/ncs/v2.5.0/zephyr/subsys/settings/include -IC:/ncs/v2.5.0/nrf/include -Itfm/install/interface/include -IC:/ncs/v2.5.0/nrf/include/tfm -IC:/ncs/v2.5.0/nrf/tests/include -Itfm/generated/interface/include -IC:/ncs/v2.5.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.5.0/modules/hal/cmsis/CMSIS/DSP/Include -IC:/ncs/v2.5.0/zephyr/modules/cmsis/. -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.5.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.5.0/modules/hal/st/sensor/stmemsc/lsm6dso_STdC/driver -Imodules/libmetal/libmetal/lib/include -IC:/ncs/v2.5.0/modules/lib/open-amp/open-amp/lib/include -IC:/ncs/v2.5.0/modules/debug/segger/SEGGER -IC:/ncs/v2.5.0/modules/debug/segger/Config -IC:/ncs/v2.5.0/modules/crypto/tinycrypt/lib/include -IC:/ncs/v2.5.0/nrfxlib/nrf_fuel_gauge/include -Imodules/nrf/subsys/nrf_security/src/include/generated -IC:/ncs/v2.5.0/nrf/subsys/nrf_security/include -IC:/ncs/v2.5.0/nrf/ext/oberon/psa/core/include -IC:/ncs/v2.5.0/nrf/ext/oberon/psa/core/library -IC:/ncs/v2.5.0/modules/crypto/mbedtls/include -IC:/ncs/v2.5.0/modules/crypto/mbedtls/library -IC:/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include -IC:/ncs/v2.5.0/nrfxlib/softdevice_controller/include -fno-strict-aliasing -Os -imacros C:/Vitalmark3/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.5.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/Vitalmark3=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.5.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.5.0=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -D_POSIX_THREADS -std=c99 -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles\app.dir\src\main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c ../src/main.c
In file included from ../src/main.c:23:
.././src/lib/accel_gyro/accel_gyro.h:8:10: fatal error: zephyr/drivers/sensor/lsm6dso/lsm6dso.h: No such file or directory
    8 | #include <zephyr/drivers/sensor/lsm6dso/lsm6dso.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
[13/422] Linking C static library zephyr\drivers\gpio\libdrivers__gpio.a
[14/422] Linking C static library zephyr\arch\arch\arm\core\aarch32\libarch__arm__core__aarch32.a
[15/422] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_common.c.obj
[16/422] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault.c.obj
[17/422] Linking C static library zephyr\libzephyr.a
[18/422] Building C object zephyr/drivers/spi/CMakeFiles/drivers__spi.dir/spi_nrfx_common.c.obj
[19/422] Building C object zephyr/drivers/flash/CMakeFiles/drivers__flash.dir/soc_flash_nrf.c.obj
[20/422] Building C object zephyr/drivers/spi/CMakeFiles/drivers__spi.dir/spi_nrfx_spim.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' --build 'c:\Vitalmark3\build'

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

I'm not sure if this has something to do with the non-secure build or an issue with child images but I'm not sure why I can't get the build system to pull the drivers correctly. Any help would be appreciated.

Tony

Parents
  • Hi Tony, 

    Naeem is OoO and I will reply to this thread.

    The config CONFIG_LSM6DSO=y should be enough to pull the includes as mentioned in ncs\v2.5.0\zephyr\drivers\sensor\CmakeLists.txt and you can see it includes 

    add_subdirectory_ifdef(CONFIG_LSM6DSO lsm6dso)

    I am not sure why your project is unable to see this. Can you please attach your project for me to test it? You .config seems to be OK where CONFIG_LSM6DSO=y correctly. 

Reply
  • Hi Tony, 

    Naeem is OoO and I will reply to this thread.

    The config CONFIG_LSM6DSO=y should be enough to pull the includes as mentioned in ncs\v2.5.0\zephyr\drivers\sensor\CmakeLists.txt and you can see it includes 

    add_subdirectory_ifdef(CONFIG_LSM6DSO lsm6dso)

    I am not sure why your project is unable to see this. Can you please attach your project for me to test it? You .config seems to be OK where CONFIG_LSM6DSO=y correctly. 

Children
No Data
Related