Building ccs811 sensor Sample code on a nrf9160dk

I am trying to build the ccs811 sample code provided by zephyr. This is very new to me and I'm struggling to get it to work. I am currently using SDK version 2.3.0, toolchain 2.3.0, but building using nrF Connect in VS Code. When i make the build configuration and select the nrf9160dk_nrf9160 as my target board this is the terminal error output: 

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\v2.3.0\zephyr\samples\sensor\ccs811\src\main.c:8:
../src/main.c: In function 'main':
C:\ncs\v2.3.0\zephyr\include\zephyr\sys\util.h:78:55: error: size of unnamed array is negative
   78 | #define ZERO_OR_COMPILE_ERROR(cond) ((int) sizeof(char[1 - 2 * !(cond)]) - 1)
      |                                                       ^
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\device.h:277:9: note: in expansion of macro 'COND_CODE_1'
  277 |         COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat),                         \
      |         ^~~~~~~~~~~
C:\ncs\v2.3.0\zephyr\include\zephyr\device.h:279:22: note: in expansion of macro 'ZERO_OR_COMPILE_ERROR'
  279 |                     (ZERO_OR_COMPILE_ERROR(0)))
      |                      ^~~~~~~~~~~~~~~~~~~~~
c:\ncs\v2.3.0\zephyr\samples\sensor\ccs811\src\main.c:116:42: note: in expansion of macro 'DEVICE_DT_GET_ONE'
  116 |         const struct device *const dev = DEVICE_DT_GET_ONE(ams_ccs811);
 

It seems to be originating from DEVICE_DT_GET_ONE? However, when I try to build using the suggested target board efr32mg_sltb0004a it builds with no issues, but the other suggested board thingy52_nrf52832 also has the same build error as above. 

Any suggestions on how to fix this please? 

Parents
  • Hello, 

    The nRF9160 DK does not have the sensor CCS811. In order to build the CCS811 sample for nRF9160DK, you will need to add this to the board definition. Please note that you will need to build for nrf9160dk_nrf9160_ns

    but the other suggested board thingy52_nrf52832 also has the same build error as above. 

    I had no issues building the CCS811 project for thingy52_nrf52832. Did you reconfigure the project in any way?

    Kind regards,
    Øyvind

Reply
  • Hello, 

    The nRF9160 DK does not have the sensor CCS811. In order to build the CCS811 sample for nRF9160DK, you will need to add this to the board definition. Please note that you will need to build for nrf9160dk_nrf9160_ns

    but the other suggested board thingy52_nrf52832 also has the same build error as above. 

    I had no issues building the CCS811 project for thingy52_nrf52832. Did you reconfigure the project in any way?

    Kind regards,
    Øyvind

Children
Related