zephyrproject-rtos / gsoc-2022-arduino-core

Arduino Core Zephyr Module (GSoC 2022 Project)
Apache License 2.0
45 stars 15 forks source link

nrf52840dk build failure #77

Closed DhruvaG2000 closed 1 year ago

DhruvaG2000 commented 1 year ago

The nrf52840dk build fails for all samples with following errors:

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/dhruva/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done (1.9s)
-- Generating done (0.0s)
-- Build files have been written to: /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/build
-- west build: building application
[1/179] Preparing syscall dependency handling

[2/179] Generating include/generated/version.h
-- Zephyr version: 3.4.99 (/home/dhruva/zephyrproject/zephyr), build: v3.4.0-1121-g76663444c1fa
[53/179] Building CXX object zephyr/CMakeFiles/zephyr.dir/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp.obj 
/home/dhruva/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ -DKERNEL -DNRF52840_XXAA -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/dhruva/zephyrproject/zephyr/kernel/include -I/home/dhruva/zephyrproject/zephyr/arch/arm/include -I/home/dhruva/zephyrproject/zephyr/include -I/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/build/zephyr/include/generated -I/home/dhruva/zephyrproject/zephyr/soc/arm/nordic_nrf/nrf52 -I/home/dhruva/zephyrproject/zephyr/soc/arm/nordic_nrf/common/. -I/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/. -I/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/../../variants -I/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/variants/. -I/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/variants/nrf52840dk_nrf52840 -I/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/libraries/Wire/. -I/home/dhruva/zephyrproject/modules/lib/acpica/../../zephyr/include -I/home/dhruva/zephyrproject/modules/lib/acpica/.. -I/home/dhruva/zephyrproject/modules/lib/acpica/source/include -I/home/dhruva/zephyrproject/modules/lib/acpica/source/include/platform -I/home/dhruva/zephyrproject/modules/lib/acpica/source/compiler -I/home/dhruva/zephyrproject/modules/lib/acpica/generate/zephyr -I/home/dhruva/zephyrproject/modules/lib/acpica/source/tools/acpiexec -I/home/dhruva/zephyrproject/modules/lib/acpica/source/tools/acpidump -I/home/dhruva/zephyrproject/modules/hal/cmsis/CMSIS/Core/Include -I/home/dhruva/zephyrproject/modules/hal/nordic/nrfx -I/home/dhruva/zephyrproject/modules/hal/nordic/nrfx/drivers/include -I/home/dhruva/zephyrproject/modules/hal/nordic/nrfx/mdk -I/home/dhruva/zephyrproject/zephyr/modules/hal_nordic/nrfx/. -I/home/dhruva/zephyrproject/modules/debug/segger/SEGGER -I/home/dhruva/zephyrproject/modules/debug/segger/Config -I/home/dhruva/zephyrproject/zephyr/modules/segger/. -isystem /home/dhruva/zephyrproject/zephyr/lib/libc/minimal/include -isystem /home/dhruva/zephyrproject/zephyr/lib/cpp/minimal/include -isystem /home/dhruva/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem /home/dhruva/zephyr-sdk-0.16.1/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -fno-strict-aliasing -Os -fcheck-new -std=c++11 -fno-exceptions -fno-rtti -imacros /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/build/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/home/dhruva/zephyr-sdk-0.16.1/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/dhruva/zephyrproject/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/samples/hello_arduino=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/dhruva/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/dhruva/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -nostdinc -nostdinc++ -Wno-unused-variable -Wno-comment -MD -MT zephyr/CMakeFiles/zephyr.dir/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp.obj -MF zephyr/CMakeFiles/zephyr.dir/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp.obj.d -o zephyr/CMakeFiles/zephyr.dir/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp.obj -c /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp
In file included from /home/dhruva/zephyrproject/zephyr/include/zephyr/toolchain/gcc.h:92,
                 from /home/dhruva/zephyrproject/zephyr/include/zephyr/toolchain.h:50,
                 from /home/dhruva/zephyrproject/zephyr/include/zephyr/sys/time_units.h:10,
                 from /home/dhruva/zephyrproject/zephyr/include/zephyr/sys/util.h:579,
                 from /home/dhruva/zephyrproject/zephyr/include/zephyr/devicetree.h:25,
                 from /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp:7:
/home/dhruva/zephyrproject/zephyr/include/zephyr/device.h:85:41: error: '__device_dts_ord_118' was not declared in this scope; did you mean '__device_dts_ord_18'?
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
/home/dhruva/zephyrproject/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/dhruva/zephyrproject/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
   85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
/home/dhruva/zephyrproject/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
  211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
/home/dhruva/zephyrproject/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrSerial.cpp:191:30: note: in expansion of macro 'DEVICE_DT_GET'
  191 | arduino::ZephyrSerial Serial(DEVICE_DT_GET(DT_NODELABEL(arduino_serial)));
      |                              ^~~~~~~~~~~~~
[62/179] Building CXX object zephyr/CMakeFiles/zephyr.dir/home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/cores/arduino/zephyrCommon.cpp.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/build
west build -p -b nrf52840dk_nrf52840 samples/hello_arduino  7.96s user 1.11s system 265% cpu 3.420 total
DhruvaG2000 commented 1 year ago

Doing a git bisect got me here:

8c6b5fd6ec60b65e22459d72d8866fbaa357faf0 is the first bad commit
commit 8c6b5fd6ec60b65e22459d72d8866fbaa357faf0
Author: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Date:   Thu Oct 13 08:25:07 2022 +0900

    zephyrSerial: Redesign to supporting hardware serial

    Add support for the hardware serial device. The implementation
    using the UART interrupt, enabling CONFIG_UART_INTERRUPT_DRIVEN.

    Instantiate as 'Serial' with UART device defined in 'serials' array
    under zephyr,user node. If the 'serials' array is not defined,
    try to instantiate with a UART device labeled 'arduino_serial'.
    If even  'arduino_serial' does not define, it uses the stub
    implementation that redirects to printk().

 Kconfig                                            |   5 +
 cores/arduino/main.cpp                             |   3 +-
 cores/arduino/zephyrSerial.cpp                     | 223 +++++++++++++++++----
 cores/arduino/zephyrSerial.h                       |  90 +++++++--
 variants/arduino_mkrzero/arduino_mkrzero.overlay   |   2 +
 .../arduino_nano_33_ble.overlay                    |   2 +
 .../arduino_nano_33_ble_sense.overlay              |   2 +
 .../arduino_nano_33_iot.overlay                    |   2 +
 8 files changed, 270 insertions(+), 59 deletions(-)