Closed DhruvaG2000 closed 2 years ago
[WIP] This code may not build yet, needs a few more additions.
Sounds good!
Note: you can always create a draft PR before it is ready for review. https://github.blog/2019-02-14-introducing-draft-pull-requests/
Currently using a hard coded command to test on my system that may not work for everybody:
west build -p -b arduino_nano_33_ble samples/basic/arduino-blinky -DZEPHYR_EXTRA_MODULES=/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core -DDTC_OVERLAY_FILE=/home/dhruva/zephyrproject/modules/lib/gsoc-2022-arduino-core/variants/ARDUINO_NANO33BLE/arduino_nano_33_ble.overlay
The following changes are needed to eliminate the need to specify overlay path at build time command:
diff --git a/samples/blinky_arduino/CMakeLists.txt b/samples/blinky_arduino/CMakeLists.txt
index ba606d7..a75c14e 100644
--- a/samples/blinky_arduino/CMakeLists.txt
+++ b/samples/blinky_arduino/CMakeLists.txt
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
+set(DTC_OVERLAY_FILE $ENV{HOME}/zephyrproject/modules/lib/gsoc-2022-arduino-core/variants/ARDUINO_NANO33BLE/arduino_nano_33_ble.overlay)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky)
But with whatever name we spcify in the west.yml file:
diff --git a/west.yml b/west.yml
index f1dfa5a642..bffb71441a 100644
--- a/west.yml
+++ b/west.yml
@@ -25,6 +25,11 @@ manifest:
#
# Please add items below based on alphabetical order
projects:
+ # Arduino API repository.
+ - name: Arduino-Core-Zephyr
+ path: modules/lib/Arduino-Zephyr-API
+ revision: feat/gpio
+ url: https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core
which would be Arduino-Zephyr-API
in this case.
To summarise, I made the following changes in my sample to get it to work:
diff --git a/samples/blinky_arduino/CMakeLists.txt b/samples/blinky_arduino/CMakeLists.txt
index ba606d7..6b82c61 100644
--- a/samples/blinky_arduino/CMakeLists.txt
+++ b/samples/blinky_arduino/CMakeLists.txt
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
+set(DTC_OVERLAY_FILE $ENV{HOME}/zephyrproject/modules/lib/gsoc-2022-arduino-core/variants/ARDUINO_NANO33BLE/arduino_nano_33_ble.overlay)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky)
-
target_sources(app PRIVATE src/main.cpp)
+zephyr_compile_options(-Wno-unused-variable -Wno-comment)
\ No newline at end of file
diff --git a/samples/blinky_arduino/prj.conf b/samples/blinky_arduino/prj.conf
index 100a497..bff66c4 100644
--- a/samples/blinky_arduino/prj.conf
+++ b/samples/blinky_arduino/prj.conf
@@ -1,3 +1,4 @@
CONFIG_GPIO=y
CONFIG_CPLUSPLUS=y
-CONFIG_ARDUINO_API=y
\ No newline at end of file
+CONFIG_ARDUINO_API=y
+CONFIG_BOARD_ARDUINO_NANO_33_BLE_SENSE=y
\ No newline at end of file
This also makes the unused variable warnings go away and one can simply build using the command: west build -p -b arduino_nano_33_ble samples/blinky_arduino/
provided everything else is in the right path
Solves https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core/issues/16
Signed-off-by: Dhruva Gole goledhruva@gmail.com