Skip to content

Use tinyuf2 combined.bin as image base #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 21, 2025
Merged
49 changes: 38 additions & 11 deletions .github/workflows/build-clang-doxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
with:
repository: adafruit/Wippersnapper_Boards
path: ws-boards
ref: migrate-4mb-to-esptool
- name: Install CI-Arduino
run: bash ci/actions_install.sh
- name: Install extra Arduino libraries
Expand Down Expand Up @@ -141,6 +142,38 @@ jobs:
echo $content
echo EOF
} >> "$GITHUB_OUTPUT"
- name: fetch tinyuf2 combined.bin
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/adafruit/tinyuf2/releases/latest | \
jq -r '.assets[] | select(.browser_download_url | contains("tinyuf2-'${{fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}}'-") and endswith(".zip")) | .browser_download_url')
if [ -z "$DOWNLOAD_URL" ]; then
echo "Error: Could not find the latest tinyuf2 release for board ${fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}."
exit 1
fi
wget "$DOWNLOAD_URL" -O tinyuf2.zip
unzip -o tinyuf2.zip -d .

- name: move partition and bootloader files for tinyuf2 (to match flash_args)
run: |
# Copy files where they're expected to make flash_args happy
mkdir bootloader
cp bootloader.bin bootloader/bootloader.bin
mkdir partition_table
cp partition-table.bin partition_table/partition-table.bin

- name: Create new_flash_args file from flash_args with added app bin + output file
run: |
# Create new_flash_args with esptool parameters first and output file
echo "--flash-mode ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashMode}}" > new_flash_args
echo "--flash-freq ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashFreq}}" >> new_flash_args
echo "--flash-size ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashSize}}" >> new_flash_args
echo "-o wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.combined.bin" >> new_flash_args

# Append flash_args content to new_flash_args, skipping the first line
tail -n +2 flash_args >> new_flash_args

# Append main app to flash_args file
echo "0x10000 wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.bin" >> new_flash_args
- name: Check boot_app0 file existence (esp32sx built from core, not-source)
id: check_files
uses: andstor/file-existence-action@v3
Expand All @@ -156,23 +189,17 @@ jobs:
ls /home/runner/Arduino/hardware/espressif/esp32/tools/partitions
- name: boot_app0 file from arduino-cli core
if: steps.check_files.outputs.files_exists == 'true'
run: mv /home/runner/.arduino15/packages/esp32/hardware/esp32/*/tools/partitions/boot_app0.bin wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.boot_app0.bin
run: cp /home/runner/.arduino15/packages/esp32/hardware/esp32/*/tools/partitions/boot_app0.bin wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.boot_app0.bin
- name: boot_app0 file from esp32 source bsp
if: steps.check_files.outputs.files_exists == 'false'
run: mv /home/runner/Arduino/hardware/espressif/esp32/tools/partitions/boot_app0.bin wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.boot_app0.bin
run: cp /home/runner/Arduino/hardware/espressif/esp32/tools/partitions/boot_app0.bin wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.boot_app0.bin
- name: Copy boot_app0 file to ota_data_initial.bin (overwrite tinyuf2 boot preference)
run: cp wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.boot_app0.bin ota_data_initial.bin
- name: Create combined binary using Esptool merge-bin
run: |
echo ${{ steps.get_board_json.outputs.boardJson }}
echo ${{ fromJson(steps.get_board_json.outputs.boardJson) }}
python3 -m esptool --chip ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.chip}} merge-bin \
--flash-mode ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashMode}} \
--flash-freq ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashFreq}} \
--flash-size ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.flashSize}} \
-o wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.combined.bin \
${{ matrix.offset }} wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.bootloader.bin \
0x8000 wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.partitions.bin \
0xe000 wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.boot_app0.bin \
0x10000 wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.bin
python3 -m esptool --chip ${{fromJson(steps.get_board_json.outputs.boardJson).esptool.chip}} merge-bin @new_flash_args
- name: Zip build artifacts
run: |
zip -r wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.zip wippersnapper.${{ matrix.arduino-platform }}.fatfs.${{ env.WS_VERSION }}.*
Expand Down
Loading