Need help to setup MPU6050 with nRF52840 using NCS

Hello Everyone,

I need help in the integration of MPU6050 with nRF52840. I know inside SDK one example is present but it worked with nRF52832DK. when I tried to build it with option nRF52840DK_nRF52840 Board. it gives a lot of errors. Please suggest something.  The ERROR file is attached here  

west build --build-dir f:\RandD\nRF52840\example\mpu6050\build f:\RandD\nRF52840\example\mpu6050

ninja: no work to do.
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: nRF Connect: Build: mpu6050/build_nRF52840 (active) 

Building mpu6050
west build --build-dir f:\RandD\nRF52840\example\mpu6050\build_nRF52840 f:\RandD\nRF52840\example\mpu6050

[1/113] Linking C static library zephyr\soc\arm\nordic_nrf\nrf52\libsoc__arm__nordic_nrf__nrf52.a
[2/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc32_sw.c.obj
[3/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc7_sw.c.obj
[4/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc8_sw.c.obj
[5/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/crc16_sw.c.obj
[6/113] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
C:\ncs_2_1_0\toolchains\v2.1.0\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_2_1_0/v2.1.0/zephyr/include/zephyr -IC:/ncs_2_1_0/v2.1.0/zephyr/include -Izephyr/include/generated -IC:/ncs_2_1_0/v2.1.0/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/ncs_2_1_0/v2.1.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs_2_1_0/v2.1.0/nrf/include -IC:/ncs_2_1_0/v2.1.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs_2_1_0/v2.1.0/modules/hal/nordic/nrfx -IC:/ncs_2_1_0/v2.1.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs_2_1_0/v2.1.0/modules/hal/nordic/nrfx/mdk -IC:/ncs_2_1_0/v2.1.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs_2_1_0/v2.1.0/modules/debug/segger/SEGGER -IC:/ncs_2_1_0/v2.1.0/modules/debug/segger/Config -IC:/ncs_2_1_0/v2.1.0/zephyr/modules/segger/. -isystem C:/ncs_2_1_0/v2.1.0/zephyr/lib/libc/minimal/include -isystem c:/ncs_2_1_0/toolchains/v2.1.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include -isystem c:/ncs_2_1_0/toolchains/v2.1.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include-fixed -isystem C:/ncs_2_1_0/v2.1.0/nrfxlib/crypto/nrf_cc310_platform/include -Os -imacros F:/RandD/nRF52840/example/mpu6050/build_nRF52840/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_2_1_0/toolchains/v2.1.0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs_2_1_0/v2.1.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-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=F:/RandD/nRF52840/example/mpu6050=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs_2_1_0/v2.1.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs_2_1_0/v2.1.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_2_1_0\v2.1.0\zephyr\include\zephyr\sys\util_macro.h:34,
                 from C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\sys\atomic.h:16,
                 from C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\kernel_includes.h:21,
                 from C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\kernel.h:17,
                 from C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\zephyr.h:18,
                 from f:\RandD\nRF52840\example\mpu6050\src\main.c:7:
../src/main.c: In function 'main':
C:\ncs_2_1_0\v2.1.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_2_1_0\v2.1.0\zephyr\include\zephyr\sys\util_internal.h:67:26: note: in definition of macro '__DEBRACKET'
   67 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\sys\util_internal.h:59:2: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   59 |  __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |  ^~~~~~~~~~~~~~~~~~~~
C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\sys\util_internal.h:54:2: note: in expansion of macro '__COND_CODE'
   54 |  __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
      |  ^~~~~~~~~~~
C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\sys\util_macro.h:157:2: note: in expansion of macro 'Z_COND_CODE_1'
  157 |  Z_COND_CODE_1(_flag, _if_1_code, _else_code)
      |  ^~~~~~~~~~~~~
C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\device.h:353:2: note: in expansion of macro 'COND_CODE_1'
  353 |  COND_CODE_1(DT_HAS_COMPAT_STATUS_OKAY(compat),       \
      |  ^~~~~~~~~~~
C:\ncs_2_1_0\v2.1.0\zephyr\include\zephyr\device.h:355:8: note: in expansion of macro 'ZERO_OR_COMPILE_ERROR'
  355 |       (ZERO_OR_COMPILE_ERROR(0)))
      |        ^~~~~~~~~~~~~~~~~~~~~
f:\RandD\nRF52840\example\mpu6050\src\main.c:89:33: note: in expansion of macro 'DEVICE_DT_GET_ONE'
   89 |  const struct device *mpu6050 = DEVICE_DT_GET_ONE(invensense_mpu6050);
      |                                 ^~~~~~~~~~~~~~~~~
[7/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj
[8/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/dec.c.obj
[9/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj
[10/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
[11/113] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\ncs_2_1_0\toolchains\v2.1.0\opt\bin\cmake.EXE' --build 'f:\RandD\nRF52840\example\mpu6050\build_nRF52840'

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

When build with nRF52832 board it's built completely.

Thanks 

Abhishek

Parents Reply Children
Related