diff --git a/.github/scripts/install-platformio-esp32.sh b/.github/scripts/install-platformio-esp32.sh index 393c9f3a7d6..a9aab496e19 100755 --- a/.github/scripts/install-platformio-esp32.sh +++ b/.github/scripts/install-platformio-esp32.sh @@ -6,7 +6,7 @@ PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git" TOOLCHAIN_VERSION="12.2.0+20230208" ESPTOOLPY_VERSION="~1.40501.0" ESPRESSIF_ORGANIZATION_NAME="espressif" -LIBS_DIR="tools/esp32-arduino-libs" +SDKCONFIG_DIR="$PLATFORMIO_ESP32_PATH/tools/esp32-arduino-libs" echo "Installing Python Wheel ..." pip install wheel > /dev/null 2>&1 @@ -100,7 +100,8 @@ function count_sketches(){ # count_sketches requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then for requirement in $requirements; do - found_line=$(grep -E "^$requirement" $LIBS_DIR/esp32/sdkconfig) + requirement=$(echo $requirement | xargs) + found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig") if [[ "$found_line" == "" ]]; then continue 2 fi @@ -190,7 +191,8 @@ function build_pio_sketches(){ # build_pio_sketches [extra-options] while [ ! -z "$1" ]; do @@ -83,14 +89,21 @@ function build_sketch(){ # build_sketch [ex len=1 + if [ -f $sketchdir/ci.json ]; then + fqbn_append=`jq -r '.fqbn_append' $sketchdir/ci.json` + if [ $fqbn_append == "null" ]; then + fqbn_append="" + fi + fi + # Default FQBN options if none were passed in the command line. - esp32_opts="PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio" - esp32s2_opts="PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio" - esp32s3_opts="PSRAM=opi,USBMode=default,PartitionScheme=huge_app,FlashMode=dio" - esp32c3_opts="PartitionScheme=huge_app,FlashMode=dio" - esp32c6_opts="PartitionScheme=huge_app,FlashMode=dio" - esp32h2_opts="PartitionScheme=huge_app,FlashMode=dio" + esp32_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}" + esp32s2_opts="PSRAM=enabled,FlashMode=dio${fqbn_append:+,$fqbn_append}" + esp32s3_opts="PSRAM=opi,USBMode=default,FlashMode=dio${fqbn_append:+,$fqbn_append}" + esp32c3_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}" + esp32c6_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}" + esp32h2_opts="FlashMode=dio${fqbn_append:+,$fqbn_append}" # Select the common part of the FQBN based on the target. The rest will be # appended depending on the passed options. @@ -154,7 +167,8 @@ function build_sketch(){ # build_sketch [ex requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then for requirement in $requirements; do - found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig) + requirement=$(echo $requirement | xargs) + found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig") if [[ "$found_line" == "" ]]; then echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping." exit 0 @@ -270,10 +284,11 @@ function build_sketch(){ # build_sketch [ex unset options } -function count_sketches(){ # count_sketches [target] [file] +function count_sketches(){ # count_sketches [target] [file] [ignore-requirements] local path=$1 local target=$2 - local file=$3 + local ignore_requirements=$3 + local file=$4 if [ $# -lt 1 ]; then echo "ERROR: Illegal number of parameters" @@ -286,7 +301,7 @@ function count_sketches(){ # count_sketches [target] [file] return 0 fi - if [ -n "$file" ]; then + if [ -f "$file" ]; then local sketches=$(cat $file) else local sketches=$(find $path -name *.ino | sort) @@ -306,15 +321,18 @@ function count_sketches(){ # count_sketches [target] [file] continue fi - # Check if the sketch requires any configuration options - requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) - if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then - for requirement in $requirements; do - found_line=$(grep -E "^$requirement" $LIBS_DIR/$target/sdkconfig) - if [[ "$found_line" == "" ]]; then - continue 2 - fi - done + if [ "$ignore_requirements" != "1" ]; then + # Check if the sketch requires any configuration options + requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json) + if [[ "$requirements" != "null" ]] || [[ "$requirements" != "" ]]; then + for requirement in $requirements; do + requirement=$(echo $requirement | xargs) + found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig) + if [[ "$found_line" == "" ]]; then + continue 2 + fi + done + fi fi fi echo $sketch >> sketches.txt @@ -392,7 +410,7 @@ function build_sketches(){ # build_sketches `_ - are used if this field is not specified. + are used if this field is not specified. This overrides the default FQBNs and the ``fqbn_append`` field. The ``wifi`` test suite is a good example of how to use the ``ci.json`` file: diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/ci.json b/libraries/ESP32/examples/Camera/CameraWebServer/ci.json index 7e0f3c89986..35c3056dda8 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/ci.json +++ b/libraries/ESP32/examples/Camera/CameraWebServer/ci.json @@ -1,4 +1,19 @@ { + "fqbn": { + "esp32": [ + "espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=custom,FlashMode=dio", + "espressif:esp32:esp32:PSRAM=disabled,PartitionScheme=custom,FlashMode=dio" + ], + "esp32s2": [ + "espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=custom,FlashMode=dio", + "espressif:esp32:esp32s2:PSRAM=disabled,PartitionScheme=custom,FlashMode=dio" + ], + "esp32s3": [ + "espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=custom,FlashMode=qio", + "espressif:esp32:esp32s3:PSRAM=enabled,USBMode=default,PartitionScheme=custom,FlashMode=qio", + "espressif:esp32:esp32s3:PSRAM=disabled,USBMode=default,PartitionScheme=custom,FlashMode=qio" + ] + }, "requires": [ "CONFIG_CAMERA_TASK_STACK_SIZE=[0-9]+" ] diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/partitions.csv b/libraries/ESP32/examples/Camera/CameraWebServer/partitions.csv index 4f76ca6d746..b9f18c465a7 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/partitions.csv +++ b/libraries/ESP32/examples/Camera/CameraWebServer/partitions.csv @@ -1,5 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, -app0, app, ota_0, 0x10000, 0x3d0000, -fr, data, , 0x3e0000, 0x20000, +app0, app, ota_0, 0x10000, 0x3c0000, +fr, data, , 0x3d0000, 0x20000, +coredump, data, coredump,0x3f0000, 0x10000, diff --git a/libraries/RainMaker/examples/RMakerCustom/ci.json b/libraries/RainMaker/examples/RMakerCustom/ci.json index de4e92436d7..833a13f0860 100644 --- a/libraries/RainMaker/examples/RMakerCustom/ci.json +++ b/libraries/RainMaker/examples/RMakerCustom/ci.json @@ -1,6 +1,7 @@ { + "fqbn_append": "PartitionScheme=rainmaker_4MB", "requires": [ "CONFIG_SOC_WIFI_SUPPORTED=y", - "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK" + "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=[1-9][0-9]*" ] } diff --git a/libraries/RainMaker/examples/RMakerCustomAirCooler/ci.json b/libraries/RainMaker/examples/RMakerCustomAirCooler/ci.json index de4e92436d7..833a13f0860 100644 --- a/libraries/RainMaker/examples/RMakerCustomAirCooler/ci.json +++ b/libraries/RainMaker/examples/RMakerCustomAirCooler/ci.json @@ -1,6 +1,7 @@ { + "fqbn_append": "PartitionScheme=rainmaker_4MB", "requires": [ "CONFIG_SOC_WIFI_SUPPORTED=y", - "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK" + "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=[1-9][0-9]*" ] } diff --git a/libraries/RainMaker/examples/RMakerSonoffDualR3/ci.json b/libraries/RainMaker/examples/RMakerSonoffDualR3/ci.json index de4e92436d7..833a13f0860 100644 --- a/libraries/RainMaker/examples/RMakerSonoffDualR3/ci.json +++ b/libraries/RainMaker/examples/RMakerSonoffDualR3/ci.json @@ -1,6 +1,7 @@ { + "fqbn_append": "PartitionScheme=rainmaker_4MB", "requires": [ "CONFIG_SOC_WIFI_SUPPORTED=y", - "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK" + "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=[1-9][0-9]*" ] } diff --git a/libraries/RainMaker/examples/RMakerSwitch/ci.json b/libraries/RainMaker/examples/RMakerSwitch/ci.json index de4e92436d7..833a13f0860 100644 --- a/libraries/RainMaker/examples/RMakerSwitch/ci.json +++ b/libraries/RainMaker/examples/RMakerSwitch/ci.json @@ -1,6 +1,7 @@ { + "fqbn_append": "PartitionScheme=rainmaker_4MB", "requires": [ "CONFIG_SOC_WIFI_SUPPORTED=y", - "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK" + "CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=[1-9][0-9]*" ] } diff --git a/libraries/WiFiProv/examples/WiFiProv/ci.json b/libraries/WiFiProv/examples/WiFiProv/ci.json index 36babb82730..04eb62b977a 100644 --- a/libraries/WiFiProv/examples/WiFiProv/ci.json +++ b/libraries/WiFiProv/examples/WiFiProv/ci.json @@ -1,4 +1,5 @@ { + "fqbn_append": "PartitionScheme=huge_app", "requires": [ "CONFIG_SOC_WIFI_SUPPORTED=y" ] diff --git a/libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/ci.json b/libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/ci.json index 3aaf44eb376..7b7ccef8ed7 100644 --- a/libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/ci.json +++ b/libraries/Zigbee/examples/Zigbee_Color_Dimmable_Light/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee,ZigbeeMode=ed" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee,ZigbeeMode=ed" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/ci.json b/libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/ci.json index c916121b991..e79a477da11 100644 --- a/libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/ci.json +++ b/libraries/Zigbee/examples/Zigbee_Color_Dimmer_Switch/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee_zczr,ZigbeeMode=zczr", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/libraries/Zigbee/examples/Zigbee_On_Off_Light/ci.json b/libraries/Zigbee/examples/Zigbee_On_Off_Light/ci.json index 3aaf44eb376..7b7ccef8ed7 100644 --- a/libraries/Zigbee/examples/Zigbee_On_Off_Light/ci.json +++ b/libraries/Zigbee/examples/Zigbee_On_Off_Light/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee,ZigbeeMode=ed" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee,ZigbeeMode=ed" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/libraries/Zigbee/examples/Zigbee_On_Off_Switch/ci.json b/libraries/Zigbee/examples/Zigbee_On_Off_Switch/ci.json index c916121b991..e79a477da11 100644 --- a/libraries/Zigbee/examples/Zigbee_On_Off_Switch/ci.json +++ b/libraries/Zigbee/examples/Zigbee_On_Off_Switch/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee_zczr,ZigbeeMode=zczr", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/libraries/Zigbee/examples/Zigbee_Scan_Networks/ci.json b/libraries/Zigbee/examples/Zigbee_Scan_Networks/ci.json index 3aaf44eb376..7b7ccef8ed7 100644 --- a/libraries/Zigbee/examples/Zigbee_Scan_Networks/ci.json +++ b/libraries/Zigbee/examples/Zigbee_Scan_Networks/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee,ZigbeeMode=ed" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee,ZigbeeMode=ed" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/libraries/Zigbee/examples/Zigbee_Temperature_Sensor/ci.json b/libraries/Zigbee/examples/Zigbee_Temperature_Sensor/ci.json index 3aaf44eb376..7b7ccef8ed7 100644 --- a/libraries/Zigbee/examples/Zigbee_Temperature_Sensor/ci.json +++ b/libraries/Zigbee/examples/Zigbee_Temperature_Sensor/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee,ZigbeeMode=ed" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee,ZigbeeMode=ed" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee,ZigbeeMode=ed", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/libraries/Zigbee/examples/Zigbee_Thermostat/ci.json b/libraries/Zigbee/examples/Zigbee_Thermostat/ci.json index c916121b991..e79a477da11 100644 --- a/libraries/Zigbee/examples/Zigbee_Thermostat/ci.json +++ b/libraries/Zigbee/examples/Zigbee_Thermostat/ci.json @@ -1,16 +1,6 @@ { - "fqbn": { - "esp32c6": [ - "espressif:esp32:esp32c6:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr" - ], - "esp32h2": [ - "espressif:esp32:esp32h2:PartitionScheme=zigbee_zczr,ZigbeeMode=zczr" - ] - }, - "targets": { - "esp32": false, - "esp32c3": false, - "esp32s2": false, - "esp32s3": false - } + "fqbn_append": "PartitionScheme=zigbee_zczr,ZigbeeMode=zczr", + "requires": [ + "CONFIG_SOC_IEEE802154_SUPPORTED=y" + ] } diff --git a/platform.txt b/platform.txt index 873e27b0ecb..a1574e2f776 100644 --- a/platform.txt +++ b/platform.txt @@ -143,6 +143,10 @@ recipe.hooks.prebuild.7.pattern.windows=cmd /c type nul > "{file_opts.path}" recipe.hooks.core.prebuild.1.pattern.windows=cmd /c echo "-DARDUINO_CORE_BUILD" > "{file_opts.path}" recipe.hooks.core.postbuild.1.pattern.windows=cmd /c type nul > "{file_opts.path}" +# Copy sdkconfig to build folder +recipe.hooks.prebuild.8.pattern=/usr/bin/env bash -c "cp -f "{runtime.platform.path}"/tools/esp32-arduino-libs/{build.mcu}/sdkconfig "{build.path}"/sdkconfig" +recipe.hooks.prebuild.8.pattern.windows=cmd /c COPY /y "{runtime.platform.path}\tools\esp32-arduino-libs\{build.mcu}\sdkconfig" "{build.path}\sdkconfig" + ## Compile c files recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.extra_flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {build.extra_flags} {compiler.cpreprocessor.flags} {includes} "@{build.opt.path}" "@{file_opts.path}" "{source_file}" -o "{object_file}"