From 2bfd863882182c836c43c33cff07d020acf43979 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Thu, 4 Apr 2024 16:12:27 +0200 Subject: [PATCH] Added ESP32-S3 build --- .github/workflows/release.yml | 23 ++++++++++++++++++++ platformio.ini | 12 +++++++++++ scripts/esp32s3/flash.sh | 40 +++++++++++++++++++++++++++++++++++ scripts/esp32s3/mkzip.sh | 13 ++++++++++++ 4 files changed, 88 insertions(+) create mode 100755 scripts/esp32s3/flash.sh create mode 100755 scripts/esp32s3/mkzip.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1068853..d0fb65c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -147,6 +147,29 @@ jobs: asset_name: ams2mqtt-esp32s2-${{ steps.release_tag.outputs.tag }}.zip asset_content_type: application/zip + - name: Build esp32s3 firmware + run: pio run -e esp32s3 + - name: Create esp32s3 zip file + run: /bin/sh scripts/esp32s3/mkzip.sh + - name: Upload esp32s3 binary to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .pio/build/esp32s3/firmware.bin + asset_name: ams2mqtt-esp32s3-${{ steps.release_tag.outputs.tag }}.bin + asset_content_type: application/octet-stream + - name: Upload esp32s3 zip to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: esp32s3.zip + asset_name: ams2mqtt-esp32s3-${{ steps.release_tag.outputs.tag }}.zip + asset_content_type: application/zip + - name: Build esp32solo firmware run: pio run -e esp32solo - name: Create esp32solo zip file diff --git a/platformio.ini b/platformio.ini index 85da8058..385f7d53 100755 --- a/platformio.ini +++ b/platformio.ini @@ -86,4 +86,16 @@ lib_ldf_mode = off lib_compat_mode = off lib_deps = ${esp32.lib_deps} lib_ignore = ${common.lib_ignore} +extra_scripts = ${common.extra_scripts} + +[env:esp32s3] +platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.07.00/platform-espressif32.zip +framework = arduino +board = esp32-s3-devkitc-1 +board_build.mcu = esp32s3 +build_flags = ${common.build_flags} +lib_ldf_mode = off +lib_compat_mode = off +lib_deps = ${esp32.lib_deps} +lib_ignore = ${common.lib_ignore} extra_scripts = ${common.extra_scripts} \ No newline at end of file diff --git a/scripts/esp32s3/flash.sh b/scripts/esp32s3/flash.sh new file mode 100755 index 00000000..aab3084f --- /dev/null +++ b/scripts/esp32s3/flash.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +if [ -z "$1" ];then + echo "Usage: " + echo " Flashing first time : $0 flash /dev/ttyUSB0" + echo " When upgrading to new version : $0 upgrade /dev/ttyUSB0" + echo " NOTE: Replace /dev/ttyUSB0 with correct port" + exit 1 +fi + +if [ -z "$2" ];then + echo "Please specify port" + exit 1 +fi + +esptool=`which esptool` +if [ -z "$esptool" ];then + esptool=`which esptool.py` +fi +if [ -z "$esptool" ];then + if [ -f esptool.py ];then + esptool="esptool.py" + fi +fi +if [ -z "$esptool" ];then + echo "esptool.py not available to run following command: " + esptool="echo esptool.py" +fi + +if [ "$1" = "flash" ];then + $esptool --chip esp32s3 --port $2 --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect \ + 0x0000 bootloader.bin \ + 0x8000 partitions.bin \ + 0xe000 boot_app0.bin \ + 0x10000 firmware.bin + exit $? +elif [ "$1" = "upgrade" ];then + $esptool --chip esp32s3 --port $2 --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 firmware.bin + exit $? +fi diff --git a/scripts/esp32s3/mkzip.sh b/scripts/esp32s3/mkzip.sh new file mode 100755 index 00000000..2556834c --- /dev/null +++ b/scripts/esp32s3/mkzip.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +env="esp32s3" +build_dir=".pio/build/$env/" + +if [ ! -d $build_dir ];then + echo "No build directory" + exit 1 +fi + +cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin $build_dir +chmod +x scripts/$env/flash.sh +zip -j $env.zip $build_dir/*.bin scripts/$env/flash.sh