Clean up RFP ESP32-S3 target and tooling
This commit is contained in:
44
tools/flash_rfp_s3.ps1
Normal file
44
tools/flash_rfp_s3.ps1
Normal file
@@ -0,0 +1,44 @@
|
||||
param(
|
||||
[string]$ComPort,
|
||||
|
||||
[switch]$BuildOnly
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoRoot = Split-Path -Parent $scriptDir
|
||||
$envName = "rfp_esp32s3_wroom1_n16r8_3x106"
|
||||
$venvPython = Join-Path $repoRoot ".venv\Scripts\python.exe"
|
||||
|
||||
if (-not $BuildOnly -and [string]::IsNullOrWhiteSpace($ComPort)) {
|
||||
throw "ComPort is required unless -BuildOnly is used."
|
||||
}
|
||||
|
||||
if (Test-Path $venvPython) {
|
||||
$pythonCommand = $venvPython
|
||||
$pythonArgs = @()
|
||||
} elseif (Get-Command py -ErrorAction SilentlyContinue) {
|
||||
$pythonCommand = "py"
|
||||
$pythonArgs = @("-3")
|
||||
} elseif (Get-Command python -ErrorAction SilentlyContinue) {
|
||||
$pythonCommand = "python"
|
||||
$pythonArgs = @()
|
||||
} else {
|
||||
throw "No Python runtime found. Install Python or create .venv first."
|
||||
}
|
||||
|
||||
$pioHome = Join-Path $repoRoot ".piohome"
|
||||
$env:PLATFORMIO_CORE_DIR = $pioHome
|
||||
$env:PLATFORMIO_PACKAGES_DIR = Join-Path $pioHome "packages"
|
||||
$env:PLATFORMIO_PLATFORMS_DIR = Join-Path $pioHome "platforms"
|
||||
$env:PLATFORMIO_CACHE_DIR = Join-Path $pioHome ".cache"
|
||||
$env:PLATFORMIO_BUILD_CACHE_DIR = Join-Path $pioHome "buildcache"
|
||||
|
||||
$args = @("-m", "platformio", "run", "-e", $envName)
|
||||
if (-not $BuildOnly) {
|
||||
$args += @("-t", "upload", "--upload-port", $ComPort)
|
||||
}
|
||||
|
||||
& $pythonCommand @pythonArgs @args
|
||||
exit $LASTEXITCODE
|
||||
Reference in New Issue
Block a user