Add CYD web radio: WiFi provision + HTTP MP3 to DAC26.
Supports 2.8/3.5 boards with on-screen station list; ships flashable firmware packages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
26
firmware/README.md
Normal file
26
firmware/README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# 预编译固件(可随时刷写)
|
||||
|
||||
| 目录 | 板子 |
|
||||
|------|------|
|
||||
| [`cyd/`](cyd/) | **2.8"** CYD ESP32-2432S028R(ILI9341) |
|
||||
| [`cyd_35r/`](cyd_35r/) | **3.5"** CYD ESP32-3248S035C(ST7796 + GT911) |
|
||||
|
||||
功能:**网络电台**(WiFi 配网 + HTTP MP3 → 喇叭 GPIO26)
|
||||
版本信息见各目录下 `VERSION.txt`。
|
||||
|
||||
也可在 [`../../cydweb`](../../cydweb)(CYD Flasher)里通过浏览器串口刷写本目录固件。
|
||||
|
||||
## 直接刷写(无需重新编译)
|
||||
|
||||
```powershell
|
||||
cd firmware\cyd # 3.5": firmware\cyd_35r
|
||||
.\flash.ps1
|
||||
.\flash.ps1 -Port COM3
|
||||
```
|
||||
|
||||
## 从源码重新打包
|
||||
|
||||
```powershell
|
||||
.\firmware\export_from_build.ps1
|
||||
.\firmware\export_from_build.ps1 -Env cyd_35r
|
||||
```
|
||||
15
firmware/cyd/VERSION.txt
Normal file
15
firmware/cyd/VERSION.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
name: CYD webradiotest (cyd)
|
||||
git: unknown
|
||||
date: 2026-10-28
|
||||
board: ESP32-2432S028R (ILI9341)
|
||||
flash_size: 4MB
|
||||
offsets:
|
||||
0x1000 bootloader.bin
|
||||
0x8000 partitions.bin
|
||||
0xe000 boot_app0.bin
|
||||
0x10000 firmware.bin
|
||||
sha256:
|
||||
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
|
||||
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
|
||||
firmware.bin 40C938AA38897BF31AAA472CDF3A942B6EA1D3EF3397591DC5D9DEC61B60E1E2
|
||||
partitions.bin 0A8B5720E7B77FF11F1462458C3A509DEE79224E5279898F26D6A2E3AE0517B7
|
||||
BIN
firmware/cyd/boot_app0.bin
Normal file
BIN
firmware/cyd/boot_app0.bin
Normal file
Binary file not shown.
BIN
firmware/cyd/bootloader.bin
Normal file
BIN
firmware/cyd/bootloader.bin
Normal file
Binary file not shown.
BIN
firmware/cyd/firmware.bin
Normal file
BIN
firmware/cyd/firmware.bin
Normal file
Binary file not shown.
5
firmware/cyd/flash.bat
Normal file
5
firmware/cyd/flash.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0flash.ps1" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
98
firmware/cyd/flash.ps1
Normal file
98
firmware/cyd/flash.ps1
Normal file
@@ -0,0 +1,98 @@
|
||||
# Flash archived CYD Web Radio firmware (no rebuild needed)
|
||||
# Usage:
|
||||
# .\flash.ps1
|
||||
# .\flash.ps1 -Port COM5
|
||||
# .\flash.ps1 -Port COM5 -Baud 460800
|
||||
|
||||
param(
|
||||
[string]$Port = "",
|
||||
[int]$Baud = 921600
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
Set-Location $here
|
||||
|
||||
function Find-Esptool {
|
||||
$pio = Get-Command pio -ErrorAction SilentlyContinue
|
||||
if (-not $pio) {
|
||||
$pioPath = Join-Path $env:USERPROFILE "AppData\Local\Programs\Python\Python312\Scripts\pio.exe"
|
||||
if (Test-Path $pioPath) {
|
||||
$env:Path = "$(Split-Path $pioPath);$env:Path"
|
||||
$pio = Get-Command pio -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
if ($pio) {
|
||||
$pkg = Join-Path $env:USERPROFILE ".platformio\packages\tool-esptoolpy\esptool.py"
|
||||
if (Test-Path $pkg) { return @{ Kind = "py"; Path = $pkg } }
|
||||
}
|
||||
$py = Get-Command python -ErrorAction SilentlyContinue
|
||||
if ($py) {
|
||||
try {
|
||||
& python -c "import esptool" 2>$null
|
||||
if ($LASTEXITCODE -eq 0) { return @{ Kind = "mod"; Path = "esptool" } }
|
||||
} catch {}
|
||||
}
|
||||
$esp = Get-Command esptool.py -ErrorAction SilentlyContinue
|
||||
if ($esp) { return @{ Kind = "py"; Path = $esp.Source } }
|
||||
return $null
|
||||
}
|
||||
|
||||
if (-not $Port) {
|
||||
$ports = @()
|
||||
try {
|
||||
Add-Type -AssemblyName System.IO.Ports -ErrorAction SilentlyContinue | Out-Null
|
||||
$ports = [System.IO.Ports.SerialPort]::GetPortNames() | Sort-Object
|
||||
} catch {}
|
||||
if (-not $ports -or $ports.Count -eq 0) {
|
||||
$ports = Get-CimInstance Win32_SerialPort -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty DeviceID | Sort-Object
|
||||
}
|
||||
if (-not $ports -or $ports.Count -eq 0) {
|
||||
Write-Error "No serial ports found. Plug in the CYD USB cable, then retry with -Port COMx"
|
||||
}
|
||||
if ($ports.Count -eq 1) {
|
||||
$Port = $ports[0]
|
||||
} else {
|
||||
Write-Host "Available ports: $($ports -join ', ')"
|
||||
$Port = $ports[-1]
|
||||
Write-Host "Using last port: $Port (override with -Port)"
|
||||
}
|
||||
}
|
||||
|
||||
$tool = Find-Esptool
|
||||
if (-not $tool) {
|
||||
Write-Error "esptool not found. Install PlatformIO (`pio`) or: pip install esptool"
|
||||
}
|
||||
|
||||
$needed = @("bootloader.bin", "partitions.bin", "boot_app0.bin", "firmware.bin")
|
||||
foreach ($f in $needed) {
|
||||
if (-not (Test-Path (Join-Path $here $f))) {
|
||||
Write-Error "Missing $f — run ..\export_from_build.ps1 from repo root first"
|
||||
}
|
||||
}
|
||||
|
||||
$argsCommon = @(
|
||||
"--chip", "esp32",
|
||||
"--port", $Port,
|
||||
"--baud", "$Baud",
|
||||
"--before", "default_reset",
|
||||
"--after", "hard_reset",
|
||||
"write_flash", "-z",
|
||||
"--flash_mode", "dio",
|
||||
"--flash_freq", "40m",
|
||||
"--flash_size", "4MB",
|
||||
"0x1000", "bootloader.bin",
|
||||
"0x8000", "partitions.bin",
|
||||
"0xe000", "boot_app0.bin",
|
||||
"0x10000", "firmware.bin"
|
||||
)
|
||||
|
||||
Write-Host "Flashing $here -> $Port @ $Baud"
|
||||
if ($tool.Kind -eq "mod") {
|
||||
& python -m esptool @argsCommon
|
||||
} else {
|
||||
& python $tool.Path @argsCommon
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
Write-Host "Done. Open serial monitor at 460800 if needed."
|
||||
50
firmware/cyd/media/preview.html
Normal file
50
firmware/cyd/media/preview.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Web Radio</title>
|
||||
<style>
|
||||
*{box-sizing:border-box;margin:0;padding:0}
|
||||
html,body{width:320px;height:240px;overflow:hidden;background:#000;margin:0}
|
||||
.bezel{width:320px;height:240px;background:#1a1408}
|
||||
.screen{width:320px;height:240px;background:#0A1016;color:#EAF0F6;font:12px/1.2 system-ui,sans-serif;position:relative;overflow:hidden}
|
||||
.muted{color:#7A8B9C}.ok{color:#3DDC97}.acc{color:#4FC3F7}
|
||||
.btn{border:0;border-radius:8px;background:#243140;color:#EAF0F6;font-weight:600;height:38px}
|
||||
.btn.acc{background:#1A4A6E}.btn.warn{background:#6B3A1E}
|
||||
.title{position:absolute;left:10px;top:6px;font-size:16px;font-weight:700;color:#4FC3F7}
|
||||
.wifi{position:absolute;right:10px;top:8px;font-size:11px;color:#7A8B9C}
|
||||
.st{position:absolute;left:10px;right:10px;top:30px;font-size:14px;white-space:nowrap;overflow:hidden}
|
||||
.stat{position:absolute;left:10px;top:52px;font-size:12px;color:#3DDC97}
|
||||
.vol{position:absolute;right:10px;top:52px;font-size:12px;color:#7A8B9C}
|
||||
.bar{position:absolute;left:8px;right:8px;top:72px;display:flex;gap:6px;justify-content:space-between}
|
||||
.bar .btn{flex:1;font-size:11px}
|
||||
.list{position:absolute;left:8px;right:8px;top:118px;bottom:42px;background:#1C2A38;border-radius:8px;padding:4px;overflow:hidden}
|
||||
.row{height:28px;margin-bottom:4px;border-radius:6px;background:#1A4A6E;display:flex;align-items:center;padding:0 8px;font-size:12px}
|
||||
.row.dim{background:#243140}
|
||||
.foot{position:absolute;left:8px;bottom:6px}
|
||||
.foot .btn{width:120px;height:34px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="bezel"><div class="screen">
|
||||
<div class="title">Web Radio</div>
|
||||
<div class="wifi">HomeWiFi -52dBm</div>
|
||||
<div class="st">SomaFM Groove Salad</div>
|
||||
<div class="stat">Playing</div>
|
||||
<div class="vol">Vol 60%</div>
|
||||
<div class="bar">
|
||||
<button class="btn" type="button">Prev</button>
|
||||
<button class="btn acc" type="button">Stop</button>
|
||||
<button class="btn" type="button">Next</button>
|
||||
<button class="btn" type="button">Vol-</button>
|
||||
<button class="btn" type="button">Vol+</button>
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="row">SomaFM Groove Salad</div>
|
||||
<div class="row dim">SomaFM Drone Zone</div>
|
||||
<div class="row dim">SomaFM Indie Pop</div>
|
||||
</div>
|
||||
<div class="foot"><button class="btn warn" type="button">WiFi Setup</button></div>
|
||||
</div></div>
|
||||
</body>
|
||||
</html>
|
||||
16
firmware/cyd/meta.json
Normal file
16
firmware/cyd/meta.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"boardId": "esp32-2432s028",
|
||||
"name": "CYD Web Radio",
|
||||
"summary": "Internet MP3 radio with on-screen WiFi setup; speaker on GPIO26",
|
||||
"description": "LVGL WiFi provisioning then station list. Streams HTTP MP3 via ESP8266Audio to internal DAC2 (GPIO26 only — never GPIO25). Credentials in NVS.",
|
||||
"tags": [
|
||||
"wifi",
|
||||
"radio",
|
||||
"audio",
|
||||
"mp3",
|
||||
"touch"
|
||||
],
|
||||
"media": {
|
||||
"preview": "media/preview.html"
|
||||
}
|
||||
}
|
||||
BIN
firmware/cyd/partitions.bin
Normal file
BIN
firmware/cyd/partitions.bin
Normal file
Binary file not shown.
15
firmware/cyd_35r/VERSION.txt
Normal file
15
firmware/cyd_35r/VERSION.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
name: CYD webradiotest (cyd_35r)
|
||||
git: unknown
|
||||
date: 2026-10-28
|
||||
board: ESP32-3248S035 (ST7796)
|
||||
flash_size: 4MB
|
||||
offsets:
|
||||
0x1000 bootloader.bin
|
||||
0x8000 partitions.bin
|
||||
0xe000 boot_app0.bin
|
||||
0x10000 firmware.bin
|
||||
sha256:
|
||||
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
|
||||
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
|
||||
firmware.bin EE0B24F2E40451F72F48DF25803DF571FC406C80004641E93CCBABF0B15B175F
|
||||
partitions.bin 0A8B5720E7B77FF11F1462458C3A509DEE79224E5279898F26D6A2E3AE0517B7
|
||||
BIN
firmware/cyd_35r/boot_app0.bin
Normal file
BIN
firmware/cyd_35r/boot_app0.bin
Normal file
Binary file not shown.
BIN
firmware/cyd_35r/bootloader.bin
Normal file
BIN
firmware/cyd_35r/bootloader.bin
Normal file
Binary file not shown.
BIN
firmware/cyd_35r/firmware.bin
Normal file
BIN
firmware/cyd_35r/firmware.bin
Normal file
Binary file not shown.
5
firmware/cyd_35r/flash.bat
Normal file
5
firmware/cyd_35r/flash.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0flash.ps1" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
98
firmware/cyd_35r/flash.ps1
Normal file
98
firmware/cyd_35r/flash.ps1
Normal file
@@ -0,0 +1,98 @@
|
||||
# Flash archived CYD WiFi Prov firmware (no rebuild needed)
|
||||
# Usage:
|
||||
# .\flash.ps1
|
||||
# .\flash.ps1 -Port COM5
|
||||
# .\flash.ps1 -Port COM5 -Baud 460800
|
||||
|
||||
param(
|
||||
[string]$Port = "",
|
||||
[int]$Baud = 921600
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
Set-Location $here
|
||||
|
||||
function Find-Esptool {
|
||||
$pio = Get-Command pio -ErrorAction SilentlyContinue
|
||||
if (-not $pio) {
|
||||
$pioPath = Join-Path $env:USERPROFILE "AppData\Local\Programs\Python\Python312\Scripts\pio.exe"
|
||||
if (Test-Path $pioPath) {
|
||||
$env:Path = "$(Split-Path $pioPath);$env:Path"
|
||||
$pio = Get-Command pio -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
if ($pio) {
|
||||
$pkg = Join-Path $env:USERPROFILE ".platformio\packages\tool-esptoolpy\esptool.py"
|
||||
if (Test-Path $pkg) { return @{ Kind = "py"; Path = $pkg } }
|
||||
}
|
||||
$py = Get-Command python -ErrorAction SilentlyContinue
|
||||
if ($py) {
|
||||
try {
|
||||
& python -c "import esptool" 2>$null
|
||||
if ($LASTEXITCODE -eq 0) { return @{ Kind = "mod"; Path = "esptool" } }
|
||||
} catch {}
|
||||
}
|
||||
$esp = Get-Command esptool.py -ErrorAction SilentlyContinue
|
||||
if ($esp) { return @{ Kind = "py"; Path = $esp.Source } }
|
||||
return $null
|
||||
}
|
||||
|
||||
if (-not $Port) {
|
||||
$ports = @()
|
||||
try {
|
||||
Add-Type -AssemblyName System.IO.Ports -ErrorAction SilentlyContinue | Out-Null
|
||||
$ports = [System.IO.Ports.SerialPort]::GetPortNames() | Sort-Object
|
||||
} catch {}
|
||||
if (-not $ports -or $ports.Count -eq 0) {
|
||||
$ports = Get-CimInstance Win32_SerialPort -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty DeviceID | Sort-Object
|
||||
}
|
||||
if (-not $ports -or $ports.Count -eq 0) {
|
||||
Write-Error "No serial ports found. Plug in the CYD USB cable, then retry with -Port COMx"
|
||||
}
|
||||
if ($ports.Count -eq 1) {
|
||||
$Port = $ports[0]
|
||||
} else {
|
||||
Write-Host "Available ports: $($ports -join ', ')"
|
||||
$Port = $ports[-1]
|
||||
Write-Host "Using last port: $Port (override with -Port)"
|
||||
}
|
||||
}
|
||||
|
||||
$tool = Find-Esptool
|
||||
if (-not $tool) {
|
||||
Write-Error "esptool not found. Install PlatformIO (`pio`) or: pip install esptool"
|
||||
}
|
||||
|
||||
$needed = @("bootloader.bin", "partitions.bin", "boot_app0.bin", "firmware.bin")
|
||||
foreach ($f in $needed) {
|
||||
if (-not (Test-Path (Join-Path $here $f))) {
|
||||
Write-Error "Missing $f — run ..\export_from_build.ps1 from repo root first"
|
||||
}
|
||||
}
|
||||
|
||||
$argsCommon = @(
|
||||
"--chip", "esp32",
|
||||
"--port", $Port,
|
||||
"--baud", "$Baud",
|
||||
"--before", "default_reset",
|
||||
"--after", "hard_reset",
|
||||
"write_flash", "-z",
|
||||
"--flash_mode", "dio",
|
||||
"--flash_freq", "40m",
|
||||
"--flash_size", "4MB",
|
||||
"0x1000", "bootloader.bin",
|
||||
"0x8000", "partitions.bin",
|
||||
"0xe000", "boot_app0.bin",
|
||||
"0x10000", "firmware.bin"
|
||||
)
|
||||
|
||||
Write-Host "Flashing $here -> $Port @ $Baud"
|
||||
if ($tool.Kind -eq "mod") {
|
||||
& python -m esptool @argsCommon
|
||||
} else {
|
||||
& python $tool.Path @argsCommon
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
Write-Host "Done. Open serial monitor at 460800 if needed."
|
||||
50
firmware/cyd_35r/media/preview.html
Normal file
50
firmware/cyd_35r/media/preview.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Web Radio</title>
|
||||
<style>
|
||||
*{box-sizing:border-box;margin:0;padding:0}
|
||||
html,body{width:320px;height:240px;overflow:hidden;background:#000;margin:0}
|
||||
.bezel{width:320px;height:240px;background:#1a1408}
|
||||
.screen{width:320px;height:240px;background:#0A1016;color:#EAF0F6;font:12px/1.2 system-ui,sans-serif;position:relative;overflow:hidden}
|
||||
.muted{color:#7A8B9C}.ok{color:#3DDC97}.acc{color:#4FC3F7}
|
||||
.btn{border:0;border-radius:8px;background:#243140;color:#EAF0F6;font-weight:600;height:38px}
|
||||
.btn.acc{background:#1A4A6E}.btn.warn{background:#6B3A1E}
|
||||
.title{position:absolute;left:10px;top:6px;font-size:16px;font-weight:700;color:#4FC3F7}
|
||||
.wifi{position:absolute;right:10px;top:8px;font-size:11px;color:#7A8B9C}
|
||||
.st{position:absolute;left:10px;right:10px;top:30px;font-size:14px;white-space:nowrap;overflow:hidden}
|
||||
.stat{position:absolute;left:10px;top:52px;font-size:12px;color:#3DDC97}
|
||||
.vol{position:absolute;right:10px;top:52px;font-size:12px;color:#7A8B9C}
|
||||
.bar{position:absolute;left:8px;right:8px;top:72px;display:flex;gap:6px;justify-content:space-between}
|
||||
.bar .btn{flex:1;font-size:11px}
|
||||
.list{position:absolute;left:8px;right:8px;top:118px;bottom:42px;background:#1C2A38;border-radius:8px;padding:4px;overflow:hidden}
|
||||
.row{height:28px;margin-bottom:4px;border-radius:6px;background:#1A4A6E;display:flex;align-items:center;padding:0 8px;font-size:12px}
|
||||
.row.dim{background:#243140}
|
||||
.foot{position:absolute;left:8px;bottom:6px}
|
||||
.foot .btn{width:120px;height:34px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="bezel"><div class="screen">
|
||||
<div class="title">Web Radio</div>
|
||||
<div class="wifi">HomeWiFi -52dBm</div>
|
||||
<div class="st">SomaFM Groove Salad</div>
|
||||
<div class="stat">Playing</div>
|
||||
<div class="vol">Vol 60%</div>
|
||||
<div class="bar">
|
||||
<button class="btn" type="button">Prev</button>
|
||||
<button class="btn acc" type="button">Stop</button>
|
||||
<button class="btn" type="button">Next</button>
|
||||
<button class="btn" type="button">Vol-</button>
|
||||
<button class="btn" type="button">Vol+</button>
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="row">SomaFM Groove Salad</div>
|
||||
<div class="row dim">SomaFM Drone Zone</div>
|
||||
<div class="row dim">SomaFM Indie Pop</div>
|
||||
</div>
|
||||
<div class="foot"><button class="btn warn" type="button">WiFi Setup</button></div>
|
||||
</div></div>
|
||||
</body>
|
||||
</html>
|
||||
17
firmware/cyd_35r/meta.json
Normal file
17
firmware/cyd_35r/meta.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"boardId": "esp32-3248s035",
|
||||
"name": "CYD Web Radio (3.5\")",
|
||||
"summary": "Internet MP3 radio with on-screen WiFi setup; speaker on GPIO26",
|
||||
"description": "LVGL WiFi provisioning then station list on 480x320. Streams HTTP MP3 via ESP8266Audio to internal DAC2 (GPIO26 only). ST7796 + GT911; backlight GPIO27.",
|
||||
"tags": [
|
||||
"wifi",
|
||||
"radio",
|
||||
"audio",
|
||||
"mp3",
|
||||
"touch",
|
||||
"cyd35"
|
||||
],
|
||||
"media": {
|
||||
"preview": "media/preview.html"
|
||||
}
|
||||
}
|
||||
BIN
firmware/cyd_35r/partitions.bin
Normal file
BIN
firmware/cyd_35r/partitions.bin
Normal file
Binary file not shown.
71
firmware/export_from_build.ps1
Normal file
71
firmware/export_from_build.ps1
Normal file
@@ -0,0 +1,71 @@
|
||||
# Export firmware bins from PlatformIO build.
|
||||
# Default: 2.8" (cyd -> firmware/cyd)
|
||||
# 3.5": .\firmware\export_from_build.ps1 -Env cyd_35r
|
||||
# (only after: pio run -e cyd_35r)
|
||||
|
||||
param(
|
||||
[switch]$SkipBuild,
|
||||
[ValidateSet("cyd", "cyd_35r")]
|
||||
[string]$Env = "cyd"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
Set-Location $root
|
||||
|
||||
$env:Path = "C:\Users\dsx2016\AppData\Local\Programs\Python\Python312\Scripts;" + $env:Path
|
||||
|
||||
if (-not $SkipBuild) {
|
||||
pio run -e $Env
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
$src = Join-Path $root (".pio\build\" + $Env)
|
||||
if ($Env -eq "cyd_35r") {
|
||||
$dstName = "cyd_35r"
|
||||
$boardLine = "board: ESP32-3248S035 (ST7796)"
|
||||
$boardIdHint = "esp32-3248s035"
|
||||
} else {
|
||||
$dstName = "cyd"
|
||||
$boardLine = "board: ESP32-2432S028R (ILI9341)"
|
||||
$boardIdHint = "esp32-2432s028"
|
||||
}
|
||||
$dst = Join-Path $root ("firmware\" + $dstName)
|
||||
New-Item -ItemType Directory -Force -Path $dst | Out-Null
|
||||
|
||||
foreach ($f in @("bootloader.bin", "partitions.bin", "firmware.bin")) {
|
||||
$p = Join-Path $src $f
|
||||
if (-not (Test-Path $p)) { Write-Error "Missing build artifact: $p — build with: pio run -e $Env" }
|
||||
Copy-Item $p $dst -Force
|
||||
}
|
||||
|
||||
$bootApp = Join-Path $env:USERPROFILE ".platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin"
|
||||
if (-not (Test-Path $bootApp)) {
|
||||
Write-Error "boot_app0.bin not found under PlatformIO packages"
|
||||
}
|
||||
Copy-Item $bootApp (Join-Path $dst "boot_app0.bin") -Force
|
||||
|
||||
$git = ""
|
||||
try { $git = (git -C $root rev-parse --short HEAD).Trim() } catch { $git = "unknown" }
|
||||
$date = Get-Date -Format "yyyy-MM-dd"
|
||||
$hashes = Get-ChildItem (Join-Path $dst "*.bin") | Get-FileHash -Algorithm SHA256
|
||||
$lines = @(
|
||||
"name: CYD webradiotest ($dstName)",
|
||||
"git: $git",
|
||||
"date: $date",
|
||||
$boardLine,
|
||||
"flash_size: 4MB",
|
||||
"offsets:",
|
||||
" 0x1000 bootloader.bin",
|
||||
" 0x8000 partitions.bin",
|
||||
" 0xe000 boot_app0.bin",
|
||||
" 0x10000 firmware.bin",
|
||||
"sha256:"
|
||||
)
|
||||
foreach ($h in $hashes) {
|
||||
$lines += (" {0,-15} {1}" -f (Split-Path $h.Path -Leaf), $h.Hash)
|
||||
}
|
||||
$lines | Set-Content -Encoding utf8 (Join-Path $dst "VERSION.txt")
|
||||
|
||||
|
||||
Write-Host "Exported -> $dst (env=$Env git=$git)"
|
||||
Reference in New Issue
Block a user