Files
BL616-firmware/scripts/common.ps1
T
Gromov_IA 8bc1583805 Прошивка моста BL616 для Tang Primer 25K и программатор TangProgrammer
- 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.
2026-10-02 14:59:10 +03:00

43 lines
1.9 KiB
PowerShell

# Shared helpers for build/flash scripts.
# A mapped drive that points back to a share on this very PC (D: -> \\THISPC\Projects)
# makes every compiler launch go through SMB and antivirus scanning: builds
# get ~50x slower. Translate such paths to the local folder behind the share.
function Resolve-LocalPath([string]$Path) {
$full = (Resolve-Path $Path).ProviderPath
$drive = Get-PSDrive -Name $full.Substring(0, 1) -ErrorAction SilentlyContinue
if ($drive -and $drive.DisplayRoot -match '^\\\\([^\\]+)\\([^\\]+)') {
if ($Matches[1] -ieq $env:COMPUTERNAME) {
$share = Get-CimInstance Win32_Share -Filter "Name='$($Matches[2])'" -ErrorAction SilentlyContinue
if ($share) {
return Join-Path $share.Path $full.Substring(3)
}
}
}
return $full
}
function Get-ProjectRoot {
return Resolve-LocalPath (Join-Path $PSScriptRoot '..')
}
function Set-BuildEnv([string]$Root) {
$sdk = Join-Path $Root 'third_party\bouffalo_sdk'
$tc = Join-Path $Root 'third_party\toolchain_gcc_t-head_windows\bin'
if (-not (Test-Path $sdk) -or -not (Test-Path $tc)) {
throw "SDK/toolchain not found in $Root\third_party - run scripts\setup.ps1 first"
}
$env:BL_SDK_BASE = $sdk
$env:PATH = "$tc;$sdk\tools\make;$sdk\tools\ninja;$sdk\tools\cmake\bin;$env:SystemRoot\System32;$env:SystemRoot"
}
# COM port name(s) of present devices whose instance id matches the pattern
function Find-ComPort([string]$IdPattern) {
Get-CimInstance Win32_PnPEntity -Filter "PNPClass='Ports'" -ErrorAction SilentlyContinue |
Where-Object { $_.PNPDeviceID -match $IdPattern -and $_.Name -match '\((COM\d+)\)' } |
ForEach-Object { [regex]::Match($_.Name, '\((COM\d+)\)').Groups[1].Value }
}
$BootromPortId = 'VID_349B&PID_6160' # BL616 ROM USB bootloader "Bouffalo CDC DEMO"
$FirmwarePortId = 'VID_1209&PID_C0CA&MI_01' # this firmware's CDC UART