Initial public project cleanup
This commit is contained in:
commit
2034b04519
95 files changed
+16583
No files matched your search
@@ -0,0 +1,59 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$IpDir,
|
||||
|
||||
[string]$VivadoBat = "F:\ZYNQ_\Vivado\2020.2\bin\vivado.bat",
|
||||
|
||||
[int]$Revision = 1,
|
||||
|
||||
[string]$ArchiveName = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ipDirPath = [System.IO.Path]::GetFullPath($IpDir)
|
||||
$runIppack = Join-Path $ipDirPath "run_ippack.tcl"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $ipDirPath -PathType Container)) {
|
||||
throw "IP directory not found: $ipDirPath"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $runIppack -PathType Leaf)) {
|
||||
throw "run_ippack.tcl not found: $runIppack"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $VivadoBat -PathType Leaf)) {
|
||||
throw "Vivado not found: $VivadoBat"
|
||||
}
|
||||
|
||||
$text = Get-Content -LiteralPath $runIppack -Raw
|
||||
$patched = $text -replace 'set Revision\s+"[0-9]+"', "set Revision `"$Revision`""
|
||||
if ($patched -eq $text -and $text -notmatch "set Revision\s+`"$Revision`"") {
|
||||
throw "Could not patch Revision in: $runIppack"
|
||||
}
|
||||
|
||||
Set-Content -LiteralPath $runIppack -Value $patched -Encoding ASCII
|
||||
|
||||
Push-Location $ipDirPath
|
||||
try {
|
||||
& $VivadoBat -mode batch -source $runIppack
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Vivado IP packager failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$componentXml = Join-Path $ipDirPath "component.xml"
|
||||
if (-not (Test-Path -LiteralPath $componentXml -PathType Leaf)) {
|
||||
throw "IP packaging did not create component.xml"
|
||||
}
|
||||
|
||||
if ($ArchiveName -ne "") {
|
||||
$zip = Join-Path $ipDirPath $ArchiveName
|
||||
if (-not (Test-Path -LiteralPath $zip -PathType Leaf)) {
|
||||
Write-Warning "Expected IP archive was not found: $zip"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Patched and packaged HLS IP:"
|
||||
Write-Host " $componentXml"
|
||||
Reference in new issue
Block a user