Integrating a dw300 library to the Zephyr OS application yields: "ZEPHYR_EXTRA_MODULES, is not a valid zephyr module"

Hi,

I have a board that has dw3000 from Qorvo on it and I want to use it in my application. I found this repo, which explains how to integrate the Qorvo driver into Zephyr. After I followed the steps, I got this error:

CMake Error at C:/ncs/v2.6.0/zephyr/cmake/modules/zephyr_module.cmake:77 (message):
  C:/nordic_play_workfolder/dw3000_example/dw3000-decadriver/, given in
  ZEPHYR_EXTRA_MODULES, is not a valid zephyr module

Call Stack (most recent call first):
  C:/ncs/v2.6.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  C:/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.6.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:8 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe '-Bc:\nordic_play_workfolder\dw3000_example\build_nrf52833' -GNinja -DBOARD=nrf52833dk_nrf52833 -DNCS_TOOLCHAIN_VERSION=NONE -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DCONFIG_CORTEX_M_DEBUG_MONITOR_HOOK=y -DCONFIG_SEGGER_DEBUGMON=y -DCONF_FILE=c:/nordic_play_workfolder/dw3000_example/prj.conf -DEXTRA_DTC_OVERLAY_FILE=boards/nrf52833dk_nrf52833.overlay '-Sc:\nordic_play_workfolder\dw3000_example'

I have structured my project as shown below. The driver is in the zephyr-dw3000-decadriver folder:

../dw3000_example/
├── boards
│   └── nrf52833dk_nrf52833.overlay
├── CMakeLists.txt
├── Kconfig
├── prj.conf
├── sample.yaml
├── src
│   └── main.c
└── zephyr-dw3000-decadriver
    ├── boards
    │   └── shields
    ├── CMakeLists.txt
    ├── dts
    │   └── bindings
    ├── dwt_uwb_driver
    │   ├── CMakeLists.txt
    │   ├── custom-sections.ld
    │   ├── inc
    │   └── lib
    ├── Kconfig
    ├── module.yml
    ├── platform
    │   ├── CMakeLists.txt
    │   ├── deca_port.c
    │   ├── deca_probe_interface.h
    │   ├── dw3000_hw.c
    │   ├── dw3000_hw.h
    │   ├── dw3000_spi.c
    │   └── dw3000_spi.h
    ├── README.md
    └── zephyr

I have updated Cmake as follows:

 SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

# add the dw3000-decadriver directory as a zephyr module by hand, not needed when using west
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/dw3000-decadriver/)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(dw3000)

target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE platform/port.c platform/config_options.c)

FILE(GLOB ex_sources examples/*/*.c)
target_sources(app PRIVATE ${ex_sources})
target_include_directories(app PRIVATE platform)

Added a Kconfig, otherwise I would not have the ability to set the CONFIG_DW3000 flag:

mainmenu "dw3000"

rsource "zephyr-dw3000-decadriver/Kconfig"
source "Kconfig.zephyr"

Finally, I added an overlay to boards/nrf52833dk_nrf52833.overlay for the SPI, as the Dw3000 uses the SPI for communication:

// disabled the unused peripheral 
&i2c0 {	status = "disabled";};
//&spi0 {	status = "disabled";};
&i2c1 {	status = "disabled";};

 // spi configuration   
&spi0 {
	status = "okay";
	compatible = "nordic,nrf-spim";
	pinctrl-0 = <&spi0_default>;
	pinctrl-1 = <&spi0_sleep>;
	cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;

	dw3000:dw3000@0 {
		compatible = "decawave,dw3000";
		//compatible = "decawave,dw1000";
		reg = <0>;
		spi-max-frequency = <1000000>;
		reset-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
		irq-gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
		wakeup-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
		spi-pol-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
		spi-pha-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
	};
};

// pin config
&pinctrl {
	spi0_default: spi0_default {
		group1 {
				psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
						<NRF_PSEL(SPIM_MOSI, 0, 29)>,
						<NRF_PSEL(SPIM_MISO, 0, 31)>;
		};
	};

	spi0_sleep: spi0_sleep {
		group1 {
				psels = <NRF_PSEL(SPIM_SCK, 0, 28)>,
						<NRF_PSEL(SPIM_MOSI, 0, 29)>,
						<NRF_PSEL(SPIM_MISO, 0, 31)>;
				low-power-enable;
		};
	};
};

I think I understand why the error occurs, but I do not know how to fix it. I need to configure/tell the toolchain that this is a valid module/driver. How do I do this, right?

I have attached a sample test project to show the error:

8475.dw3000_example.zip

Thanks for the help!

Parents Reply Children
No Data
Related