How to test a peripherals like I2c and Etc on 9160Dk using Zephyr

Trying to flash spi flash in nrf9160 dk using template zephyr/samples/drivers/spi_flash, while building the configuration using board as nrf9160dk_nrf9160_ns, getting a fatal error, as described below.
Also tried to build the I2C interface with max44009 in nrf9160dk using template zephyr/samples/sensor/max44009. Got stuck with the fatal errs while building the configuration's.

Parents
  •  *  Executing task: nRF Connect: Build: spi_flash/build (active) 
    
    Building spi_flash
    west build --build-dir c:\Users\neha.p\Desktop\spi_flash\build c:\Users\neha.p\Desktop\spi_flash
    
    [0/124] Performing build step for 'tfm'
    ninja: no work to do.
    [2/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc32c_sw.c.obj
    [3/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc7_sw.c.obj
    [4/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc8_sw.c.obj
    [5/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc16_sw.c.obj
    [6/121] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/state.c.obj
    [7/121] Building ASM object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/common/soc_nrf_common.S.obj
    [8/121] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
    [9/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf.c.obj
    [10/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_enabled_instances.c.obj
    [11/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_base_addresses.c.obj
    [12/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/assert.c.obj
    [13/121] 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 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DTFM_PSA_API -DUSE_PARTITION_MANAGER=1 -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D__LINUX_ERRNO_EXTENSIONS__ -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/nrf91 -IC:/ncs/v2.3.0/zephyr/lib/libc/newlib/include -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.3.0/nrf/include -IC:/ncs/v2.3.0/nrf/include/tfm -IC:/ncs/v2.3.0/nrf/tests/include -Itfm/generated/interface/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/. -IC:/ncs/v2.3.0/nrfxlib/nrf_modem/include -Itfm/install/interface/include -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include/mbedtls -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include/mbedtls -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include/psa -IC:/ncs/v2.3.0/modules/crypto/mbedtls/library -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include -fno-strict-aliasing -Os -imacros C:/Users/neha.p/Desktop/spi_flash/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:/Users/neha.p/Desktop/spi_flash=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 -specs=nano.specs -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 C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain\gcc.h:89,
                     from C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain.h:50,
                     from C:\ncs\v2.3.0\zephyr\include\zephyr\kernel_includes.h:19,
                     from C:\ncs\v2.3.0\zephyr\include\zephyr\kernel.h:17,
                     from c:\Users\neha.p\Desktop\spi_flash\src\main.c:7:
    ../src/main.c: In function 'main':
    C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:41: error: '__device_dts_ord_DT_N_ALIAS_spi_flash0_ORD' undeclared (first use in this function)
       83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                         ^~~~~~~~~
    C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain\common.h:132:26: note: in definition of macro '_DO_CONCAT'
      132 | #define _DO_CONCAT(x, y) 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:\Users\neha.p\Desktop\spi_flash\src\main.c:37:21: note: in expansion of macro 'DEVICE_DT_GET'
       37 |         flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0));
          |                     ^~~~~~~~~~~~~
    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\toolchain\common.h:132:26: note: in definition of macro '_DO_CONCAT'
      132 | #define _DO_CONCAT(x, y) 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:\Users\neha.p\Desktop\spi_flash\src\main.c:37:21: note: in expansion of macro 'DEVICE_DT_GET'
       37 |         flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0));
          |                     ^~~~~~~~~~~~~
    [14/121] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/policy.c.obj
    [15/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/reboot.c.obj
    [16/121] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/pm.c.obj
    [17/121] Building C object zephyr/soc/arm/common/cortex_m/CMakeFiles/soc__arm__common__cortex_m.dir/arm_mpu_regions.c.obj
    [18/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_complete.c.obj
    [19/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf91/soc.c.obj
    [20/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/bitarray.c.obj
    [21/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf91/power.c.obj
    [22/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/common/soc_secure.c.obj
    [23/121] Building C object zephyr/boards/arm/nrf9160dk_nrf9160/CMakeFiles/boards__arm__nrf9160dk_nrf9160.dir/nrf52840_reset.c.obj
    [24/121] Building C object zephyr/subsys/random/CMakeFiles/subsys__random.dir/rand32_entropy_device.c.obj
    [25/121] Building C object zephyr/lib/libc/newlib/CMakeFiles/lib__libc__newlib.dir/libc-hooks.c.obj
    [26/121] Building C object zephyr/drivers/clock_control/CMakeFiles/drivers__clock_control.dir/clock_control_nrf.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:\Users\neha.p\Desktop\spi_flash\build'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

    Here it is.

Reply
  •  *  Executing task: nRF Connect: Build: spi_flash/build (active) 
    
    Building spi_flash
    west build --build-dir c:\Users\neha.p\Desktop\spi_flash\build c:\Users\neha.p\Desktop\spi_flash
    
    [0/124] Performing build step for 'tfm'
    ninja: no work to do.
    [2/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc32c_sw.c.obj
    [3/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc7_sw.c.obj
    [4/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc8_sw.c.obj
    [5/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc16_sw.c.obj
    [6/121] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/state.c.obj
    [7/121] Building ASM object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/common/soc_nrf_common.S.obj
    [8/121] Building C object zephyr/CMakeFiles/zephyr.dir/misc/generated/configs.c.obj
    [9/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf.c.obj
    [10/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_enabled_instances.c.obj
    [11/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/validate_base_addresses.c.obj
    [12/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/assert.c.obj
    [13/121] 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 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DTFM_PSA_API -DUSE_PARTITION_MANAGER=1 -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D__LINUX_ERRNO_EXTENSIONS__ -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/nrf91 -IC:/ncs/v2.3.0/zephyr/lib/libc/newlib/include -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.3.0/nrf/include -IC:/ncs/v2.3.0/nrf/include/tfm -IC:/ncs/v2.3.0/nrf/tests/include -Itfm/generated/interface/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/. -IC:/ncs/v2.3.0/nrfxlib/nrf_modem/include -Itfm/install/interface/include -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include/mbedtls -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include/mbedtls -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include/psa -IC:/ncs/v2.3.0/modules/crypto/mbedtls/library -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include -fno-strict-aliasing -Os -imacros C:/Users/neha.p/Desktop/spi_flash/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:/Users/neha.p/Desktop/spi_flash=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 -specs=nano.specs -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 C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain\gcc.h:89,
                     from C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain.h:50,
                     from C:\ncs\v2.3.0\zephyr\include\zephyr\kernel_includes.h:19,
                     from C:\ncs\v2.3.0\zephyr\include\zephyr\kernel.h:17,
                     from c:\Users\neha.p\Desktop\spi_flash\src\main.c:7:
    ../src/main.c: In function 'main':
    C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:83:41: error: '__device_dts_ord_DT_N_ALIAS_spi_flash0_ORD' undeclared (first use in this function)
       83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                         ^~~~~~~~~
    C:\ncs\v2.3.0\zephyr\include\zephyr\toolchain\common.h:132:26: note: in definition of macro '_DO_CONCAT'
      132 | #define _DO_CONCAT(x, y) 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:\Users\neha.p\Desktop\spi_flash\src\main.c:37:21: note: in expansion of macro 'DEVICE_DT_GET'
       37 |         flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0));
          |                     ^~~~~~~~~~~~~
    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\toolchain\common.h:132:26: note: in definition of macro '_DO_CONCAT'
      132 | #define _DO_CONCAT(x, y) 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:\Users\neha.p\Desktop\spi_flash\src\main.c:37:21: note: in expansion of macro 'DEVICE_DT_GET'
       37 |         flash_dev = DEVICE_DT_GET(DT_ALIAS(spi_flash0));
          |                     ^~~~~~~~~~~~~
    [14/121] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/policy.c.obj
    [15/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/reboot.c.obj
    [16/121] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/pm/pm.c.obj
    [17/121] Building C object zephyr/soc/arm/common/cortex_m/CMakeFiles/soc__arm__common__cortex_m.dir/arm_mpu_regions.c.obj
    [18/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_complete.c.obj
    [19/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf91/soc.c.obj
    [20/121] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/bitarray.c.obj
    [21/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/nrf91/power.c.obj
    [22/121] Building C object zephyr/CMakeFiles/zephyr.dir/soc/arm/nordic_nrf/common/soc_secure.c.obj
    [23/121] Building C object zephyr/boards/arm/nrf9160dk_nrf9160/CMakeFiles/boards__arm__nrf9160dk_nrf9160.dir/nrf52840_reset.c.obj
    [24/121] Building C object zephyr/subsys/random/CMakeFiles/subsys__random.dir/rand32_entropy_device.c.obj
    [25/121] Building C object zephyr/lib/libc/newlib/CMakeFiles/lib__libc__newlib.dir/libc-hooks.c.obj
    [26/121] Building C object zephyr/drivers/clock_control/CMakeFiles/drivers__clock_control.dir/clock_control_nrf.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:\Users\neha.p\Desktop\spi_flash\build'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

    Here it is.

Children
Related