<# Flash the tag firmware (UWB tag, 16MB flash, app at 0x20000, has the imu_store data partition). Reads tag/flasher_args.json for the chip, flash settings and the exact file -> offset map, auto-detects the serial port, and refuses to overwrite a partition table in a way that would lose data on the board. Examples: . lash_tag.ps1 # flash bootloader + partition table + app . lash_tag.ps1 -DryRun # show what would happen, write nothing . lash_tag.ps1 -AppOnly # write only the app, keep board data . lash_tag.ps1 -Monitor # flash, then open the serial monitor . lash_tag.ps1 -Port COM12 # force a port . lash_tag.ps1 -ManualBoot # board put into download mode by hand (BOOT+RESET) . lash_tag.ps1 -List # just list candidate serial ports #> [CmdletBinding()] param( [string]$Port, [int]$Baud = 115200, # native USB CDC: real speed is USB full-speed; changing baud is flaky on some hosts — keep 115200 [string]$Esptool, [switch]$AppOnly, [switch]$DryRun, [switch]$Monitor, [switch]$NoVerify, [switch]$Force, [switch]$ManualBoot, [switch]$List ) . (Join-Path $PSScriptRoot 'flash_common.ps1') Invoke-EspFlash -TargetDir (Join-Path $PSScriptRoot 'tag') @PSBoundParameters