zephyrproject-rtos / gsoc-2022-arduino-core

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

i2c-support breaks build of other samples #33

Closed DhruvaG2000 closed 2 years ago

DhruvaG2000 commented 2 years ago

The issue has been located, it's because the use of some Kconfigs that are not enabled or specified in the other samples.

build fails as below:

└─❯ west build -p -b arduino_nano_33_ble samples/blinky_arduino     -DZEPHYR_EXTRA_MODULES=/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core
-- west build: making build dir /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/samples/blinky_arduino
-- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.4") found components: Interpreter
-- Cache files will be written to: /home/dhruva/.cache/zephyr
-- Zephyr version: 3.1.99 (/home/dhruva/zephyrproject/zephyr)
-- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
-- Board: arduino_nano_33_ble
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.14.2 (/home/dhruva/zephyr-sdk-0.14.2)
-- Found dtc: /home/dhruva/zephyr-sdk-0.14.2/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.2 (/home/dhruva/zephyr-sdk-0.14.2)
-- Found BOARD.dts: /home/dhruva/zephyrproject/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble.dts
-- Found devicetree overlay: /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/variants/ARDUINO_NANO_33_BLE/arduino_nano_33_ble.overlay
-- Generated zephyr.dts: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/dts.cmake
Parsing /home/dhruva/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/dhruva/zephyrproject/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig'
Merged configuration '/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/samples/blinky_arduino/prj.conf'
Configuration saved to '/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/.config'
Kconfig header saved to '/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build
-- west build: building application
[1/174] Preparing syscall dependency handling

[3/174] Generating include/generated/version.h
-- Zephyr version: 3.1.99 (/home/dhruva/zephyrproject/zephyr), build: zephyr-v3.1.0-3162-gbe1380cc51bd
[164/174] Linking CXX executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/zephyr_pre0.map
: && ccache /home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a  zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a  zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a  zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a  zephyr/boards/arm/arduino_nano_33_ble/libboards__arm__arduino_nano_33_ble.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/thumb/v7e-m/nofp"  -L/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -mcpu=cortex-m4  -mthumb  -mabi=aapcs  -mfp16-format=ieee  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn && cd /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr && /usr/bin/cmake -E echo
/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(Wire.cpp.obj): in function `arduino::ZephyrI2C::peek()':
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/libraries/Wire/Wire.cpp:86: undefined reference to `ring_buf_peek'
/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(Wire.cpp.obj): in function `arduino::ZephyrI2C::read()':
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/libraries/Wire/Wire.cpp:69: undefined reference to `ring_buf_peek'
/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/libraries/Wire/Wire.cpp:70: undefined reference to `ring_buf_get'
/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(Wire.cpp.obj): in function `arduino::ZephyrI2C::endTransmission(bool)':
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/libraries/Wire/Wire.cpp:26: undefined reference to `__device_dts_ord_79'
/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/libzephyr.a(Wire.cpp.obj): in function `arduino::ZephyrI2C::requestFrom(unsigned char, unsigned int, bool)':
/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/libraries/Wire/Wire.cpp:40: undefined reference to `ring_buf_put'
/home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/libraries/Wire/Wire.cpp:44: undefined reference to `__device_dts_ord_79'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
DhruvaG2000 commented 2 years ago

The i2c samples builds OK:

└─❯ west build -p -b arduino_nano_33_ble samples/i2cdemo/     -DZEPHYR_EXTRA_MODULES=/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core
-- west build: making build dir /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/samples/i2cdemo
-- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.4") found components: Interpreter
-- Cache files will be written to: /home/dhruva/.cache/zephyr
-- Zephyr version: 3.1.99 (/home/dhruva/zephyrproject/zephyr)
-- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
-- Board: arduino_nano_33_ble
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.14.2 (/home/dhruva/zephyr-sdk-0.14.2)
-- Found dtc: /home/dhruva/zephyr-sdk-0.14.2/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.2 (/home/dhruva/zephyr-sdk-0.14.2)
-- Found BOARD.dts: /home/dhruva/zephyrproject/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble.dts
-- Found devicetree overlay: /home/dhruva/zephyrproject/modules/lib/Arduino-Zephyr-API/variants/ARDUINO_NANO_33_BLE/arduino_nano_33_ble.overlay
-- Generated zephyr.dts: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/dts.cmake
Parsing /home/dhruva/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/dhruva/zephyrproject/zephyr/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig'
Merged configuration '/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/samples/i2cdemo/prj.conf'
Configuration saved to '/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/.config'
Kconfig header saved to '/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/dhruva/zephyr-sdk-0.14.2/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/build
-- west build: building application
[1/162] Preparing syscall dependency handling

[3/162] Generating include/generated/version.h
-- Zephyr version: 3.1.99 (/home/dhruva/zephyrproject/zephyr), build: zephyr-v3.1.0-3162-gbe1380cc51bd
[152/162] Linking CXX executable zephyr/zephyr_pre0.elf

[156/162] Linking CXX executable zephyr/zephyr_pre1.elf

[162/162] Linking CXX executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       44244 B       928 KB      4.66%
            SRAM:        5696 B       256 KB      2.17%
        IDT_LIST:          0 GB         2 KB      0.00%
DhruvaG2000 commented 2 years ago

Bug fixed thanks to the new module.conf that takes care of all deps.