VersaMCU/platformio.ini
Julian Appel d325297063 Add end-to-end USB flashing for the app firmware via UF2
Adds uf2conv.py (minimal, dependency-free .bin -> .uf2 converter
matching bootloader/inc/uf2format.h's block layout) and upload_uf2.py,
a PlatformIO upload hook for env:versapad_usb that finds the mounted
VERSABOOT volume and copies the converted firmware onto it.

env:versapad_usb previously used upload_protocol=sam-ba, the classic
Arduino/Atmel protocol -- the actual bootloader speaks UF2/mass
storage, not SAM-BA, so that upload path never worked. Switched to
upload_protocol=custom with the new hook, and cleaned the now-unused
SAM-BA-specific fields out of boards/versapad.json.

Verified end to end on real hardware: pio run -e versapad_usb
--target upload builds, converts, copies to the VERSABOOT drive, and
the bootloader jumps into the freshly written app on its own.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 21:35:19 +02:00

32 lines
1.2 KiB
INI
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; VersaPad v2 PlatformIO Configuration
; Custom SAMD21G17D board (custom PCB)
; Programmer: Atmel-ICE via SWD (kein Bootloader nötig)
[common]
platform = atmelsam
framework = arduino
board_build.variants_dir = ${PROJECT_DIR}/variants
lib_deps = adafruit/Adafruit NeoPixel
build_flags =
-DUSB_PRODUCT='"VersaPad v2"'
-DUSB_MANUFACTURER='"Custom"'
-DUSB_VID=0x239A
-DUSB_PID=0x0042
-DCRYSTALLESS
; ── Atmel-ICE via SWD (Hauptkonfiguration) ────────────────────────────────────
[env:versapad]
extends = common
board = versapad_nobl
upload_protocol = custom
extra_scripts = upload_openocd.py
debug_tool = openocd
; ── USB UF2 (nur wenn bootloader/ geflasht ist) ────────────────────────────────
; Der eigene Bootloader spricht UF2/Massenspeicher, kein SAM-BA. upload_uf2.py
; erzeugt aus firmware.bin ein .uf2 und kopiert es aufs VERSABOOT-Laufwerk.
[env:versapad_usb]
extends = common
board = versapad
upload_protocol = custom
extra_scripts = upload_uf2.py