Skip to content

Commit d67a19b

Browse files
committed
feat(idf): Add ci.json support for IDF examples
1 parent ee6a288 commit d67a19b

File tree

13 files changed

+95
-214
lines changed

13 files changed

+95
-214
lines changed

Diff for: .github/scripts/on-push-idf.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
CHECK_REQUIREMENTS="./components/arduino-esp32/.github/scripts/sketch_utils.sh check_requirements"
6+
7+
# Export IDF environment
8+
. ${IDF_PATH}/export.sh
9+
10+
# Find all examples in ./components/arduino-esp32/idf_component_examples
11+
idf_component_examples=$(find ./components/arduino-esp32/idf_component_examples -mindepth 1 -maxdepth 1 -type d)
12+
13+
for example in $idf_component_examples; do
14+
if [ -f "$example"/ci.json ]; then
15+
# If the target is listed as false, skip the sketch. Otherwise, include it.
16+
is_target=$(jq -r --arg target "$IDF_TARGET" '.targets[$target]' "$example"/ci.json)
17+
if [[ "$is_target" == "false" ]]; then
18+
printf "\n\033[93mSkipping %s for target %s\033[0m\n\n" "$example" "$IDF_TARGET"
19+
continue
20+
fi
21+
fi
22+
23+
idf.py -C "$example" set-target "$IDF_TARGET"
24+
25+
has_requirements=$(${CHECK_REQUIREMENTS} "$example" "$example/sdkconfig")
26+
if [ "$has_requirements" -eq 0 ]; then
27+
printf "\n\033[93m%s does not meet the requirements for %s. Skipping...\033[0m\n\n" "$example" "$IDF_TARGET"
28+
continue
29+
fi
30+
31+
printf "\n\033[95mBuilding %s\033[0m\n\n" "$example"
32+
idf.py -C "$example" -DEXTRA_COMPONENT_DIRS="$PWD/components" build
33+
done

Diff for: .github/scripts/sketch_utils.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function check_requirements { # check_requirements <sketchdir> <sdkconfig_path>
1616
local requirements_or
1717

1818
if [ ! -f "$sdkconfig_path" ] || [ ! -f "$sketchdir/ci.json" ]; then
19-
echo "ERROR: sdkconfig or ci.json not found" 1>&2
19+
echo "WARNING: sdkconfig or ci.json not found. Assuming requirements are met." 1>&2
2020
# Return 1 on error to force the sketch to be built and fail. This way the
2121
# CI will fail and the user will know that the sketch has a problem.
2222
else

Diff for: .github/workflows/push.yml

+14-6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
- "!libraries/**.properties"
3232
- "!libraries/**.py"
3333
- "package/**"
34+
- "idf_component_examples/**"
3435
- "tools/**.py"
3536
- "platform.txt"
3637
- "programmers.txt"
@@ -45,7 +46,6 @@ on:
4546
- "!.github/scripts/tests_*"
4647
- "!.github/scripts/upload_*"
4748
- "variants/esp32/**/*"
48-
- "variants/esp32c2/**/*"
4949
- "variants/esp32c3/**/*"
5050
- "variants/esp32c6/**/*"
5151
- "variants/esp32h2/**/*"
@@ -124,7 +124,7 @@ jobs:
124124
- 'idf_component.yml'
125125
- 'Kconfig.projbuild'
126126
- 'CMakeLists.txt'
127-
- "variants/esp32c2/**/*"
127+
- "idf_component_examples/**"
128128
129129
- name: Set chunks
130130
id: set-chunks
@@ -267,15 +267,23 @@ jobs:
267267
submodules: recursive
268268
path: components/arduino-esp32
269269

270+
- name: Setup jq
271+
uses: dcarbone/install-jq-action@e397bd87438d72198f81efd21f876461183d383a # v3.0.1
272+
270273
- name: Build
271274
env:
272275
IDF_TARGET: ${{ matrix.idf_target }}
273276
shell: bash
274277
run: |
275-
. ${IDF_PATH}/export.sh
276-
idf.py -C ./components/arduino-esp32/idf_component_examples/hello_world -DEXTRA_COMPONENT_DIRS=$PWD/components build
277-
idf.py -C ./components/arduino-esp32/idf_component_examples/hw_cdc_hello_world -DEXTRA_COMPONENT_DIRS=$PWD/components build
278-
idf.py -C ./components/arduino-esp32/idf_component_examples/esp_matter_light -DEXTRA_COMPONENT_DIRS=$PWD/components build
278+
chmod a+x ./components/arduino-esp32/.github/scripts/*
279+
./components/arduino-esp32/.github/scripts/on-push-idf.sh
280+
281+
- name: Upload generated sdkconfig files for debugging
282+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
283+
if: always()
284+
with:
285+
name: sdkconfig-${{ matrix.idf_target }}
286+
path: ./components/arduino-esp32/idf_component_examples/**/sdkconfig
279287

280288
# Save artifacts to gh-pages
281289
save-master-artifacts:

Diff for: idf_component_examples/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
managed_components/
3+
dependencies.lock
4+
sdkconfig

Diff for: idf_component_examples/esp_matter_light/ci.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"targets": {
3+
"esp32c2": false,
4+
"esp32s2": false
5+
},
6+
"requires": [
7+
"CONFIG_SOC_WIFI_SUPPORTED=y",
8+
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y",
9+
"CONFIG_MBEDTLS_HKDF_C=y"
10+
]
11+
}

Diff for: idf_component_examples/esp_matter_light/main/Kconfig.projbuild

+18-78
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,40 @@ menu "Light Matter Accessory"
33
config BUTTON_PIN
44
int
55
prompt "Button 1 GPIO"
6-
default ENV_GPIO_BOOT_BUTTON
6+
default 9 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C6
7+
default 0
78
range -1 ENV_GPIO_IN_RANGE_MAX
89
help
910
The GPIO pin for button that will be used to turn on/off the Matter Light. It shall be connected to a push button. It can use the BOOT button of the development board.
1011
endmenu
1112

12-
1313
menu "LEDs"
1414
config WS2812_PIN
1515
int
1616
prompt "WS2812 RGB LED GPIO"
17-
default ENV_GPIO_RGB_LED
17+
default 8 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C6
18+
default 48
1819
range -1 ENV_GPIO_OUT_RANGE_MAX
1920
help
2021
The GPIO pin for the Matter Light that will be driven by RMT. It shall be connected to one single WS2812 RGB LED.
2122
endmenu
2223

23-
# TARGET CONFIGURATION
24-
if IDF_TARGET_ESP32C3
25-
config ENV_GPIO_RANGE_MIN
26-
int
27-
default 0
28-
29-
config ENV_GPIO_RANGE_MAX
30-
int
31-
default 19
32-
# GPIOs 20/21 are always used by UART in examples
33-
34-
config ENV_GPIO_IN_RANGE_MAX
35-
int
36-
default ENV_GPIO_RANGE_MAX
37-
38-
config ENV_GPIO_OUT_RANGE_MAX
39-
int
40-
default ENV_GPIO_RANGE_MAX
41-
42-
config ENV_GPIO_BOOT_BUTTON
43-
int
44-
default 9
45-
46-
config ENV_GPIO_RGB_LED
47-
int
48-
default 8
49-
endif
50-
if IDF_TARGET_ESP32C6
51-
config ENV_GPIO_RANGE_MIN
52-
int
53-
default 0
24+
config ENV_GPIO_RANGE_MIN
25+
int
26+
default 0
5427

55-
config ENV_GPIO_RANGE_MAX
56-
int
57-
default 30
58-
# GPIOs 16/17 are always used by UART in examples
28+
config ENV_GPIO_RANGE_MAX
29+
int
30+
default 19 if IDF_TARGET_ESP32C3
31+
default 30 if IDF_TARGET_ESP32C6
32+
default 48
5933

60-
config ENV_GPIO_IN_RANGE_MAX
61-
int
62-
default ENV_GPIO_RANGE_MAX
34+
config ENV_GPIO_IN_RANGE_MAX
35+
int
36+
default ENV_GPIO_RANGE_MAX
6337

64-
config ENV_GPIO_OUT_RANGE_MAX
65-
int
66-
default ENV_GPIO_RANGE_MAX
67-
68-
config ENV_GPIO_BOOT_BUTTON
69-
int
70-
default 9
71-
72-
config ENV_GPIO_RGB_LED
73-
int
74-
default 8
75-
endif
76-
if IDF_TARGET_ESP32S3
77-
config ENV_GPIO_RANGE_MIN
78-
int
79-
default 0
80-
81-
config ENV_GPIO_RANGE_MAX
82-
int
83-
default 48
84-
85-
config ENV_GPIO_IN_RANGE_MAX
86-
int
87-
default ENV_GPIO_RANGE_MAX
88-
89-
config ENV_GPIO_OUT_RANGE_MAX
90-
int
91-
default ENV_GPIO_RANGE_MAX
92-
93-
config ENV_GPIO_BOOT_BUTTON
94-
int
95-
default 0
96-
97-
config ENV_GPIO_RGB_LED
98-
int
99-
default 48
100-
endif
38+
config ENV_GPIO_OUT_RANGE_MAX
39+
int
40+
default ENV_GPIO_RANGE_MAX
10141

10242
endmenu

Diff for: idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c3 renamed to idf_component_examples/esp_matter_light/sdkconfig.defaults

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
CONFIG_IDF_TARGET="esp32c3"
2-
31
# Arduino Settings
42
CONFIG_FREERTOS_HZ=1000
53
CONFIG_AUTOSTART_ARDUINO=y
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CONFIG_IDF_TARGET="esp32c2"
2+
3+
# CMake Utilities
4+
CONFIG_CU_RELINKER_ENABLE=y
5+
CONFIG_CU_RELINKER_ENABLE_CUSTOMIZED_CONFIGURATION_FILES=y
6+
CONFIG_CU_RELINKER_CUSTOMIZED_CONFIGURATION_FILES_PATH="../common/relinker/esp32c2_v5.4"

Diff for: idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32c6

-63
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,5 @@
11
CONFIG_IDF_TARGET="esp32c6"
22

3-
# Arduino Settings
4-
CONFIG_FREERTOS_HZ=1000
5-
CONFIG_AUTOSTART_ARDUINO=y
6-
7-
# Log Levels
8-
# Boot Messages - Log level
9-
CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y
10-
# Arduino Log Level
11-
CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO=y
12-
# IDF Log Level
13-
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y
14-
15-
# Default to 921600 baud when flashing and monitoring device
16-
CONFIG_ESPTOOLPY_BAUD_921600B=y
17-
CONFIG_ESPTOOLPY_BAUD=921600
18-
CONFIG_ESPTOOLPY_COMPRESSED=y
19-
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
20-
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
21-
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
22-
23-
#enable BT
24-
CONFIG_BT_ENABLED=y
25-
CONFIG_BT_NIMBLE_ENABLED=y
26-
27-
#disable BT connection reattempt
28-
CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=n
29-
30-
#enable lwip ipv6 autoconfig
31-
CONFIG_LWIP_IPV6_AUTOCONFIG=y
32-
33-
# Use a custom partition table
34-
CONFIG_PARTITION_TABLE_CUSTOM=y
35-
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
36-
CONFIG_PARTITION_TABLE_OFFSET=0xC000
37-
38-
# Disable chip shell
39-
CONFIG_ENABLE_CHIP_SHELL=n
40-
41-
# Enable OTA Requester
42-
CONFIG_ENABLE_OTA_REQUESTOR=n
43-
44-
#enable lwIP route hooks
45-
CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT=y
46-
CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT=y
47-
48-
# disable softap by default
49-
CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
50-
CONFIG_ENABLE_WIFI_STATION=y
51-
CONFIG_ENABLE_WIFI_AP=n
52-
53-
# Disable DS Peripheral
54-
CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n
55-
56-
# Use compact attribute storage mode
57-
CONFIG_ESP_MATTER_NVS_USE_COMPACT_ATTR_STORAGE=y
58-
59-
# Enable HKDF in mbedtls
60-
CONFIG_MBEDTLS_HKDF_C=y
61-
62-
# Increase LwIP IPv6 address number to 6 (MAX_FABRIC + 1)
63-
# unique local addresses for fabrics(MAX_FABRIC), a link local address(1)
64-
CONFIG_LWIP_IPV6_NUM_ADDRESSES=6
65-
663
# libsodium
674
CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y
685

Diff for: idf_component_examples/esp_matter_light/sdkconfig.defaults.esp32s3

-64
This file was deleted.

Diff for: idf_component_examples/hello_world/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
cmake_minimum_required(VERSION 3.16)
66

77
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
8+
9+
idf_build_set_property(MINIMAL_BUILD ON)
810
project(main)

Diff for: idf_component_examples/hw_cdc_hello_world/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake)
99
list(APPEND compile_definitions "ARDUINO_USB_CDC_ON_BOOT=1")
1010
list(APPEND compile_definitions "ARDUINO_USB_MODE=1")
1111

12+
idf_build_set_property(MINIMAL_BUILD ON)
1213
project(hw_cdc_hello_world)

Diff for: idf_component_examples/hw_cdc_hello_world/ci.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"requires": [
3+
"CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED=y"
4+
]
5+
}

0 commit comments

Comments
 (0)