Hi Jared,
Trying to get the accelerometer example up and running on the feather, however, it fails to compile.
Can you help as to why the driver is complaining?
The logs are attached below:

`-- west build: building application
[1/172] Preparing syscall dependency handling

[12/172] Performing build step for 'spm_subimage'
[1/197] Preparing syscall dependency handling

[192/197] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       32256 B        48 KB     65.62%
            SRAM:        5520 B        64 KB      8.42%
        IDT_LIST:          40 B         2 KB      1.95%
[197/197] Linking C executable zephyr/zephyr.elf
[18/172] Performing build step for 'mcuboot_subimage'
[1/179] Preparing syscall dependency handling

[174/179] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       42076 B        48 KB     85.60%
            SRAM:       22176 B       192 KB     11.28%
        IDT_LIST:          72 B         2 KB      3.52%
[179/179] Linking C executable zephyr/zephyr.elf
[30/172] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj
/opt/nordic/ncs/v1.4.1/toolchain/bin/arm-none-eabi-gcc -DBUILD_VERSION=v2.4.0-ncs2 -DEXT_API_MAGIC=0x281ee6de,0xb845acea,23298 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,23298 -DKERNEL -DNRF9160_XXAA -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I/opt/nordic/ncs/v1.4.1/zephyr/include -Izephyr/include/generated -I/opt/nordic/ncs/v1.4.1/zephyr/soc/arm/nordic_nrf/nrf91 -I/opt/nordic/ncs/v1.4.1/nrf/include -I/opt/nordic/ncs/v1.4.1/nfed/include -I/opt/nordic/ncs/v1.4.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v1.4.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v1.4.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v1.4.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v1.4.1/modules/hal/nordic/. -isystem /opt/nordic/ncs/v1.4.1/zephyr/lib/libc/minimal/include -isystem /opt/nordic/ncs/v1.4.1/toolchain/bin/../lib/gcc/arm-none-eabi/9.2.1/include -isystem /opt/nordic/ncs/v1.4.1/toolchain/bin/../lib/gcc/arm-none-eabi/9.2.1/include-fixed -Os -imacros /opt/nordic/ncs/v1.4.1/nfed/samples/accelerometer/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -mcpu=cortex-m33 -mthumb -mabi=aapcs -imacros /opt/nordic/ncs/v1.4.1/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/opt/nordic/ncs/v1.4.1/nfed/samples/accelerometer=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v1.4.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v1.4.1=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 /opt/nordic/ncs/v1.4.1/zephyr/include/arch/arm/aarch32/arch.h:20,
                 from /opt/nordic/ncs/v1.4.1/zephyr/include/arch/cpu.h:19,
                 from /opt/nordic/ncs/v1.4.1/zephyr/include/kernel_includes.h:38,
                 from /opt/nordic/ncs/v1.4.1/zephyr/include/kernel.h:17,
                 from /opt/nordic/ncs/v1.4.1/zephyr/include/zephyr.h:18,
                 from ../src/main.c:8:
../src/main.c: In function 'main':
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:297:40: error: 'DT_N_INST_0_st_lis2dh_P_label' undeclared (first use in this function)
  297 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:1911:38: note: in definition of macro 'DT_CAT'
 1911 | #define DT_CAT(node_id, prop_suffix) node_id##prop_suffix
      |                                      ^~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:496:27: note: in expansion of macro 'DT_PROP'
  496 | #define DT_LABEL(node_id) DT_PROP(node_id, label)
      |                           ^~~~~~~
../src/main.c:59:54: note: in expansion of macro 'DT_LABEL'
   59 |     const struct device *sensor = device_get_binding(DT_LABEL(DT_INST(0, st_lis2dh)));
      |                                                      ^~~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/sys/util_internal.h:105:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
  105 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:297:31: note: in expansion of macro 'UTIL_CAT'
  297 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                               ^~~~~~~~
../src/main.c:59:63: note: in expansion of macro 'DT_INST'
   59 |     const struct device *sensor = device_get_binding(DT_LABEL(DT_INST(0, st_lis2dh)));
      |                                                               ^~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:297:40: note: each undeclared identifier is reported only once for each function it appears in
  297 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:1911:38: note: in definition of macro 'DT_CAT'
 1911 | #define DT_CAT(node_id, prop_suffix) node_id##prop_suffix
      |                                      ^~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:496:27: note: in expansion of macro 'DT_PROP'
  496 | #define DT_LABEL(node_id) DT_PROP(node_id, label)
      |                           ^~~~~~~
../src/main.c:59:54: note: in expansion of macro 'DT_LABEL'
   59 |     const struct device *sensor = device_get_binding(DT_LABEL(DT_INST(0, st_lis2dh)));
      |                                                      ^~~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/sys/util_internal.h:105:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
  105 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v1.4.1/zephyr/include/devicetree.h:297:31: note: in expansion of macro 'UTIL_CAT'
  297 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                               ^~~~~~~~
../src/main.c:59:63: note: in expansion of macro 'DT_INST'
   59 |     const struct device *sensor = device_get_binding(DT_LABEL(DT_INST(0, st_lis2dh)));
      |                                                               ^~~~~~~
[34/172] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/onoff.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /opt/nordic/ncs/v1.4.1/nfed/samples/accelerometer/build

Thanks

    raj Ahh looks like the board defs are not up to date. Best to create a folder called boards in the accelerometer projec and add a file called circuitdojo_feather_nrf9160ns.overlay and then put this as it’s contents:

    /*
     * Copyright (c) 2020 Circuit Dojo LLC
     *
     * SPDX-License-Identifier: Apache-2.0
     */
     
    &i2c1 {
    	lis2dh@18 {
    		compatible = "st,lis2dh";
    		label = "LIS2DH";
    		reg = <0x18>;
    		irq-gpios = <&gpio0 29 0>;
    	};
    };

    Also you can just run west update and it should pull the changes.

    • raj replied to this.

      Superb!
      west update did the tick. Thank you!

      Terms and Conditions | Privacy Policy