param( [string]$Hex = "build\merged.hex" ) Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $RepoRoot = Split-Path -Parent $PSScriptRoot $HexPath = Join-Path $RepoRoot $Hex if (-not (Test-Path -LiteralPath $HexPath)) { throw "Hex file not found: $HexPath. Build the project first." } Write-Host "[FLASH] FULL ERASE mode" Write-Host "[FLASH] This wipes application flash, NVS/settings, and BLE bonds." Write-Host "[FLASH] Programming: $HexPath" nrfjprog --program $HexPath --chiperase --verify --reset