From 8dce4a2ad7d52c0302f4ae1f2d9f0a3020324d4a Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 21:31:19 +0900 Subject: [PATCH 01/17] CI: use zephyr's checkpatch.pl Use the checkpatch.pl included with Zephyr to perform the check. Signed-off-by: TOKITA Hiroshi --- .github/workflows/checkpatch.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checkpatch.yml b/.github/workflows/checkpatch.yml index a6ff7bc6c..cac902705 100644 --- a/.github/workflows/checkpatch.yml +++ b/.github/workflows/checkpatch.yml @@ -20,11 +20,15 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Calculate PR commits + 1' - run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV + run: | + echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV + wget https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/refs/heads/main/scripts/checkpatch.pl - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: ${{ env.PR_FETCH_DEPTH }} - name: Run checkpatch review uses: webispy/checkpatch-action@v9 + env: + CHECKPATCH_COMMAND: perl ./checkpatch.pl From 01a304eb0e9a75b30e6673a77c85ca981839ba8d Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 21:01:16 +0900 Subject: [PATCH 02/17] CI: update board name Changed boards to be specified by their normalized names. Signed-off-by: TOKITA Hiroshi --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fdd2add4b..8f66f1d12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,17 +25,17 @@ jobs: - name: Build fade working-directory: Arduino-Zephyr-API run: | - west build -p -b arduino_nano_33_ble_sense samples/fade + west build -p -b arduino_nano_33_ble/nrf52840/sense samples/fade - name: Build i2cdemo working-directory: Arduino-Zephyr-API run: | - west build -p -b arduino_nano_33_ble_sense samples/i2cdemo + west build -p -b arduino_nano_33_ble/nrf52840/sense samples/i2cdemo - name: Build adc working-directory: Arduino-Zephyr-API run: | - west build -p -b beagleconnect_freedom samples/analog_input + west build -p -b beagleconnect_freedom/cc1352p7 samples/analog_input - name: Archive firmware uses: actions/upload-artifact@v4 From 321deed535237918798653f56ed63b7a21d86c6a Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 24 Aug 2025 06:52:39 +0900 Subject: [PATCH 03/17] CI: use existing manifest Modify to use west.yml included in the PR version. Accordingly, the initialization process has been changed. Signed-off-by: TOKITA Hiroshi --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f66f1d12..afe3fe3e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,12 +15,13 @@ jobs: path: Arduino-Zephyr-API - name: Initialize - working-directory: Arduino-Zephyr-API run: | - west init -m https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core.git + west init -l Arduino-Zephyr-API/ west update git clone https://github.com/arduino/ArduinoCore-API.git ArduinoCore-API - cp -r ArduinoCore-API/api modules/lib/Arduino-Zephyr-API/cores/arduino/. + mkdir -p modules/lib + ln -s Arduino-Zephyr-API modules/lib/ + cp -rfp ArduinoCore-API/api Arduino-Zephyr-API/cores/arduino/ - name: Build fade working-directory: Arduino-Zephyr-API From a15ac0b90ef49c3a3dc3e87e1972d96af0089e1f Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 24 Aug 2025 07:14:46 +0900 Subject: [PATCH 04/17] CI: add cmsis_6 Added cmsis_6 to the repository in line with the update of Zephyr. Signed-off-by: TOKITA Hiroshi --- west.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/west.yml b/west.yml index c707e0d60..5715e49d4 100644 --- a/west.yml +++ b/west.yml @@ -19,5 +19,6 @@ manifest: import: name-allowlist: - cmsis # required by the ARM port + - cmsis_6 # required by the ARM port - hal_nordic # required by the custom_plank board (Nordic based) - hal_ti From 2a656d8fc122868f207ff0d1c785be4f4b152342 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sun, 24 Aug 2025 21:45:40 +0900 Subject: [PATCH 05/17] CI: update license_check Apply newest zephyr version Signed-off-by: TOKITA Hiroshi --- .github/workflows/license_check.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml index a57e9e57d..212c76366 100644 --- a/.github/workflows/license_check.yml +++ b/.github/workflows/license_check.yml @@ -2,20 +2,25 @@ name: Scancode on: [pull_request] +permissions: + contents: read + jobs: scancode_job: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 name: Scan code for licenses steps: - name: Checkout the code - uses: actions/checkout@v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 - name: Scan the code id: scancode - uses: zephyrproject-rtos/action_scancode@v4 + uses: zephyrproject-rtos/action_scancode@23ef91ce31cd4b954366a7b71eea47520da9b380 # v4 with: directory-to-scan: 'scan/' - name: Artifact Upload - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: scancode path: ./artifacts From c85c47098a46b4a9d4e98017043baa955695c3b4 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Thu, 13 Mar 2025 16:20:57 +0100 Subject: [PATCH 06/17] samples: get the variant name from the Zephyr build system Get the variant name (NORMALIZED_BOARD_TARGET) from the Zephyr build system as early as possible. This allows to have per-target build directories. Note that a bug with the shield specifiers does not currently allow to reuse the same build directory multiple times. Signed-off-by: TOKITA Hiroshi Co-authored-by: Luca Burelli --- samples/analog_input/CMakeLists.txt | 6 ++++-- samples/attach_interrupt/CMakeLists.txt | 6 ++++-- samples/blinky_arduino/CMakeLists.txt | 6 ++++-- samples/button_press_led/CMakeLists.txt | 8 +++++--- samples/fade/CMakeLists.txt | 6 ++++-- samples/hello_arduino/CMakeLists.txt | 6 ++++-- samples/i2cdemo/CMakeLists.txt | 9 ++++++--- samples/serial_event/CMakeLists.txt | 6 ++++-- samples/spi_controller/CMakeLists.txt | 6 ++++-- samples/threads_arduino/CMakeLists.txt | 9 ++++++--- .../arduino_mkrzero_samd21g18a.overlay} | 0 .../variant.h | 0 .../arduino_nano_33_ble_nrf52840.overlay} | 0 .../variant.h | 0 .../arduino_nano_33_ble_nrf52840_sense.overlay} | 0 .../variant.h | 0 .../arduino_nano_33_iot_samd21g18a.overlay} | 0 .../variant.h | 0 .../beagleconnect_freedom_cc1352p7.overlay} | 0 .../variant.h | 0 .../cc3220sf_launchxl_cc3220sf.overlay} | 0 .../variant.h | 0 .../rpi_pico_rp2040.overlay} | 0 variants/{rpi_pico => rpi_pico_rp2040}/variant.h | 0 24 files changed, 45 insertions(+), 23 deletions(-) rename variants/{arduino_mkrzero/arduino_mkrzero.overlay => arduino_mkrzero_samd21g18a/arduino_mkrzero_samd21g18a.overlay} (100%) rename variants/{arduino_mkrzero => arduino_mkrzero_samd21g18a}/variant.h (100%) rename variants/{arduino_nano_33_ble/arduino_nano_33_ble.overlay => arduino_nano_33_ble_nrf52840/arduino_nano_33_ble_nrf52840.overlay} (100%) rename variants/{arduino_nano_33_ble => arduino_nano_33_ble_nrf52840}/variant.h (100%) rename variants/{arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay => arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay} (100%) rename variants/{arduino_nano_33_ble_sense => arduino_nano_33_ble_nrf52840_sense}/variant.h (100%) rename variants/{arduino_nano_33_iot/arduino_nano_33_iot.overlay => arduino_nano_33_iot_samd21g18a/arduino_nano_33_iot_samd21g18a.overlay} (100%) rename variants/{arduino_nano_33_iot => arduino_nano_33_iot_samd21g18a}/variant.h (100%) rename variants/{beagleconnect_freedom/beagleconnect_freedom.overlay => beagleconnect_freedom_cc1352p7/beagleconnect_freedom_cc1352p7.overlay} (100%) rename variants/{beagleconnect_freedom => beagleconnect_freedom_cc1352p7}/variant.h (100%) rename variants/{cc3220sf_launchxl/cc3220sf_launchxl.overlay => cc3220sf_launchxl_cc3220sf/cc3220sf_launchxl_cc3220sf.overlay} (100%) rename variants/{cc3220sf_launchxl => cc3220sf_launchxl_cc3220sf}/variant.h (100%) rename variants/{rpi_pico/rpi_pico.overlay => rpi_pico_rp2040/rpi_pico_rp2040.overlay} (100%) rename variants/{rpi_pico => rpi_pico_rp2040}/variant.h (100%) diff --git a/samples/analog_input/CMakeLists.txt b/samples/analog_input/CMakeLists.txt index 83ac0d6bd..b7cbc2032 100644 --- a/samples/analog_input/CMakeLists.txt +++ b/samples/analog_input/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(analog_input) diff --git a/samples/attach_interrupt/CMakeLists.txt b/samples/attach_interrupt/CMakeLists.txt index 711b9673b..1bf7bce34 100644 --- a/samples/attach_interrupt/CMakeLists.txt +++ b/samples/attach_interrupt/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(attach_interrupt) diff --git a/samples/blinky_arduino/CMakeLists.txt b/samples/blinky_arduino/CMakeLists.txt index e5c58ee33..e3a17bfc5 100644 --- a/samples/blinky_arduino/CMakeLists.txt +++ b/samples/blinky_arduino/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(blinky) diff --git a/samples/button_press_led/CMakeLists.txt b/samples/button_press_led/CMakeLists.txt index e5c58ee33..56569b9ea 100644 --- a/samples/button_press_led/CMakeLists.txt +++ b/samples/button_press_led/CMakeLists.txt @@ -2,11 +2,13 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(blinky) +project(button_press_led) target_sources(app PRIVATE src/main.cpp) diff --git a/samples/fade/CMakeLists.txt b/samples/fade/CMakeLists.txt index 6f3c4cffa..c03034185 100644 --- a/samples/fade/CMakeLists.txt +++ b/samples/fade/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(fade) diff --git a/samples/hello_arduino/CMakeLists.txt b/samples/hello_arduino/CMakeLists.txt index 0675b10d1..83ea1b05b 100644 --- a/samples/hello_arduino/CMakeLists.txt +++ b/samples/hello_arduino/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(hello_world) diff --git a/samples/i2cdemo/CMakeLists.txt b/samples/i2cdemo/CMakeLists.txt index e79ab241b..e6251ff56 100644 --- a/samples/i2cdemo/CMakeLists.txt +++ b/samples/i2cdemo/CMakeLists.txt @@ -2,11 +2,14 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(blinky) +project(i2cdemo) target_sources(app PRIVATE src/main.cpp) + zephyr_compile_options(-Wno-unused-variable -Wno-comment) diff --git a/samples/serial_event/CMakeLists.txt b/samples/serial_event/CMakeLists.txt index a275e3cc2..8493bb793 100644 --- a/samples/serial_event/CMakeLists.txt +++ b/samples/serial_event/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(serial_event) diff --git a/samples/spi_controller/CMakeLists.txt b/samples/spi_controller/CMakeLists.txt index 824634e57..bd1b6e40b 100644 --- a/samples/spi_controller/CMakeLists.txt +++ b/samples/spi_controller/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(spi_controller) diff --git a/samples/threads_arduino/CMakeLists.txt b/samples/threads_arduino/CMakeLists.txt index f9aea636e..b09f2e20e 100644 --- a/samples/threads_arduino/CMakeLists.txt +++ b/samples/threads_arduino/CMakeLists.txt @@ -2,11 +2,14 @@ cmake_minimum_required(VERSION 3.20.0) -cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE}) -set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay) +# get value of NORMALIZED_BOARD_TARGET early +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) + +set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(threads) target_sources(app PRIVATE src/main.cpp) -zephyr_compile_options(-Wno-unused-variable -Wno-comment) \ No newline at end of file + +zephyr_compile_options(-Wno-unused-variable -Wno-comment) diff --git a/variants/arduino_mkrzero/arduino_mkrzero.overlay b/variants/arduino_mkrzero_samd21g18a/arduino_mkrzero_samd21g18a.overlay similarity index 100% rename from variants/arduino_mkrzero/arduino_mkrzero.overlay rename to variants/arduino_mkrzero_samd21g18a/arduino_mkrzero_samd21g18a.overlay diff --git a/variants/arduino_mkrzero/variant.h b/variants/arduino_mkrzero_samd21g18a/variant.h similarity index 100% rename from variants/arduino_mkrzero/variant.h rename to variants/arduino_mkrzero_samd21g18a/variant.h diff --git a/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay b/variants/arduino_nano_33_ble_nrf52840/arduino_nano_33_ble_nrf52840.overlay similarity index 100% rename from variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay rename to variants/arduino_nano_33_ble_nrf52840/arduino_nano_33_ble_nrf52840.overlay diff --git a/variants/arduino_nano_33_ble/variant.h b/variants/arduino_nano_33_ble_nrf52840/variant.h similarity index 100% rename from variants/arduino_nano_33_ble/variant.h rename to variants/arduino_nano_33_ble_nrf52840/variant.h diff --git a/variants/arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay similarity index 100% rename from variants/arduino_nano_33_ble_sense/arduino_nano_33_ble_sense.overlay rename to variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay diff --git a/variants/arduino_nano_33_ble_sense/variant.h b/variants/arduino_nano_33_ble_nrf52840_sense/variant.h similarity index 100% rename from variants/arduino_nano_33_ble_sense/variant.h rename to variants/arduino_nano_33_ble_nrf52840_sense/variant.h diff --git a/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay b/variants/arduino_nano_33_iot_samd21g18a/arduino_nano_33_iot_samd21g18a.overlay similarity index 100% rename from variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay rename to variants/arduino_nano_33_iot_samd21g18a/arduino_nano_33_iot_samd21g18a.overlay diff --git a/variants/arduino_nano_33_iot/variant.h b/variants/arduino_nano_33_iot_samd21g18a/variant.h similarity index 100% rename from variants/arduino_nano_33_iot/variant.h rename to variants/arduino_nano_33_iot_samd21g18a/variant.h diff --git a/variants/beagleconnect_freedom/beagleconnect_freedom.overlay b/variants/beagleconnect_freedom_cc1352p7/beagleconnect_freedom_cc1352p7.overlay similarity index 100% rename from variants/beagleconnect_freedom/beagleconnect_freedom.overlay rename to variants/beagleconnect_freedom_cc1352p7/beagleconnect_freedom_cc1352p7.overlay diff --git a/variants/beagleconnect_freedom/variant.h b/variants/beagleconnect_freedom_cc1352p7/variant.h similarity index 100% rename from variants/beagleconnect_freedom/variant.h rename to variants/beagleconnect_freedom_cc1352p7/variant.h diff --git a/variants/cc3220sf_launchxl/cc3220sf_launchxl.overlay b/variants/cc3220sf_launchxl_cc3220sf/cc3220sf_launchxl_cc3220sf.overlay similarity index 100% rename from variants/cc3220sf_launchxl/cc3220sf_launchxl.overlay rename to variants/cc3220sf_launchxl_cc3220sf/cc3220sf_launchxl_cc3220sf.overlay diff --git a/variants/cc3220sf_launchxl/variant.h b/variants/cc3220sf_launchxl_cc3220sf/variant.h similarity index 100% rename from variants/cc3220sf_launchxl/variant.h rename to variants/cc3220sf_launchxl_cc3220sf/variant.h diff --git a/variants/rpi_pico/rpi_pico.overlay b/variants/rpi_pico_rp2040/rpi_pico_rp2040.overlay similarity index 100% rename from variants/rpi_pico/rpi_pico.overlay rename to variants/rpi_pico_rp2040/rpi_pico_rp2040.overlay diff --git a/variants/rpi_pico/variant.h b/variants/rpi_pico_rp2040/variant.h similarity index 100% rename from variants/rpi_pico/variant.h rename to variants/rpi_pico_rp2040/variant.h From daf1764e1e8ed030ebf14874593f8e1e8d8c3fc7 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 22 Aug 2025 06:31:43 +0900 Subject: [PATCH 07/17] zephyrCommon: Change `delayMicroseconds` to busy loop Since Arduino's `delayMicroseconds` is implemented as a busy loop, we change it to using `k_busy_wait` to improve compatibility. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index 6fa94bc47..c5611380a 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -259,7 +259,9 @@ void noTone(pin_size_t pinNumber) { void delay(unsigned long ms) { k_sleep(K_MSEC(ms)); } -void delayMicroseconds(unsigned int us) { k_sleep(K_USEC(us)); } +void delayMicroseconds(unsigned int us) { + k_busy_wait(us); +} unsigned long micros(void) { return k_cyc_to_us_floor32(k_cycle_get_32()); From 61dbac29c044d060cb9d9caf0dcffa33b9857f97 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 11:02:37 +0900 Subject: [PATCH 08/17] zephyrCommon: apply Arduino-style indentation Reformatting indentation for `delay` and `millis`. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index c5611380a..c8681f93c 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -257,7 +257,9 @@ void noTone(pin_size_t pinNumber) { gpio_pin_set_dt(&arduino_pins[pinNumber], 0); } -void delay(unsigned long ms) { k_sleep(K_MSEC(ms)); } +void delay(unsigned long ms) { + k_sleep(K_MSEC(ms)); +} void delayMicroseconds(unsigned int us) { k_busy_wait(us); @@ -267,7 +269,9 @@ unsigned long micros(void) { return k_cyc_to_us_floor32(k_cycle_get_32()); } -unsigned long millis(void) { return k_uptime_get_32(); } +unsigned long millis(void) { + return k_uptime_get_32(); +} #ifdef CONFIG_PWM From dcc7a0d7cb210b4852dd54df4c82713d0d0a31fb Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 08:51:18 +0900 Subject: [PATCH 09/17] zephyrCommon: Removed pulseIn GPIO direction check Since the general Arduino implementation does not check the GPIO direction, this check has been removed to improve compatibility. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index c8681f93c..a99be9d02 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -413,8 +413,6 @@ long random(long max) { #endif -#ifdef CONFIG_GPIO_GET_DIRECTION - unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout) { struct k_timer timer; int64_t start, end, delta = 0; @@ -427,10 +425,6 @@ unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout goto cleanup; } - if (!gpio_pin_is_input_dt(spec)) { - goto cleanup; - } - while(gpio_pin_get_dt(spec) == state && k_timer_status_get(&timer) == 0); if (k_timer_status_get(&timer) > 0) { goto cleanup; @@ -455,8 +449,6 @@ unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout return (unsigned long)delta; } -#endif // CONFIG_GPIO_GET_DIRECTION - void enableInterrupt(pin_size_t pinNumber) { struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port); From f5dbe522f1692e2dfb1a03a52a2c078472e0e109 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Fri, 22 Aug 2025 06:25:53 +0900 Subject: [PATCH 10/17] zephyrCommon: Fix PWM index range check The PWM index range check processing was performed after the index was referenced, so it was now performed first. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index a99be9d02..901457d12 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -279,11 +279,11 @@ void analogWrite(pin_size_t pinNumber, int value) { size_t idx = pwm_pin_index(pinNumber); - if (!pwm_is_ready_dt(&arduino_pwm[idx])) { + if (idx >= ARRAY_SIZE(arduino_pwm)) { return; } - if (idx >= ARRAY_SIZE(arduino_pwm) ) { + if (!pwm_is_ready_dt(&arduino_pwm[idx])) { return; } From a807227a0e463b5ced9175d35cca0d06c8910ac2 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 08:52:06 +0900 Subject: [PATCH 11/17] zephyrCommon: Immediately terminate pulseIn if gpio not ready If gpio is not initialized, the pulseIn function will terminate without running the timer. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index 901457d12..49ee10ad1 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -418,13 +418,13 @@ unsigned long pulseIn(pin_size_t pinNumber, uint8_t state, unsigned long timeout int64_t start, end, delta = 0; const struct gpio_dt_spec *spec = &arduino_pins[pinNumber]; - k_timer_init(&timer, NULL, NULL); - k_timer_start(&timer, K_MSEC(timeout), K_NO_WAIT); - if (!gpio_is_ready_dt(spec)) { - goto cleanup; + return 0; } + k_timer_init(&timer, NULL, NULL); + k_timer_start(&timer, K_MSEC(timeout), K_NO_WAIT); + while(gpio_pin_get_dt(spec) == state && k_timer_status_get(&timer) == 0); if (k_timer_status_get(&timer) > 0) { goto cleanup; From 25d463a222f13bdc3debb21b0a04244994864f4c Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Wed, 20 Aug 2025 21:04:17 +0900 Subject: [PATCH 12/17] zephyrCommon: Add comment at the end of the anonymous namespace Added a comment because it was difficult to understand where the namespace ends. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index 49ee10ad1..b4d3e4fe3 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -177,7 +177,7 @@ size_t analog_pin_index(pin_size_t pinNumber) { static unsigned int irq_key; static bool interrupts_disabled = false; -} +} // namespace void yield(void) { k_yield(); From 607c419386decc425736ae064d72d42f5fb8cc71 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 05:55:58 +0900 Subject: [PATCH 13/17] zephyrCommon: Fix buggy irq handler acquisition Fix an issue where the reference location for the interrupt handler was a bit mask instead of an index value. Signed-off-by: TOKITA Hiroshi [DG: tweaked commit message] Signed-off-by: Dhruva Gole --- cores/arduino/zephyrCommon.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index b4d3e4fe3..96b910d11 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -104,7 +104,7 @@ void setInterruptHandler(pin_size_t pinNumber, voidFuncPtr func) struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port); if (pcb) { - pcb->handlers[BIT(arduino_pins[pinNumber].pin)].handler = func; + pcb->handlers[arduino_pins[pinNumber].pin].handler = func; } } @@ -113,8 +113,8 @@ void handleGpioCallback(const struct device *port, struct gpio_callback *cb, uin struct gpio_port_callback *pcb = (struct gpio_port_callback *)cb; for (uint32_t i = 0; i < max_ngpios; i++) { - if (pins & BIT(i) && pcb->handlers[BIT(i)].enabled) { - pcb->handlers[BIT(i)].handler(); + if (pins & BIT(i) && pcb->handlers[i].enabled) { + pcb->handlers[i].handler(); } } } @@ -453,7 +453,7 @@ void enableInterrupt(pin_size_t pinNumber) { struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port); if (pcb) { - pcb->handlers[BIT(arduino_pins[pinNumber].pin)].enabled = true; + pcb->handlers[arduino_pins[pinNumber].pin].enabled = true; } } @@ -461,7 +461,7 @@ void disableInterrupt(pin_size_t pinNumber) { struct gpio_port_callback *pcb = find_gpio_port_callback(arduino_pins[pinNumber].port); if (pcb) { - pcb->handlers[BIT(arduino_pins[pinNumber].pin)].enabled = false; + pcb->handlers[arduino_pins[pinNumber].pin].enabled = false; } } From 00a01fa24011d34d4cb21257cdf468448101c570 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 23 Aug 2025 05:10:51 +0900 Subject: [PATCH 14/17] zephyrCommon: Improved `tone` implementation Improved to align more closely with the standard Arduino implementation. - Eliminated the end timer and used counting to determine the end. - Improved to handle infinity correctly. - Added a guard to prevent the timeout value from reaching 0. - Set the GPIO value to 0 when the timer starts. Signed-off-by: TOKITA Hiroshi --- cores/arduino/zephyrCommon.cpp | 69 +++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 22 deletions(-) diff --git a/cores/arduino/zephyrCommon.cpp b/cores/arduino/zephyrCommon.cpp index 96b910d11..92d99ff02 100644 --- a/cores/arduino/zephyrCommon.cpp +++ b/cores/arduino/zephyrCommon.cpp @@ -212,49 +212,74 @@ PinStatus digitalRead(pin_size_t pinNumber) { return (gpio_pin_get_dt(&arduino_pins[pinNumber]) == 1) ? HIGH : LOW; } -struct k_timer arduino_pin_timers[ARRAY_SIZE(arduino_pins)]; -struct k_timer arduino_pin_timers_timeout[ARRAY_SIZE(arduino_pins)]; +#ifndef MAX_TONE_PINS +#define MAX_TONE_PINS DT_PROP_LEN(DT_PATH(zephyr_user), digital_pin_gpios) +#endif + +#define TOGGLES_PER_CYCLE 2ULL + +static struct pin_timer { + struct k_timer timer; + uint32_t count; + pin_size_t pin; + bool infinity; +} arduino_pin_timers[MAX_TONE_PINS]; void tone_expiry_cb(struct k_timer *timer) { - const struct gpio_dt_spec *spec = (gpio_dt_spec*)k_timer_user_data_get(timer); - gpio_pin_toggle_dt(spec); -} + struct pin_timer *pt = CONTAINER_OF(timer, struct pin_timer, timer); + const struct gpio_dt_spec *spec = &arduino_pins[pt->pin]; -void tone_timeout_cb(struct k_timer *timer) { - pin_size_t pinNumber = (pin_size_t)(uintptr_t)k_timer_user_data_get(timer); - noTone(pinNumber); + if (pt->count == 0) { + k_timer_stop(timer); + gpio_pin_set_dt(spec, 0); + } else { + gpio_pin_toggle_dt(spec); + if (!pt->infinity) { + pt->count--; + } + } } -void tone(pin_size_t pinNumber, unsigned int frequency, unsigned long duration) { - struct k_timer *timer = &arduino_pin_timers[pinNumber]; +void tone(pin_size_t pinNumber, unsigned int frequency, + unsigned long duration) { const struct gpio_dt_spec *spec = &arduino_pins[pinNumber]; + struct k_timer *timer; k_timeout_t timeout; + if (pinNumber >= MAX_TONE_PINS) { + return; + } + + timer = &arduino_pin_timers[pinNumber].timer; + pinMode(pinNumber, OUTPUT); + k_timer_stop(&arduino_pin_timers[pinNumber].timer); if (frequency == 0) { gpio_pin_set_dt(spec, 0); return; } - timeout = K_NSEC(NSEC_PER_SEC / (2 * frequency)); + timeout = K_NSEC(NSEC_PER_SEC / (TOGGLES_PER_CYCLE * frequency)); + if (timeout.ticks == 0) { + timeout.ticks = 1; + } + arduino_pin_timers[pinNumber].infinity = (duration == 0); + arduino_pin_timers[pinNumber].count = (uint64_t)duration * frequency * + (MSEC_PER_SEC / TOGGLES_PER_CYCLE); + arduino_pin_timers[pinNumber].pin = pinNumber; k_timer_init(timer, tone_expiry_cb, NULL); - k_timer_user_data_set(timer, (void*)spec); - gpio_pin_set_dt(spec, 1); - k_timer_start(timer, timeout, timeout); - if(duration > 0) { - timer = &arduino_pin_timers_timeout[pinNumber]; - k_timer_init(timer, tone_timeout_cb, NULL); - k_timer_user_data_set(timer, (void*)(uintptr_t)pinNumber); - k_timer_start(timer, K_MSEC(duration), K_NO_WAIT); - } + gpio_pin_set_dt(spec, 0); + k_timer_start(timer, timeout, timeout); } void noTone(pin_size_t pinNumber) { - k_timer_stop(&arduino_pin_timers[pinNumber]); - gpio_pin_set_dt(&arduino_pins[pinNumber], 0); + const struct gpio_dt_spec *spec = &arduino_pins[pinNumber]; + + k_timer_stop(&arduino_pin_timers[pinNumber].timer); + gpio_pin_set_dt(spec, 0); } void delay(unsigned long ms) { From d9e27d86956b07f1ea94a10fbca72fc96b3bac17 Mon Sep 17 00:00:00 2001 From: Dhruva Gole Date: Sun, 12 Oct 2025 17:58:50 +0000 Subject: [PATCH 15/17] ci: build: general improvements and size reduction Take inspiration from the Arduino's fork [1] to improve the CI for building and testing samples in the project by using the ci-base zephyr image to save on size. Use the new $MODULE_PATH to specify paths in the setup stages. [1] https://github.com/arduino/ArduinoCore-zephyr/blob/main/.github/workflows/build.yml Signed-off-by: Dhruva Gole --- .github/workflows/build.yml | 42 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afe3fe3e3..0c404355c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,39 +4,53 @@ on: [push, pull_request] jobs: build: + name: Build Arduino-API Zephyr samples runs-on: ubuntu-latest - container: zephyrprojectrtos/ci:latest + container: zephyrprojectrtos/ci-base:latest env: CMAKE_PREFIX_PATH: /opt/toolchains + CCACHE_IGNOREOPTIONS: -specs=* + MODULE_PATH: ../modules/lib/Arduino-Zephyr-API + steps: - name: Checkout uses: actions/checkout@v4 with: - path: Arduino-Zephyr-API + fetch-depth: 0 + persist-credentials: false + path: subfolder + + - name: Fix module path, list needed HALs + run: | + mkdir -p $(dirname $MODULE_PATH) && mv subfolder $MODULE_PATH + + - name: Setup Zephyr project + uses: zephyrproject-rtos/action-zephyr-setup@v1 + with: + toolchains: arm-zephyr-eabi + manifest-file-name: ${{ env.MODULE_PATH }}/west.yml + enable-ccache: false + + - name: Add manifest path as module + run: | + echo EXTRA_ZEPHYR_MODULES="$(pwd)/$MODULE_PATH" >> $GITHUB_ENV - name: Initialize run: | - west init -l Arduino-Zephyr-API/ - west update - git clone https://github.com/arduino/ArduinoCore-API.git ArduinoCore-API - mkdir -p modules/lib - ln -s Arduino-Zephyr-API modules/lib/ - cp -rfp ArduinoCore-API/api Arduino-Zephyr-API/cores/arduino/ + git clone https://github.com/arduino/ArduinoCore-API.git $MODULE_PATH/../ArduinoCore-API + cp -rfp $MODULE_PATH/../ArduinoCore-API/api $MODULE_PATH/cores/arduino/ - name: Build fade - working-directory: Arduino-Zephyr-API run: | - west build -p -b arduino_nano_33_ble/nrf52840/sense samples/fade + west build -p -b arduino_nano_33_ble/nrf52840/sense $MODULE_PATH/samples/fade - name: Build i2cdemo - working-directory: Arduino-Zephyr-API run: | - west build -p -b arduino_nano_33_ble/nrf52840/sense samples/i2cdemo + west build -p -b arduino_nano_33_ble/nrf52840/sense $MODULE_PATH/samples/i2cdemo - name: Build adc - working-directory: Arduino-Zephyr-API run: | - west build -p -b beagleconnect_freedom/cc1352p7 samples/analog_input + west build -p -b beagleconnect_freedom/cc1352p7 $MODULE_PATH/samples/analog_input - name: Archive firmware uses: actions/upload-artifact@v4 From 1a6209436df9b537001fe78d411e9e92ff88627d Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 1 Nov 2025 16:37:44 +0900 Subject: [PATCH 16/17] CMakeLists.txt: Match variants by canonical board name Uses the HWMv2 canonical board name to determine paths under variants. Signed-off-by: TOKITA Hiroshi --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d50d173b..2f1955936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 -if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}) - set(variant_dir variants/${BOARD}) -elseif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) +if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) set(variant_dir variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) else() - message(FATAL_ERROR "Variant dir not found: variants/${BOARD}, variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}") + message(FATAL_ERROR "Variant dir not found: variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}") endif() if (CONFIG_ARDUINO_API) From 568d8d03cab6b8ad9d3abe8007498a441dbf58a9 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 1 Nov 2025 12:39:38 +0900 Subject: [PATCH 17/17] CMakeLists.txt: Do nothing when the CONFIG_ARDUINO_API is disabled. Disables processing when CONFIG_ARDUINO_API is disabled so that checking the existence of variants does not work when this API is not used. Signed-off-by: TOKITA Hiroshi --- CMakeLists.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f1955936..484c3721d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,13 @@ # SPDX-License-Identifier: Apache-2.0 -if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) - set(variant_dir variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) -else() - message(FATAL_ERROR "Variant dir not found: variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}") -endif() - if (CONFIG_ARDUINO_API) -add_subdirectory(cores) -add_subdirectory(libraries) -zephyr_include_directories(${variant_dir}) -endif() + if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) + set(variant_dir variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}) + else() + message(FATAL_ERROR "Variant dir not found: variants/${BOARD}${NORMALIZED_BOARD_QUALIFIERS}") + endif() + add_subdirectory(cores) + add_subdirectory(libraries) + zephyr_include_directories(${variant_dir}) +endif()