fix: update firmware build process and remove unused OTA environment

This commit is contained in:
Manuel Weiser 2025-02-20 19:52:34 +01:00
parent c3040b3c29
commit f552b492cf
4 changed files with 21 additions and 88 deletions

View File

@ -39,17 +39,17 @@ jobs:
- name: Build Firmware - name: Build Firmware
run: | run: |
pio run -e esp32dev_ota -t buildfs # Build SPIFFS pio run -e esp32dev -t buildfs # Build SPIFFS
pio run -e esp32dev_ota # Build firmware pio run -e esp32dev # Build firmware
cp .pio/build/esp32dev_ota/firmware.bin .pio/build/esp32dev_ota/filaman.bin cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman.bin
cp .pio/build/esp32dev_ota/spiffs.bin .pio/build/esp32dev_ota/filaman_spiffs.bin cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/filaman_spiffs.bin
- name: Prepare binaries - name: Prepare binaries
run: | run: |
cd .pio/build/esp32dev_ota cd .pio/build/esp32dev
# Create OTA binary (already has correct magic byte) # Create OTA binary (already has correct magic byte)
cp firmware.bin filaman_ota.bin cp firmware.bin filaman.bin
# Create a magic byte prepended binary for the bootloader # Create a magic byte prepended binary for the bootloader
echo -ne '\xE9' > bootloader_with_magic.bin echo -ne '\xE9' > bootloader_with_magic.bin
@ -61,7 +61,7 @@ jobs:
--flash_mode dio \ --flash_mode dio \
--flash_freq 40m \ --flash_freq 40m \
--flash_size 4MB \ --flash_size 4MB \
-o filaman_full.bin \ -o filaman.bin \
0x0000 bootloader_with_magic.bin \ 0x0000 bootloader_with_magic.bin \
0x8000 partitions.bin \ 0x8000 partitions.bin \
0x10000 firmware.bin \ 0x10000 firmware.bin \
@ -70,7 +70,7 @@ jobs:
# Verify magic bytes # Verify magic bytes
echo "Checking magic bytes:" echo "Checking magic bytes:"
echo "Full binary first bytes:" echo "Full binary first bytes:"
xxd -l 16 filaman_full.bin xxd -l 16 filaman.bin
# Verify file sizes # Verify file sizes
echo "File sizes:" echo "File sizes:"
@ -102,8 +102,8 @@ jobs:
echo "Release created with ID: $RELEASE_ID" echo "Release created with ID: $RELEASE_ID"
# Upload binaries # Upload binaries
cd .pio/build/esp32dev_ota cd .pio/build/esp32dev
for file in filaman_full.bin; do for file in filaman.bin; do
echo "Uploading $file..." echo "Uploading $file..."
curl -k -s \ curl -k -s \
-X POST \ -X POST \

View File

@ -28,17 +28,17 @@ jobs:
- name: Build Firmware - name: Build Firmware
run: | run: |
pio run -e esp32dev_ota -t buildfs # Build SPIFFS pio run -e esp32dev -t buildfs # Build SPIFFS
pio run -e esp32dev_ota # Build firmware pio run -e esp32dev # Build firmware
cp .pio/build/esp32dev_ota/firmware.bin .pio/build/esp32dev_ota/filaman.bin cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman.bin
cp .pio/build/esp32dev_ota/spiffs.bin .pio/build/esp32dev_ota/filaman_spiffs.bin cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/filaman_spiffs.bin
- name: Prepare binaries - name: Prepare binaries
run: | run: |
cd .pio/build/esp32dev_ota cd .pio/build/esp32dev
# Create OTA binary (already has correct magic byte) # Create OTA binary (already has correct magic byte)
cp firmware.bin filaman_ota.bin cp firmware.bin filaman.bin
# Create a magic byte prepended binary for the bootloader # Create a magic byte prepended binary for the bootloader
echo -ne '\xE9' > bootloader_with_magic.bin echo -ne '\xE9' > bootloader_with_magic.bin
@ -50,7 +50,7 @@ jobs:
--flash_mode dio \ --flash_mode dio \
--flash_freq 40m \ --flash_freq 40m \
--flash_size 4MB \ --flash_size 4MB \
-o filaman_full.bin \ -o filaman.bin \
0x0000 bootloader_with_magic.bin \ 0x0000 bootloader_with_magic.bin \
0x8000 partitions.bin \ 0x8000 partitions.bin \
0x10000 firmware.bin \ 0x10000 firmware.bin \
@ -59,7 +59,7 @@ jobs:
# Verify magic bytes # Verify magic bytes
echo "Checking magic bytes:" echo "Checking magic bytes:"
echo "Full binary first bytes:" echo "Full binary first bytes:"
xxd -l 16 filaman_full.bin xxd -l 16 filaman.bin
# Verify file sizes # Verify file sizes
echo "File sizes:" echo "File sizes:"
@ -86,4 +86,4 @@ jobs:
gh release create "${{ github.ref_name }}" \ gh release create "${{ github.ref_name }}" \
--title "Release ${{ steps.get_version.outputs.VERSION }}" \ --title "Release ${{ steps.get_version.outputs.VERSION }}" \
--notes "${{ steps.changelog.outputs.CHANGES }}" \ --notes "${{ steps.changelog.outputs.CHANGES }}" \
.pio/build/esp32dev_ota/filaman_full.bin .pio/build/esp32dev/filaman.bin

View File

@ -77,74 +77,7 @@ extra_scripts =
; Remove or comment out the targets line ; Remove or comment out the targets line
;targets = buildfs, build ;targets = buildfs, build
; Add a custom target to build both
[env:esp32dev_ota]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
tzapu/WiFiManager @ ^2.0.17
https://github.com/me-no-dev/ESPAsyncWebServer.git#master
me-no-dev/AsyncTCP @ ^1.1.1
bogde/HX711 @ ^0.7.5
adafruit/Adafruit SSD1306 @ ^2.5.13
adafruit/Adafruit GFX Library @ ^1.11.11
adafruit/Adafruit PN532 @ ^1.3.3
bblanchon/ArduinoJson @ ^7.3.0
knolleary/PubSubClient @ ^2.8
digitaldragon/SSLClient @ ^1.3.2
; Enable SPIFFS upload
board_build.filesystem = spiffs
; Update partition settings
board_build.partitions = partitions.csv
board_upload.flash_size = 4MB
board_build.flash_mode = dio
board_upload.flash_freq = "40m"
build_flags =
-Os
-ffunction-sections
-fdata-sections
-DNDEBUG
-mtext-section-literals
'-D VERSION="${common.version}"'
-DASYNCWEBSERVER_REGEX
-DCORE_DEBUG_LEVEL=1
-DCONFIG_ARDUHAL_LOG_COLORS=1
-DOTA_DEBUG=1
-DARDUINO_RUNNING_CORE=1
-DARDUINO_EVENT_RUNNING_CORE=1
-DCONFIG_OPTIMIZATION_LEVEL_DEBUG=1
-DCONFIG_ESP32_PANIC_PRINT_REBOOT
-DCONFIG_ARDUINO_OTA_READSIZE=1024
-DCONFIG_ASYNC_TCP_RUNNING_CORE=1
-DCONFIG_ASYNC_TCP_USE_WDT=0
-DCONFIG_LWIP_TCP_MSS=1460
-DOTA_PARTITION_SUBTYPE=0x10
-DPARTITION_TABLE_OFFSET=0x8000
-DPARTITION_TABLE_SIZE=0x1000
-DCONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=1
-DCONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=1
-DCONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON=1
-DCONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0x1000
-DCONFIG_PARTITION_TABLE_OFFSET=0x8000
-DCONFIG_PARTITION_TABLE_MD5=y
-DBOOT_APP_PARTITION_OTA_0=1
extra_scripts =
scripts/extra_script.py
pre:scripts/pre_build.py ; wird zuerst ausgeführt
pre:scripts/pre_spiffs.py ; wird als zweites ausgeführt
pre:scripts/combine_html.py ; wird als drittes ausgeführt
scripts/gzip_files.py
; Remove or comment out the targets line
;targets = buildfs, build
; Add a custom target to build both ; Add a custom target to build both
[platformio] [platformio]
default_envs = esp32dev, esp32dev_ota default_envs = esp32dev

View File

@ -22,7 +22,7 @@ void stopAllTasks() {
void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) { void handleOTAUpload(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
if (!index) { if (!index) {
bool isFullImage = filename.endsWith("full.bin"); bool isFullImage = true;
Serial.printf("Update Start: %s (type: %s)\n", filename.c_str(), isFullImage ? "full" : "OTA"); Serial.printf("Update Start: %s (type: %s)\n", filename.c_str(), isFullImage ? "full" : "OTA");
if (request->contentLength() == 0) { if (request->contentLength() == 0) {