Skip to content

Commit ca7bcc0

Browse files
authored
Update PlatformIO scripts for the upcoming 3.0 core (#8183)
* Update PlatformIO scripts for the upcoming 3.0 core * Dynamically select proper framework-arduinoespressif32-libs package With this change the dev-platform will be dynamically configured to pull the latest .zip package with precompiled libraries from extracted from package_esp32_index.template.json
1 parent 2e4a1b9 commit ca7bcc0

File tree

3 files changed

+28
-27
lines changed

3 files changed

+28
-27
lines changed

.github/scripts/install-platformio-esp32.sh

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
44
PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git"
55

6-
TOOLCHAIN_VERSION="8.4.0+2021r2-patch5"
7-
ESPTOOLPY_VERSION="~1.40400.0"
6+
TOOLCHAIN_VERSION="12.2.0+20230208"
7+
ESPTOOLPY_VERSION="~1.40501.0"
88
ESPRESSIF_ORGANIZATION_NAME="espressif"
99

1010
echo "Installing Python Wheel ..."
@@ -30,9 +30,15 @@ replace_script+="data['packages']['toolchain-riscv32-esp']['owner']='$ESPRESSIF_
3030
# Update versions to use the upstream
3131
replace_script+="data['packages']['toolchain-xtensa-esp32']['version']='$TOOLCHAIN_VERSION';"
3232
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['version']='$TOOLCHAIN_VERSION';"
33+
replace_script+="data['packages']['toolchain-xtensa-esp32s3']['version']='$TOOLCHAIN_VERSION';"
3334
replace_script+="data['packages']['toolchain-riscv32-esp']['version']='$TOOLCHAIN_VERSION';"
34-
# Add ESP32-S3 Toolchain
35-
replace_script+="data['packages'].update({'toolchain-xtensa-esp32s3':{'type':'toolchain','optional':True,'owner':'$ESPRESSIF_ORGANIZATION_NAME','version':'$TOOLCHAIN_VERSION'}});"
35+
# Add new "framework-arduinoespressif32-libs" package
36+
# Read "package_esp32_index.template.json" to extract a url to a zip package for "esp32-arduino-libs"
37+
replace_script+="fpackage=open(os.path.join('package', 'package_esp32_index.template.json'), 'r+');"
38+
replace_script+="package_data=json.load(fpackage);"
39+
replace_script+="fpackage.close();"
40+
replace_script+="libs_package_archive_url=next(next(system['url'] for system in tool['systems'] if system['host'] == 'x86_64-pc-linux-gnu') for tool in package_data['packages'][0]['tools'] if tool['name'] == 'esp32-arduino-libs');"
41+
replace_script+="data['packages'].update({'framework-arduinoespressif32-libs':{'type':'framework','optional':False,'version':libs_package_archive_url}});"
3642
replace_script+="data['packages']['toolchain-xtensa-esp32'].update({'optional':False});"
3743
# esptool.py may require an upstream version (for now platformio is the owner)
3844
replace_script+="data['packages']['tool-esptoolpy']['version']='$ESPTOOLPY_VERSION';"

.github/workflows/push.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ jobs:
6363
- name: Build Sketches
6464
run: bash ./.github/scripts/on-push.sh
6565

66-
# # PlatformIO on Windows, Ubuntu and Mac
67-
# build-platformio:
68-
# name: PlatformIO on ${{ matrix.os }}
69-
# runs-on: ${{ matrix.os }}
70-
# strategy:
71-
# matrix:
72-
# os: [ubuntu-latest, windows-latest, macOS-latest]
66+
# PlatformIO on Windows, Ubuntu and Mac
67+
build-platformio:
68+
name: PlatformIO on ${{ matrix.os }}
69+
runs-on: ${{ matrix.os }}
70+
strategy:
71+
matrix:
72+
os: [ubuntu-latest, windows-latest, macOS-latest]
7373

74-
# steps:
75-
# - uses: actions/checkout@v3
76-
# - uses: actions/setup-python@v4
77-
# with:
78-
# python-version: '3.x'
79-
# - name: Build Sketches
80-
# run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
74+
steps:
75+
- uses: actions/checkout@v3
76+
- uses: actions/setup-python@v4
77+
with:
78+
python-version: '3.x'
79+
- name: Build Sketches
80+
run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
8181

8282
# build-esp-idf-component:
8383
# name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}

tools/platformio-build.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
)
3838

3939
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
40+
FRAMEWORK_LIBS_DIR = platform.get_package_dir("framework-arduinoespressif32-libs")
4041
assert isdir(FRAMEWORK_DIR)
4142

4243

@@ -84,9 +85,7 @@ def get_bootloader_image(variants_dir):
8485
if isfile(env.subst(variant_bootloader))
8586
else generate_bootloader_image(
8687
join(
87-
FRAMEWORK_DIR,
88-
"tools",
89-
"esp32-arduino-libs",
88+
FRAMEWORK_LIBS_DIR,
9089
build_mcu,
9190
"bin",
9291
"bootloader_${__get_board_boot_mode(__env__)}_${__get_board_f_flash(__env__)}.elf",
@@ -160,12 +159,8 @@ def add_tinyuf2_extra_image():
160159

161160
SConscript(
162161
join(
163-
DefaultEnvironment()
164-
.PioPlatform()
165-
.get_package_dir("framework-arduinoespressif32"),
166-
"tools",
167-
"esp32-arduino-libs",
168-
"%s" % build_mcu,
162+
FRAMEWORK_LIBS_DIR,
163+
build_mcu,
169164
"platformio-build.py",
170165
)
171166
)

0 commit comments

Comments
 (0)