forked from gronod/squeezelite-esp32
77 lines
2.4 KiB
PowerShell
77 lines
2.4 KiB
PowerShell
# Build script for Guition JC4827W543C board - PowerShell version
|
|
# Usage: .\build-guition.ps1 [-Clean]
|
|
|
|
param(
|
|
[switch]$Clean
|
|
)
|
|
|
|
Write-Host "Building Squeezelite-ESP32 for Guition JC4827W543C" -ForegroundColor Green
|
|
|
|
# Check if ESP-IDF environment is set up
|
|
if (-not $env:IDF_PATH) {
|
|
Write-Host "Error: ESP-IDF environment not found!" -ForegroundColor Red
|
|
Write-Host "Please run esp-idf/export.bat first" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
|
|
# Set target to ESP32-S3
|
|
$env:IDF_TARGET = "esp32s3"
|
|
Write-Host "Target set to: $env:IDF_TARGET" -ForegroundColor Cyan
|
|
|
|
# Copy Guition-specific configuration
|
|
if (Test-Path "squeezelite-esp32-Guition-sdkconfig.defaults") {
|
|
Write-Host "Using Guition configuration..." -ForegroundColor Cyan
|
|
Copy-Item "squeezelite-esp32-Guition-sdkconfig.defaults" "sdkconfig.defaults" -Force
|
|
} else {
|
|
Write-Host "Warning: Guition configuration file not found" -ForegroundColor Yellow
|
|
}
|
|
|
|
# Clean if requested
|
|
if ($Clean) {
|
|
Write-Host "Cleaning build..." -ForegroundColor Cyan
|
|
idf.py fullclean
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Clean failed!" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# Configure the project
|
|
Write-Host "Configuring project..." -ForegroundColor Cyan
|
|
Write-Host "Running: idf.py menuconfig" -ForegroundColor White
|
|
Write-Host "Select: Squeezelite-ESP32 -> Guition JC4827W543C" -ForegroundColor Yellow
|
|
Write-Host "Press Enter to continue to menuconfig..." -ForegroundColor White
|
|
Read-Host
|
|
|
|
idf.py menuconfig
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Configuration failed!" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
# Build the project
|
|
Write-Host "Building firmware..." -ForegroundColor Cyan
|
|
idf.py build
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Build failed!" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Build complete!" -ForegroundColor Green
|
|
Write-Host "Firmware location: build\squeezelite.bin" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "To flash the firmware:" -ForegroundColor White
|
|
Write-Host "idf.py -p <PORT> flash" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "To monitor output:" -ForegroundColor White
|
|
Write-Host "idf.py -p <PORT> monitor" -ForegroundColor Yellow
|
|
|
|
# Ask if user wants to flash
|
|
Write-Host ""
|
|
$flash = Read-Host "Do you want to flash the firmware now? (y/n)"
|
|
if ($flash -eq 'y' -or $flash -eq 'Y') {
|
|
$port = Read-Host "Enter COM port (e.g., COM3)"
|
|
Write-Host "Flashing to $port..." -ForegroundColor Cyan
|
|
idf.py -p $port flash monitor
|
|
}
|