Initial gwin-skill: Gowin ACG525 full toolchain skill for agents.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ProjectDir,
|
||||
[string]$FsFile = "",
|
||||
[ValidateSet(2, 4, 5, 6)]
|
||||
[int]$Operation = 2,
|
||||
[string]$GowinRoot = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (-not $GowinRoot) {
|
||||
$GowinRoot = "C:\Users\Administrator\Documents\fpga\tool-chain\Gowin\Gowin_V1.9.11.03_Education_x64"
|
||||
}
|
||||
|
||||
$ProjectDir = (Resolve-Path $ProjectDir).Path
|
||||
$cli = Join-Path $GowinRoot "Programmer\bin\programmer_cli.exe"
|
||||
if (-not (Test-Path $cli)) { throw "programmer_cli.exe not found: $cli" }
|
||||
|
||||
$env:PATH = "$(Join-Path $GowinRoot 'Programmer\bin');$env:PATH"
|
||||
|
||||
Write-Host "Scanning cables..."
|
||||
& $cli --scan
|
||||
if ($LASTEXITCODE -ne 0) { throw "scan failed; check USB cable and board power" }
|
||||
|
||||
if (-not $FsFile) {
|
||||
$fs = Get-ChildItem (Join-Path $ProjectDir "impl\pnr\*.fs") |
|
||||
Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
if (-not $fs) { throw "No .fs found; build first" }
|
||||
$FsFile = $fs.FullName
|
||||
} else {
|
||||
$FsFile = (Resolve-Path $FsFile).Path
|
||||
}
|
||||
|
||||
Write-Host "Programming GW5A-25A op=$Operation file=$FsFile"
|
||||
& $cli -d GW5A-25A --fsFile $FsFile -r $Operation
|
||||
if ($LASTEXITCODE -ne 0) { throw "program failed" }
|
||||
Write-Host "Download finished."
|
||||
Reference in New Issue
Block a user