Hi,
When I try to build the ESPI sample using west I'm getting the following error:
C:\ncs\v2.1.2>west build --build-dir c:\Projects\NordicProjects\espi\build c:\Projects\NordicProjects\espi --board nrf52840dk_nrf52840
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Projects/NordicProjects/espi
-- Using NCS Toolchain 2.1.2 for building. (C:/ncs/toolchains/v2.1.2/cmake)
-- Found Python3: C:/ncs/toolchains/v2.1.2/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.1.2/zephyr/.cache
-- Zephyr version: 3.1.99 (C:/ncs/v2.1.2/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf52840dk_nrf52840
-- Found host-tools: zephyr 0.14.1 (C:/ncs/toolchains/v2.1.2/opt/zephyr-sdk)
-- Found dtc: C:/ncs/toolchains/v2.1.2/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.1 (C:/ncs/toolchains/v2.1.2/opt/zephyr-sdk)
-- Found BOARD.dts: C:/ncs/v2.1.2/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
-- Generated zephyr.dts: C:/Projects/NordicProjects/espi/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/Projects/NordicProjects/espi/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/Projects/NordicProjects/espi/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/Projects/NordicProjects/espi/build/zephyr/dts.cmake
Parsing C:/Projects/NordicProjects/espi/Kconfig
Loaded configuration 'C:/ncs/v2.1.2/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
Merged configuration 'C:/Projects/NordicProjects/espi/prj.conf'
Configuration saved to 'C:/Projects/NordicProjects/espi/build/zephyr/.config'
Kconfig header saved to 'C:/Projects/NordicProjects/espi/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
CMake Warning at C:/ncs/v2.1.2/zephyr/CMakeLists.txt:831 (message):
No SOURCES given to Zephyr library: drivers__espi
Excluding target from build.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Projects/NordicProjects/espi/build
-- west build: building application
[1/175] Generating include/generated/version.h
-- Zephyr version: 3.1.99 (C:/ncs/v2.1.2/zephyr), build: v3.1.99-ncs1-1
[109/175] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj
C:\ncs\toolchains\v2.1.2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DNRF52840_XXAA -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.1.2/zephyr/include/zephyr -IC:/ncs/v2.1.2/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.1.2/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/ncs/v2.1.2/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.1.2/nrf/include -IC:/ncs/v2.1.2/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.1.2/modules/hal/nordic/nrfx -IC:/ncs/v2.1.2/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.1.2/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.1.2/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.1.2/modules/debug/segger/SEGGER -IC:/ncs/v2.1.2/modules/debug/segger/Config -IC:/ncs/v2.1.2/zephyr/modules/segger/. -isystem C:/ncs/v2.1.2/zephyr/lib/libc/minimal/include -isystem c:/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include -isystem c:/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include-fixed -isystem C:/ncs/v2.1.2/nrfxlib/crypto/nrf_cc310_platform/include -Og -imacros C:/Projects/NordicProjects/espi/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/v2.1.2/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.1.2/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-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Projects/NordicProjects/espi=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.1.2/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.1.2=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -Werror -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:13:
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:103:25: error: field 'hwcfg' has incomplete type
103 | struct espi_saf_hw_cfg hwcfg;
| ^~~~~
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:134:18: error: 'struct espi_saf_protection' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
134 | const struct espi_saf_protection *pr);
| ^~~~~~~~~~~~~~~~~~~
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:240:18: error: 'struct espi_saf_protection' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
240 | const struct espi_saf_protection *pr);
| ^~~~~~~~~~~~~~~~~~~
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:244:19: error: 'struct espi_saf_protection' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
244 | const struct espi_saf_protection *pr)
| ^~~~~~~~~~~~~~~~~~~
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h: In function 'z_impl_espi_saf_set_protection_regions':
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:249:42: error: passing argument 2 of 'api->set_protection_region
' from incompatible pointer type [-Werror=incompatible-pointer-types]
249 | return api->set_protection_regions(dev, pr);
| ^~
| |
| const struct espi_saf_protection *
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:249:42: note: expected 'const struct espi_saf_protection *' but argument is of type 'const struct espi_saf_protection *'
In file included from C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:522,
from ../src/main.c:13:
zephyr/include/generated/syscalls/espi_saf.h: At top level:
zephyr/include/generated/syscalls/espi_saf.h:45:91: error: 'struct espi_saf_protection' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
45 | extern int z_impl_espi_saf_set_protection_regions(const struct device * dev, const struct espi_saf_protection * pr);
| ^~~~~~~~~~~~~~~~~~~
zephyr/include/generated/syscalls/espi_saf.h:45:12: error: conflicting types for 'z_impl_espi_saf_set_protection_region
'
45 | extern int z_impl_espi_saf_set_protection_regions(const struct device * dev, const struct espi_saf_protection * pr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/main.c:13:
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:242:19: note: previous definition of 'z_impl_espi_saf_set_protection_regions' was here
242 | static inline int z_impl_espi_saf_set_protection_regions(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:522,
from ../src/main.c:13:
zephyr/include/generated/syscalls/espi_saf.h:48:91: error: 'struct espi_saf_protection' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
48 | static inline int espi_saf_set_protection_regions(const struct device * dev, const struct espi_saf_protection * pr)
| ^~~~~~~~~~~~~~~~~~~
zephyr/include/generated/syscalls/espi_saf.h:48:19: error: conflicting types for 'espi_saf_set_protection_regions'
48 | static inline int espi_saf_set_protection_regions(const struct device * dev, const struct espi_saf_protection * pr)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/main.c:13:
C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:238:15: note: previous declaration of 'espi_saf_set_protection_regions' was here
238 | __syscall int espi_saf_set_protection_regions(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/ncs/v2.1.2/zephyr/include/zephyr/drivers/espi_saf.h:522,
from ../src/main.c:13:
zephyr/include/generated/syscalls/espi_saf.h: In function 'espi_saf_set_protection_regions':
zephyr/include/generated/syscalls/espi_saf.h:58:53: error: passing argument 2 of 'z_impl_espi_saf_set_protection_region
' from incompatible pointer type [-Werror=incompatible-pointer-types]
58 | return z_impl_espi_saf_set_protection_regions(dev, pr);
| ^~
| |
| const struct espi_saf_protection *
zephyr/include/generated/syscalls/espi_saf.h:45:113: note: expected 'const struct espi_saf_protection *' but argument is of type 'const struct espi_saf_protection *'
45 | extern int z_impl_espi_saf_set_protection_regions(const struct device * dev, const struct espi_saf_protection * pr);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from C:/ncs/v2.1.2/zephyr/include/zephyr/toolchain/gcc.h:88,
from C:/ncs/v2.1.2/zephyr/include/zephyr/toolchain.h:50,
from C:/ncs/v2.1.2/zephyr/include/zephyr/sys/errno_private.h:10,
from C:/ncs/v2.1.2/zephyr/lib/libc/minimal/include/errno.h:32,
from ../src/main.c:7:
../src/main.c: At top level:
C:/ncs/v2.1.2/zephyr/include/zephyr/device.h:96:39: error: '__device_dts_ord_DT_N_NODELABEL_espi0_ORD' undeclared here (not in a function)
96 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
| ^~~~~~~~~
C:/ncs/v2.1.2/zephyr/include/zephyr/device.h:276:37: note: in expansion of macro 'DEVICE_NAME_GET'
276 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_NAME(node_id))
| ^~~~~~~~~~~~~~~
C:/ncs/v2.1.2/zephyr/include/zephyr/device.h:296:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
296 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
| ^~~~~~~~~~~~~~~~~~
../src/main.c:49:40: note: in expansion of macro 'DEVICE_DT_GET'
49 | static const struct device *espi_dev = DEVICE_DT_GET(DT_NODELABEL(espi0));
| ^~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
[122/175] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/policy.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\v2.1.2\opt\bin\cmake.EXE' --build 'c:\Projects\NordicProjects\espi\build'
Can you please let me know what the error is? I tried looking up the issue, but couldn't find much. Please help.