Building a Connect SDK v1.9 project

Hello,

I am working on a project which was previously developed by another person, and am struggling to setup the development environment. The project was built on nRF Connect SDK v1.9, and I need to be able to recompile the firmware as-is due to time constraints preventing a migration to v3 at the moment.

After getting past some initial hurdles, I'm currently stuck with a device tree error.

Here is the build output:

west build -b nrf9160dk/nrf9160/ns -d c:\wm2build --  -DOVERLAY_CONFIG="config/overlay-debug.conf" -DCONFIG_MCUBOOT_IMAGE_VERSION=\"0.3.0+1\" -DPM_STATIC_YML_FILE=pm_static_debug.yml
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base (cached)).
-- Application: C:/wm2
-- CMake version: 4.1.0
-- Cache files will be written to: C:/wm2/zephyr/.cache
-- Zephyr version: 4.2.99 (C:/wm2/zephyr)
-- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
-- Board: nrf9160dk, Revision: 0.14.0, qualifiers: nrf9160/ns
-- Found host-tools: zephyr 0.17.0 (C:/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (C:/zephyr-sdk-0.17.0)
-- Found BOARD.dts: C:/wm2/zephyr/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns.dts
-- Found devicetree overlay: C:/wm2/zephyr/boards/nordic/nrf9160dk/nrf9160dk_nrf9160_ns_0_14_0.overlay
-- Found devicetree overlay: C:/wm2/boards/nrf9160dk_nrf9160_ns.overlay
devicetree error: 'sda-pin' appears in /soc/peripheral@40000000/i2c@a000 in C:/wm2build/zephyr/zephyr.dts.pre, but is not declared in 'properties:' in C:/wm2/zephyr/dts/bindings\i2c\nordic,nrf-twim.yaml
CMake Error at zephyr/cmake/modules/dts.cmake:306 (execute_process):
  execute_process failed command indexes:

    1: "Child return code: 1"

Call Stack (most recent call first):
  zephyr/cmake/modules/zephyr_default.cmake:131 (include)
  zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:17 (find_package)


-- Configuring incomplete, errors occurred!

The error mentions "C:/wm2build/zephyr/zephyr.dts.pre" and "C:/wm2/zephyr/dts/bindings\i2c\nordic,nrf-twim.yaml", but should I even be going in and touching those Zephyr files to begin with? I'm not sure what the proper solution would be for this.

The overall process has been like so:
-git clone ...
-cd ...
-west init
-west update
-run west build

Has anyone seen a similar issue to this, and be able to advise on how I should proceed?

Thank you

Parents
  • Okay it looks like I may have not properly set things up originally, I never specified v1.9.0 when issuing west init. I've tried changing the procedure as follows, and I no longer get early device tree overlay errors, but unfortunately still fails to build.

    0. clone project repo/copy sample to c:\test
    1. make c:\west
    2. cd c:\west
    3. west init -m https://github.com/nrfconnect/sdk-nrf --mr v1.9.0
    4. west update
    5. west build -b nrf9160dk_nrf9160_ns -s c:\test --pristine

    I've attached a minimal complete reproducible project if someone else can test out the procedure as well. I used the hello-world sample as a basis, and then modified main.c to add some calls to DEVICE_DT_GET(...). When I test trying to get "sw0", I have no issues building. When I test trying to get "lis3mdl" then there are a bunch of warnings and errors (see output.txt).


    test project:

    6153.test.zip


    build output:

    1205.output.txt

  • based on the overlay you posted:

    &i2c2 {
    	compatible = "nordic,nrf-twim";
    	#address-cells = < 0x1 >;
    	#size-cells = < 0x0 >;
    	reg = < 0xa000 0x1000 >;
    	clock-frequency = < 0x61a80 >;
    	interrupts = < 0xa 0x1 >;
    	status = "okay";
    	label = "I2C_2";
    	sda-pin = < 0x1e >;
    	scl-pin = < 0x1f >;
    
    	lis3mdl: lis3mdl@1e {
    		compatible = "st,lis3mdl";
    		reg = <0x1e>;
    		label = "LIS3MDL";
            irq-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
    	};
    };

    I think you should do:
    const struct device *mag = DEVICE_DT_GET(DT_NODELABEL(lis3mdl));

Reply
  • based on the overlay you posted:

    &i2c2 {
    	compatible = "nordic,nrf-twim";
    	#address-cells = < 0x1 >;
    	#size-cells = < 0x0 >;
    	reg = < 0xa000 0x1000 >;
    	clock-frequency = < 0x61a80 >;
    	interrupts = < 0xa 0x1 >;
    	status = "okay";
    	label = "I2C_2";
    	sda-pin = < 0x1e >;
    	scl-pin = < 0x1f >;
    
    	lis3mdl: lis3mdl@1e {
    		compatible = "st,lis3mdl";
    		reg = <0x1e>;
    		label = "LIS3MDL";
            irq-gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
    	};
    };

    I think you should do:
    const struct device *mag = DEVICE_DT_GET(DT_NODELABEL(lis3mdl));

Children
  • That's what I have in main.c from the test project I attached in my follow up post. The build output spits out quite a bit, but it seems to stem from this specific error earlier in the process.

    C:/wmtest/zephyr/drivers/sensor/lis3mdl/lis3mdl.c: In function 'lis3mdl_sample_fetch':
    C:/wmtest/zephyr/include/devicetree.h:305:40: error: 'DT_N_INST_0_st_lis3mdl_magn_REG_IDX_0_VAL_ADDRESS' undeclared (first use in this function)
      305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))

Related