- src/: прошивка встроенного отладчика BL616 — составное USB-устройство 1209:C0CA: DirtyJTAG v3 (WinUSB через MS OS 2.0) + CDC-ACM UART к FPGA B3/C3; UART до 20 Мбод на DMA, JTAG до 30 МГц через аппаратный SPI; - bin/: загрузчик Sipeed (0x0) и штатная прошивка 2025030317 для отката; - gui/: TangProgrammer.exe (C# WinForms, .NET Framework 4) — загрузка FPGA в SRAM и во флеш-память, копия и стирание флеш-памяти FPGA, прошивка моста; светлая и тёмная тема; - scripts/: setup, build, flash, build_gui, make_portable, а также make_release и publish_release для релизов Gitea; - fpga_test/, tests/: тестовые проекты Gowin (loopback, stream) и тесты UART на Python; - tools/openFPGALoader/: openFPGALoader 1.1.1 для Windows x64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
81 lines
3.2 KiB
PowerShell
81 lines
3.2 KiB
PowerShell
# Make a portable copy of TangProgrammer for another PC: the program and only
|
|
# the tools it runs (no SDK, no toolchain, no sources).
|
|
#
|
|
# .\scripts\make_portable.ps1 -> dist\TangProgrammer\ and dist\TangProgrammer.zip
|
|
#
|
|
# The FPGA and FPGA-flash tabs need TangProgrammer.exe + tools\openFPGALoader.
|
|
# The bridge firmware tab also needs BLFlashCommand (for flashing over the USB
|
|
# bootloader only the exe and chips\ are used, not the 200+ MB of debug probe
|
|
# tools around it), the firmware images and the flash configs.
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path $PSScriptRoot -Parent
|
|
$dist = Join-Path $root 'dist'
|
|
$out = Join-Path $dist 'TangProgrammer'
|
|
$cube = Join-Path $root 'third_party\bouffalo_sdk\tools\bflb_tools\bouffalo_flash_cube'
|
|
$bridgeFw = Join-Path $root 'build\build_out\tang25k_debugger_bl616.bin'
|
|
|
|
if (Test-Path $out) { Remove-Item -Recurse -Force $out }
|
|
New-Item -ItemType Directory -Force (Join-Path $out 'tools') | Out-Null
|
|
|
|
& (Join-Path $PSScriptRoot 'build_gui.ps1') -Out (Join-Path $out 'TangProgrammer.exe')
|
|
Copy-Item -Recurse (Join-Path $root 'tools\openFPGALoader') (Join-Path $out 'tools\openFPGALoader')
|
|
|
|
if (Test-Path (Join-Path $cube 'BLFlashCommand.exe')) {
|
|
$dst = Join-Path $out 'tools\bouffalo_flash_cube'
|
|
New-Item -ItemType Directory -Force $dst | Out-Null
|
|
Copy-Item (Join-Path $cube 'BLFlashCommand.exe') $dst
|
|
Copy-Item -Recurse (Join-Path $cube 'chips') $dst
|
|
} else {
|
|
Write-Warning 'Bouffalo SDK is not installed (scripts\setup.ps1): the bridge firmware tab will not work in the copy'
|
|
}
|
|
|
|
$fwDir = Join-Path $out 'firmware'
|
|
New-Item -ItemType Directory -Force $fwDir | Out-Null
|
|
Copy-Item (Join-Path $root 'bin\bl616_bootloader_0x20000_nano20k_signed.bin') $fwDir
|
|
Copy-Item (Join-Path $root 'bin\bl616_fpga_partner_25kDock.bin') $fwDir
|
|
if (Test-Path $bridgeFw) {
|
|
Copy-Item $bridgeFw $fwDir
|
|
} else {
|
|
Write-Warning 'bridge firmware is not built (scripts\build.ps1): it is missing from the copy'
|
|
}
|
|
|
|
# the same configs as in the project root, pointing at firmware\
|
|
Set-Content -Encoding ASCII (Join-Path $out 'flash_prog_cfg.ini') @'
|
|
[cfg]
|
|
# 0: no erase, 1: programmed section erase, 2: chip erase
|
|
erase = 1
|
|
skip_mode = 0x0, 0x0
|
|
boot2_isp_mode = 0
|
|
|
|
# Sipeed-encrypted stage-1 loader: the eFuse secure boot only runs images
|
|
# encrypted with Sipeed's key at 0x0. It unconditionally jumps to 0x20000.
|
|
[bootloader]
|
|
filedir = ./firmware/bl616_bootloader_0x20000_nano20k_signed.bin
|
|
address = 0x0
|
|
|
|
[FW]
|
|
filedir = ./firmware/tang25k_debugger_bl616.bin
|
|
address = 0x20000
|
|
'@
|
|
Set-Content -Encoding ASCII (Join-Path $out 'restore_prog_cfg.ini') @'
|
|
[cfg]
|
|
# 0: no erase, 1: programmed section erase, 2: chip erase
|
|
erase = 1
|
|
skip_mode = 0x0, 0x0
|
|
boot2_isp_mode = 0
|
|
|
|
# Original Sipeed debugger firmware (FT2232 emulation), version 2025030317
|
|
[FW]
|
|
filedir = ./firmware/bl616_fpga_partner_25kDock.bin
|
|
address = 0x0
|
|
'@
|
|
|
|
Copy-Item (Join-Path $root 'gui\portable_readme.txt') (Join-Path $out 'README.txt')
|
|
|
|
$zip = Join-Path $dist 'TangProgrammer.zip'
|
|
if (Test-Path $zip) { Remove-Item -Force $zip }
|
|
Compress-Archive -Path $out -DestinationPath $zip
|
|
$size = (Get-ChildItem -Recurse $out | Measure-Object -Sum Length).Sum
|
|
Write-Host ("OK: {0} ({1:N1} MB), {2} ({3:N1} MB)" -f $out, ($size / 1MB), $zip, ((Get-Item $zip).Length / 1MB)) -ForegroundColor Green
|