Skip to content

Commit

Permalink
Update PlatformIO scripts for the upcoming 3.0 core (#8183)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
valeros authored May 16, 2023
1 parent 2e4a1b9 commit ca7bcc0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 27 deletions.
14 changes: 10 additions & 4 deletions .github/scripts/install-platformio-esp32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git"

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

echo "Installing Python Wheel ..."
Expand All @@ -30,9 +30,15 @@ replace_script+="data['packages']['toolchain-riscv32-esp']['owner']='$ESPRESSIF_
# Update versions to use the upstream
replace_script+="data['packages']['toolchain-xtensa-esp32']['version']='$TOOLCHAIN_VERSION';"
replace_script+="data['packages']['toolchain-xtensa-esp32s2']['version']='$TOOLCHAIN_VERSION';"
replace_script+="data['packages']['toolchain-xtensa-esp32s3']['version']='$TOOLCHAIN_VERSION';"
replace_script+="data['packages']['toolchain-riscv32-esp']['version']='$TOOLCHAIN_VERSION';"
# Add ESP32-S3 Toolchain
replace_script+="data['packages'].update({'toolchain-xtensa-esp32s3':{'type':'toolchain','optional':True,'owner':'$ESPRESSIF_ORGANIZATION_NAME','version':'$TOOLCHAIN_VERSION'}});"
# Add new "framework-arduinoespressif32-libs" package
# Read "package_esp32_index.template.json" to extract a url to a zip package for "esp32-arduino-libs"
replace_script+="fpackage=open(os.path.join('package', 'package_esp32_index.template.json'), 'r+');"
replace_script+="package_data=json.load(fpackage);"
replace_script+="fpackage.close();"
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');"
replace_script+="data['packages'].update({'framework-arduinoespressif32-libs':{'type':'framework','optional':False,'version':libs_package_archive_url}});"
replace_script+="data['packages']['toolchain-xtensa-esp32'].update({'optional':False});"
# esptool.py may require an upstream version (for now platformio is the owner)
replace_script+="data['packages']['tool-esptoolpy']['version']='$ESPTOOLPY_VERSION';"
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ jobs:
- name: Build Sketches
run: bash ./.github/scripts/on-push.sh

# # PlatformIO on Windows, Ubuntu and Mac
# build-platformio:
# name: PlatformIO on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest, macOS-latest]
# PlatformIO on Windows, Ubuntu and Mac
build-platformio:
name: PlatformIO on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

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

# build-esp-idf-component:
# name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
Expand Down
13 changes: 4 additions & 9 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
)

FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
FRAMEWORK_LIBS_DIR = platform.get_package_dir("framework-arduinoespressif32-libs")
assert isdir(FRAMEWORK_DIR)


Expand Down Expand Up @@ -84,9 +85,7 @@ def get_bootloader_image(variants_dir):
if isfile(env.subst(variant_bootloader))
else generate_bootloader_image(
join(
FRAMEWORK_DIR,
"tools",
"esp32-arduino-libs",
FRAMEWORK_LIBS_DIR,
build_mcu,
"bin",
"bootloader_${__get_board_boot_mode(__env__)}_${__get_board_f_flash(__env__)}.elf",
Expand Down Expand Up @@ -160,12 +159,8 @@ def add_tinyuf2_extra_image():

SConscript(
join(
DefaultEnvironment()
.PioPlatform()
.get_package_dir("framework-arduinoespressif32"),
"tools",
"esp32-arduino-libs",
"%s" % build_mcu,
FRAMEWORK_LIBS_DIR,
build_mcu,
"platformio-build.py",
)
)
Expand Down

0 comments on commit ca7bcc0

Please sign in to comment.