Unable to compile nRF Connect SDK Fundamentals lesson 6 exercise 1

Hello,

I'm trying to compile the solution to the nRF Connect SDK Fundamentals lesson 6 exercise 1 for the NRF5340DK board but I'm getting some compilation errors. I tried compiling for the nrf5340dk_nrf5340_cpuapp target.

Here's the code for the main.c:

/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 * 
 * Note: Tested on nRF52833 DK
 */

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
/* STEP 3 - Include the header file of the I2C API */
#include <zephyr/drivers/i2c.h>
/* STEP 4.1 - Include the header file of printk() */
#include <zephyr/sys/printk.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS   1000

/* STEP 8 - Define the I2C slave device address and the addresses of relevant registers */
#define STTS751_TEMP_HIGH_REG            0x00
#define STTS751_TEMP_LOW_REG             0x02
#define STTS751_CONFIG_REG               0x03

/* STEP 6 - Get the node identifier of the sensor */
#define I2C0_NODE DT_NODELABEL(mysensor)

void main(void)
{

	int ret;

/* STEP 7 - Retrieve the API-specific device structure and make sure that the device is ready to use  */
	static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C0_NODE);
	if (!device_is_ready(dev_i2c.bus)) {
		printk("I2C bus %s is not ready!\n\r",dev_i2c.bus->name);
		return;
	}

/* STEP 9 - Setup the sensor by writing the value 0x8C to the Configuration register */
	uint8_t config[2] = {STTS751_CONFIG_REG,0x8C};
	ret = i2c_write_dt(&dev_i2c, config, sizeof(config));
	if(ret != 0){
		printk("Failed to write to I2C device address %x at Reg. %x \n", dev_i2c.addr,config[0]);
		return;
	}

	while (1) {
/* STEP 10 - Read the temperature from the sensor */
		uint8_t temp_reading[2]= {0};
		uint8_t sensor_regs[2] ={STTS751_TEMP_LOW_REG,STTS751_TEMP_HIGH_REG};
		ret = i2c_write_read_dt(&dev_i2c,&sensor_regs[0],1,&temp_reading[0],1);
		if(ret != 0){
			printk("Failed to write/read I2C device address %x at Reg. %x \r\n", dev_i2c.addr,sensor_regs[0]);
		}
		ret = i2c_write_read_dt(&dev_i2c,&sensor_regs[1],1,&temp_reading[1],1);
		if(ret != 0){
			printk("Failed to write/read I2C device address %x at Reg. %x \r\n", dev_i2c.addr,sensor_regs[1]);
		}

/* STEP 11 - Convert the two bytes to a 12-bits */
		int temp = ((int)temp_reading[1] * 256 + ((int)temp_reading[0] & 0xF0)) / 16;
		if(temp > 2047)
		{
			temp -= 4096;
		}

		// Convert to engineering units 
		double cTemp = temp * 0.0625;
		double fTemp = cTemp * 1.8 + 32;

		//Print reading to console  
		printk("Temperature in Celsius : %.2f C \n", cTemp);
		printk("Temperature in Fahrenheit : %.2f F \n", fTemp);
		k_msleep(SLEEP_TIME_MS);
	}
}

The app.overlay :

// To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html

&i2c0 {
    
    mysensor: mysensor@4a{
        compatible = "i2c-device";
        reg = < 0x4a >;
        label = "MYSENSOR";
    };
};

The KConfig file (prj.conf) :

# STEP 2 - Enable the I2C driver
CONFIG_I2C=y
# STEP 4.2 - Enable floating point format specifiers
CONFIG_CBPRINTF_FP_SUPPORT=y

When compiling, the build fails with the following error.

Building fund_less6_exer1_solution
west build --build-dir c:\ncs\myapps\nRF-Connect-SDK-Fundamentals\v2.x.x\lesson6\fund_less6_exer1_solution\build c:\ncs\myapps\nRF-Connect-SDK-Fundamentals\v2.x.x\lesson6\fund_less6_exer1_solution --pristine --board nrf5340dk_nrf5340_cpuapp -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONF_FILE:STRING="c:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/prj.conf"

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution
-- Found Python3: C:/ncs/toolchains/v2.3.0/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
-- Cache files will be written to: C:/ncs/v2.3.0/zephyr/.cache
-- Zephyr version: 3.2.99 (C:/ncs/v2.3.0/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Found host-tools: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/v2.3.0/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: C:/ncs/v2.3.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/app.overlay
-- Generated zephyr.dts: C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/build/zephyr/dts.cmake
Parsing C:/ncs/v2.3.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.3.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
Merged configuration 'c:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/prj.conf'
Configuration saved to 'C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/build/zephyr/.config'
Kconfig header saved to 'C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/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: C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/build
-- west build: building application
[1/171] Generating include/generated/version.h
-- Zephyr version: 3.2.99 (C:/ncs/v2.3.0/zephyr), build: v3.2.99-ncs2
[2/171] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
[3/171] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h, include/generated/otype-to-size.h
[4/171] Generating include/generated/driver-validation.h
[5/171] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[6/171] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
[7/171] Generating include/generated/offsets.h
[8/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault_s.S.obj
[9/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/nmi_on_reset.S.obj
[10/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/cpu_idle.S.obj
[11/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/exc_exit.S.obj
[12/171] Building C object zephyr/arch/common/CMakeFiles/isr_tables.dir/isr_tables.c.obj
[13/171] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/nmi.c.obj
[14/171] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/prep_c.c.obj
[15/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/swap_helper.S.obj
[16/171] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/irq_manage.c.obj
[17/171] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/fatal.c.obj
[18/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/isr_wrapper.S.obj
[19/171] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/thread.c.obj
[20/171] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fault.c.obj
[21/171] Building C object zephyr/arch/arch/arm/core/aarch32/CMakeFiles/arch__arm__core__aarch32.dir/swap.c.obj
[22/171] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/fpu.c.obj
[23/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/reset.S.obj
[24/171] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/irq_init.c.obj
[25/171] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/scb.c.obj
[26/171] Building ASM object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/vector_table.S.obj
[27/171] Generating linker_zephyr_pre0.cmd
[28/171] Generating ../../../include/generated/libc/minimal/strerror_table.h
[29/171] Linking C static library zephyr\arch\common\libisr_tables.a
[30/171] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/CMakeFiles/arch__arm__core__aarch32__cortex_m.dir/thread_abort.c.obj
[31/171] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
C:\ncs\toolchains\v2.3.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=0 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.3.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.3.0/nrf/include -IC:/ncs/v2.3.0/nrf/tests/include -IC:/ncs/v2.3.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.3.0/zephyr/modules/hal_nordic/nrfx/. -isystem C:/ncs/v2.3.0/zephyr/lib/libc/minimal/include -isystem c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/include -isystem c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/include-fixed -isystem C:/ncs/v2.3.0/nrfxlib/crypto/nrf_cc312_platform/include -fno-strict-aliasing -Os -imacros C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.3.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/ncs/myapps/nRF-Connect-SDK-Fundamentals/v2.x.x/lesson6/fund_less6_exer1_solution=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.3.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.3.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -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 C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_macro.h:34,
                 from C:\ncs\v2.3.0\zephyr\include\zephyr\sys\atomic.h:16,
                 from C:\ncs\v2.3.0\zephyr\include\zephyr\kernel_includes.h:21,
                 from C:\ncs\v2.3.0\zephyr\include\zephyr\kernel.h:17,
                 from c:\ncs\myapps\nRF-Connect-SDK-Fundamentals\v2.x.x\lesson6\fund_less6_exer1_solution\src\main.c:9:
../src/main.c: In function 'main':
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:41: error: '__device_dts_ord_134' undeclared (first use in this function); did you mean '__device_dts_ord_13'?
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
   72 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   64 |         __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |         ^~~~~~~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_internal.h:59:9: note: in expansion of macro '__COND_CODE'
   59 |         __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_macro.h:157:9: note: in expansion of macro 'Z_COND_CODE_1'
  157 |         Z_COND_CODE_1(_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\drivers\i2c.h:122:17: note: in expansion of macro 'COND_CODE_1'
  122 |                 COND_CODE_1(DT_ON_BUS(node_id, i3c),                    \
      |                 ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain\common.h:133:23: note: in expansion of macro '_DO_CONCAT'
  133 | #define _CONCAT(x, y) _DO_CONCAT(x, y)
      |                       ^~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:33: note: in expansion of macro '_CONCAT'
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:209:37: note: in expansion of macro 'DEVICE_NAME_GET'
  209 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:226:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  226 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\drivers\i2c.h:107:16: note: in expansion of macro 'DEVICE_DT_GET'
  107 |         .bus = DEVICE_DT_GET(DT_BUS(node_id)),                          \
      |                ^~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\drivers\i2c.h:124:30: note: in expansion of macro 'I2C_DT_SPEC_GET_ON_I2C'
  124 |                             (I2C_DT_SPEC_GET_ON_I2C(node_id)))          \
      |                              ^~~~~~~~~~~~~~~~~~~~~~
c:\ncs\myapps\nRF-Connect-SDK-Fundamentals\v2.x.x\lesson6\fund_less6_exer1_solution\src\main.c:33:51: note: in expansion of macro 'I2C_DT_SPEC_GET'
   33 |         static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C0_NODE);
      |                                                   ^~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:41: note: each undeclared identifier is reported only once for each function it appears in
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_internal.h:72:26: note: in definition of macro '__DEBRACKET'
   72 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_internal.h:64:9: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   64 |         __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |         ^~~~~~~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_internal.h:59:9: note: in expansion of macro '__COND_CODE'
   59 |         __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util_macro.h:157:9: note: in expansion of macro 'Z_COND_CODE_1'
  157 |         Z_COND_CODE_1(_flag, _if_1_code, _else_code)
      |         ^~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\drivers\i2c.h:122:17: note: in expansion of macro 'COND_CODE_1'
  122 |                 COND_CODE_1(DT_ON_BUS(node_id, i3c),                    \
      |                 ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain\common.h:133:23: note: in expansion of macro '_DO_CONCAT'
  133 | #define _CONCAT(x, y) _DO_CONCAT(x, y)
      |                       ^~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:33: note: in expansion of macro '_CONCAT'
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:209:37: note: in expansion of macro 'DEVICE_NAME_GET'
  209 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:226:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  226 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\drivers\i2c.h:107:16: note: in expansion of macro 'DEVICE_DT_GET'
  107 |         .bus = DEVICE_DT_GET(DT_BUS(node_id)),                          \
      |                ^~~~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\drivers\i2c.h:124:30: note: in expansion of macro 'I2C_DT_SPEC_GET_ON_I2C'
  124 |                             (I2C_DT_SPEC_GET_ON_I2C(node_id)))          \
      |                              ^~~~~~~~~~~~~~~~~~~~~~
c:\ncs\myapps\nRF-Connect-SDK-Fundamentals\v2.x.x\lesson6\fund_less6_exer1_solution\src\main.c:33:51: note: in expansion of macro 'I2C_DT_SPEC_GET'
   33 |         static const struct i2c_dt_spec dev_i2c = I2C_DT_SPEC_GET(I2C0_NODE);
      |                                                   ^~~~~~~~~~~~~~~
[32/171] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_core_mpu.c.obj
[33/171] Building C object zephyr/soc/arm/common/cortex_m/CMakeFiles/soc__arm__common__cortex_m.dir/arm_mpu_regions.c.obj
[34/171] Linking C static library zephyr\arch\arch\arm\core\aarch32\libarch__arm__core__aarch32.a
[35/171] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/dec.c.obj
[36/171] Building C object zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/CMakeFiles/arch__arm__core__aarch32__cortex_m__cmse.dir/arm_core_cmse.c.obj
[37/171] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/atoi.c.obj
[38/171] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/strtol.c.obj
[39/171] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/abort.c.obj
[40/171] Building C object zephyr/arch/arch/arm/core/aarch32/mpu/CMakeFiles/arch__arm__core__aarch32__mpu.dir/arm_mpu.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' --build 'c:\ncs\myapps\nRF-Connect-SDK-Fundamentals\v2.x.x\lesson6\fund_less6_exer1_solution\build'

The error seems to be linked to the device tree structure pointer generation but since this is kind of obscure to me I don't understand what's wrong. The only thing I modified from the initial sources is the name of the overlay file (from "nrf52833dk_nrf52833.overlay" to "app.overlay"), otherwise the overlay was not taken into account.

What am I missing here ?

Parents
  • I found it !

    The device tree structure pointer was not generated because the i2c0 status was "disabled" so I needed to set it to "okay". Moreover, the i2c peripheral connected on the arduino connector by default is the i2c1. So the final app.overlay file should look like this:

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
    // For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
    
    &i2c1 {
        status = "okay";
        mysensor: mysensor@4a{
            compatible = "i2c-device";
            reg = < 0x4a >;
            label = "MYSENSOR";
        };
    };

Reply
  • I found it !

    The device tree structure pointer was not generated because the i2c0 status was "disabled" so I needed to set it to "okay". Moreover, the i2c peripheral connected on the arduino connector by default is the i2c1. So the final app.overlay file should look like this:

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
    // For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
    
    &i2c1 {
        status = "okay";
        mysensor: mysensor@4a{
            compatible = "i2c-device";
            reg = < 0x4a >;
            label = "MYSENSOR";
        };
    };

Children
No Data
Related