27 lines
772 B
PowerShell
27 lines
772 B
PowerShell
param(
|
|
[string]$Port = "COM18",
|
|
[int]$Baud = 115200
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$bin = Join-Path $here "build\hub75_80x40.bin"
|
|
|
|
if (-not (Test-Path $bin)) {
|
|
throw "Firmware not found: $bin`nRun make in stm32f103zet6 first."
|
|
}
|
|
|
|
python -m pip show stm32loader *> $null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
python -m pip install stm32loader
|
|
}
|
|
|
|
Write-Host "Flashing $bin to $Port"
|
|
Write-Host "BOOT0 must be at 3.3V, then press RESET before this script."
|
|
python -m stm32loader -p $Port -b $Baud -e -w -v $bin -g 0x08000000
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Flash failed. Set BOOT0 to 3.3V, press RESET, and confirm $Port is the CH340."
|
|
}
|
|
|
|
Write-Host "Flash done. Move BOOT0 back to GND and press RESET."
|