Skip to content

Commit 0768097

Browse files
soburipillo79
andcommitted
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 <[email protected]> Co-authored-by: Luca Burelli <[email protected]>
1 parent 8faf90b commit 0768097

File tree

26 files changed

+51
-28
lines changed

26 files changed

+51
-28
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
working-directory: Arduino-Zephyr-API
1919
run: |
2020
west init -m https://github.com/zephyrproject-rtos/gsoc-2022-arduino-core.git
21-
west update
21+
cat zephyr/west.yml
22+
west -v update --group-filter=+hal
23+
west manifest --resolve --active-only
2224
git clone https://github.com/arduino/ArduinoCore-API.git ArduinoCore-API
2325
cp -r ArduinoCore-API/api modules/lib/Arduino-Zephyr-API/cores/arduino/.
2426

samples/analog_input/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(analog_input)

samples/attach_interrupt/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(attach_interrupt)

samples/blinky_arduino/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(blinky)

samples/button_press_led/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
9-
project(blinky)
11+
project(button_press_led)
1012

1113
target_sources(app PRIVATE src/main.cpp)
1214

samples/fade/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(fade)

samples/hello_arduino/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(hello_world)

samples/i2cdemo/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
9-
project(blinky)
11+
project(i2cdemo)
1012

1113
target_sources(app PRIVATE src/main.cpp)
14+
1215
zephyr_compile_options(-Wno-unused-variable -Wno-comment)

samples/serial_event/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(serial_event)

samples/spi_controller/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
cmake_minimum_required(VERSION 3.20.0)
44

5-
cmake_path(SET ZephyrBase $ENV{ZEPHYR_BASE})
6-
set(DTC_OVERLAY_FILE ${ZephyrBase}/../modules/lib/Arduino-Zephyr-API/variants/${BOARD}/${BOARD}.overlay)
5+
# get value of NORMALIZED_BOARD_TARGET early
6+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards)
7+
8+
set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay)
79

810
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
911
project(spi_controller)

0 commit comments

Comments
 (0)