HMBFDGMA-2 Allow generic build process to use different file names and remove unused scripts - also make unencrypted build an option
This commit is contained in:
parent
1b790dfbe6
commit
a6e6b0e52f
6 changed files with 39 additions and 241 deletions
|
|
@ -31,8 +31,8 @@ ip-generate \
|
|||
--search-path="$SEARCH_PATH" \
|
||||
--project-directory="$PROJECT_DIR" \
|
||||
--output-directory="$QSYS_OUTPUT_DIR" \
|
||||
--report-file="bsf:$QSYS_OUTPUT_DIR/${TOP}.bsf" \
|
||||
--component-file="$PROJECT_DIR/${TOP}_system.qsys" \
|
||||
--report-file="bsf:$QSYS_OUTPUT_DIR/top.bsf" \
|
||||
--component-file="$PROJECT_DIR/${QSYS_TOP}.qsys" \
|
||||
--remove-qsys-generate-warning 2>&1 | tee "$WORKSPACE/output.txt"
|
||||
|
||||
# Get the return status of the first command in the pipe
|
||||
|
|
@ -42,16 +42,16 @@ ip-generate \
|
|||
--search-path="$SEARCH_PATH" \
|
||||
--project-directory="$PROJECT_DIR" \
|
||||
--output-directory="$SYNTHESIS_OUTPUT_DIR" \
|
||||
--report-file="html:$QSYS_OUTPUT_DIR/${TOP}.html" \
|
||||
--report-file="html:$QSYS_OUTPUT_DIR/${QPF_TOP}.html" \
|
||||
--file-set=QUARTUS_SYNTH \
|
||||
--report-file="sopcinfo:$PROJECT_DIR/${TOP}.sopcinfo" \
|
||||
--report-file="cmp:$QSYS_OUTPUT_DIR/${TOP}.cmp" \
|
||||
--report-file="qip:$SYNTHESIS_OUTPUT_DIR/${TOP}_system.qip" \
|
||||
--report-file="svd:$SYNTHESIS_OUTPUT_DIR/${TOP}.svd" \
|
||||
--report-file="regmap:$SYNTHESIS_OUTPUT_DIR/${TOP}.regmap" \
|
||||
--report-file="xml:$QSYS_OUTPUT_DIR/${TOP}.xml" \
|
||||
--report-file="debuginfo:$SYNTHESIS_OUTPUT_DIR/${TOP}.debuginfo" \
|
||||
--component-file="$PROJECT_DIR/${TOP}_system.qsys" \
|
||||
--report-file="sopcinfo:$PROJECT_DIR/${QPF_TOP}.sopcinfo" \
|
||||
--report-file="cmp:$QSYS_OUTPUT_DIR/${QPF_TOP}.cmp" \
|
||||
--report-file="qip:$SYNTHESIS_OUTPUT_DIR/${QPF_TOP}.qip" \
|
||||
--report-file="svd:$SYNTHESIS_OUTPUT_DIR/${QPF_TOP}.svd" \
|
||||
--report-file="regmap:$SYNTHESIS_OUTPUT_DIR/${QPF_TOP}.regmap" \
|
||||
--report-file="xml:$QSYS_OUTPUT_DIR/${QPF_TOP}.xml" \
|
||||
--report-file="debuginfo:$SYNTHESIS_OUTPUT_DIR/${QPF_TOP}.debuginfo" \
|
||||
--component-file="$PROJECT_DIR/${QSYS_TOP}.qsys" \
|
||||
--remove-qsys-generate-warning \
|
||||
--language=VHDL 2>&1 | tee -a "$WORKSPACE/output.txt"
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 1; fi
|
|||
# Compile
|
||||
pushd "$PROJECT_DIR"
|
||||
|
||||
quartus_sh --flow compile ${TOP} 2>&1 | tee -a "$WORKSPACE/output.txt"
|
||||
quartus_sh --flow compile ${QPF_TOP} 2>&1 | tee -a "$WORKSPACE/output.txt"
|
||||
# Get the return status of the first command in the pipe
|
||||
if [ ${PIPESTATUS[0]} -ne 0 ]; then
|
||||
popd
|
||||
|
|
@ -82,7 +82,7 @@ if [ $? -ne 0 ]; then exit 1; fi
|
|||
HPS0="hps_0"
|
||||
|
||||
# Generate the HPS header file
|
||||
$ALTERA_ROOT/quartus/sopc_builder/bin/sopc-create-header-files "$PROJECT_DIR/$TOP.sopcinfo" --single "$HPS0.h" --module "$HPS0"
|
||||
$ALTERA_ROOT/quartus/sopc_builder/bin/sopc-create-header-files "$PROJECT_DIR/${QPF_TOP}.sopcinfo" --single "$HPS0.h" --module "$HPS0"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
#################################
|
||||
|
|
@ -99,19 +99,21 @@ else
|
|||
CPFPROG="$ALTERA_ROOT/quartus/bin64/quartus_cpf.exe"
|
||||
fi
|
||||
|
||||
# ---- Generate rbf image ----
|
||||
# Use the quartus cof file (created from quartus conversion utility) to generate the rbf file
|
||||
"$CPFPROG" -c ${TOP}.cof
|
||||
if [ $? -ne 0 ]; then popd; exit 1; fi
|
||||
if [ $CREATE_UNENCRYPTED_RBF = "True" ]; then
|
||||
# ---- Generate rbf image ----
|
||||
# Use the quartus cof file (created from quartus conversion utility) to generate the rbf file
|
||||
"$CPFPROG" -c ${QPF_TOP}.cof
|
||||
if [ $? -ne 0 ]; then popd; exit 1; fi
|
||||
fi
|
||||
|
||||
# Use the quartus cof file (created from quartus conversion utility) to generate the encrypted rbf file
|
||||
"$CPFPROG" -c ${TOP}_encrypt.cof
|
||||
"$CPFPROG" -c ${QPF_TOP}_encrypt.cof
|
||||
if [ $? -ne 0 ]; then popd; exit 1; fi
|
||||
cp ${TOP}_encrypted.rbf ${TOP}_encrypted_comp.rbf # comparison copy for checking later
|
||||
"$CPFPROG" -c ${TOP}_encrypt.cof
|
||||
cp ${TOP}_encrypted.rbf ${QPF_TOP}_encrypted_comp.rbf # comparison copy for checking later
|
||||
"$CPFPROG" -c ${QPF_TOP}_encrypt.cof
|
||||
if [ $? -ne 0 ]; then popd; exit 1; fi
|
||||
|
||||
"$PYTHON" "$WORKSPACE/jobscripts/checkencryption.py" -f ${TOP}_encrypted.rbf $BENIGN
|
||||
"$PYTHON" "$WORKSPACE/jobscripts/checkencryption.py" -f ${QPF_TOP}_encrypted.rbf $BENIGN
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
popd
|
||||
|
|
@ -121,17 +123,21 @@ popd
|
|||
# Export compilation outputs
|
||||
mv "$WORKSPACE/output.txt" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp "$OUTPUT_DIR/${TOP}.rbf" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp "$OUTPUT_DIR/${TOP}_encrypted.rbf" "$IMAGE_EXPORT"
|
||||
|
||||
if [ $CREATE_UNENCRYPTED_RBF = "True" ]; then
|
||||
cp "$OUTPUT_DIR/${QPF_TOP}.rbf" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
fi
|
||||
|
||||
cp "$OUTPUT_DIR/${QPF_TOP}_encrypted.rbf" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp "$PROJECT_DIR/${HPS0}.h" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp "$OUTPUT_DIR/${TOP}.sof" "$IMAGE_EXPORT"
|
||||
cp "$OUTPUT_DIR/${QPF_TOP}.sof" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp "$PROJECT_DIR/${TOP}_system.qsys" "$IMAGE_EXPORT"
|
||||
cp "$PROJECT_DIR/${QSYS_TOP}.qsys" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp "$PROJECT_DIR/${TOP}.sopcinfo" "$IMAGE_EXPORT"
|
||||
cp "$PROJECT_DIR/${QPF_TOP}.sopcinfo" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
cp -r "$PROJECT_DIR/hps_isw_handoff" "$IMAGE_EXPORT"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash -v
|
||||
|
||||
FIRMWARE_VERSION=`"$SOPC_BIN/qsys-script" --system-file="$COMP_DIR/top/build/${TOP}_system.qsys" --cmd="puts [get_instance_parameter_value sysid_qsys id]" --package-version="${QSYS_PKG_VER}"`
|
||||
FIRMWARE_VERSION=`"$SOPC_BIN/qsys-script" --system-file="$COMP_DIR/top/build/${QSYS_TOP}.qsys" --cmd="puts [get_instance_parameter_value sysid_qsys id]" --package-version="${QSYS_PKG_VER}"`
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
printf %x $FIRMWARE_VERSION > "$VERSION_DIR/elogic_version.txt"
|
||||
|
|
|
|||
|
|
@ -1,121 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
from os.path import splitext
|
||||
from tempfile import mkstemp
|
||||
from shutil import move
|
||||
from os import fdopen, remove
|
||||
|
||||
# CHECK arguments and offer advice if wrong
|
||||
|
||||
NumArgs = len(sys.argv)
|
||||
|
||||
if (NumArgs < 3) :
|
||||
print("+-----------------------------------------------------------------+")
|
||||
print("| Script: modify_qsys_params.py |")
|
||||
print("| |")
|
||||
print("| Description: This script edits a qsys file to |")
|
||||
print("| change parameters |")
|
||||
print("| |")
|
||||
print("| Parameters: qsys filename: <filename>.qsys |")
|
||||
print("| Pairs : <name>=<value> ... |")
|
||||
print("| |")
|
||||
print("| Example: modify_qsys_params.py Top.qsys VER=3 NUM=52 |")
|
||||
print("| |")
|
||||
print("+-----------------------------------------------------------------+")
|
||||
exit(1)
|
||||
|
||||
# Process arguments into useful variables
|
||||
requiredExt=".qsys"
|
||||
Base,Ext = splitext(sys.argv[1])
|
||||
if(Ext != requiredExt) :
|
||||
print("Input File must be of type {0}".format(requiredExt))
|
||||
exit(1)
|
||||
SrcFile = sys.argv[1]
|
||||
Pairs = sys.argv[2:]
|
||||
foundNames = []
|
||||
|
||||
#Looking for lines of this format: <parameter name="FW_VER_ONE" value="20000" />
|
||||
|
||||
import xml.etree.ElementTree as ET
|
||||
tree = ET.parse(SrcFile)
|
||||
root = tree.getroot()
|
||||
|
||||
#for i in root.findall("*parameter[@name='FW_VER_ONE']"):
|
||||
|
||||
def list_elem(node,tag,attribute):
|
||||
return node.findall("*{0}[@name='{1}']".format(tag,attribute))
|
||||
|
||||
for pair in Pairs:
|
||||
# find all elements which have the chosen name
|
||||
elementList = []
|
||||
pairLeft, pairRight = pair.split('=')
|
||||
elementList = list_elem(root,'parameter',pairLeft)
|
||||
if len(elementList) == 0:
|
||||
print("no parameter found matching {0}".format(pairLeft))
|
||||
exit(1)
|
||||
if len(elementList) > 1:
|
||||
print("parameter {0} not unique".format(pairLeft))
|
||||
exit(1)
|
||||
foundNames.append(pairLeft)
|
||||
elementList[0].set('value',pairRight)
|
||||
print("Updated {0}".format(pair))
|
||||
|
||||
if len(foundNames) != len(set(foundNames)):
|
||||
print("duplicate names being set.")
|
||||
exit(1)
|
||||
|
||||
#print("Updated values for : {0}".format(foundNames))
|
||||
|
||||
if tree.write(SrcFile) != None:
|
||||
print("Error writing outputfile")
|
||||
exit(1)
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
|
||||
for myElem in find_rec(root,"parameter"):
|
||||
print(myElem.attrib)
|
||||
|
||||
exit(0)
|
||||
|
||||
fh, abs_path = mkstemp()
|
||||
with fdopen(fh,'w') as new_file:
|
||||
with open(SrcFile) as old_file:
|
||||
for line in old_file:
|
||||
if re.search("<parameter",line):
|
||||
# Need to replace a value in this line
|
||||
if foundGenerics:
|
||||
print("more than one -generics line in {0}: ERROR".format(requiredExt))
|
||||
exit(1)
|
||||
print("Existing line to be updated")
|
||||
foundGenerics = True
|
||||
words = line.split()
|
||||
# Build a list of all original generic pairs
|
||||
for word in words:
|
||||
if (re.search("=",word)):
|
||||
# Remove duplicates
|
||||
duplicate = False
|
||||
for newPair in Pairs:
|
||||
if (newPair.split("=")[0] == word.split("=")[0]):
|
||||
duplicate = True
|
||||
if ( not duplicate):
|
||||
OrigPairs.append(word)
|
||||
|
||||
#new_file.write(line.replace("-generics","woop"))
|
||||
#edit existing line
|
||||
new_file.write("-generics { " + ' '.join(OrigPairs) + " " + ' '.join(Pairs) + " }\n")
|
||||
else:
|
||||
#duplicate line if not changing it
|
||||
new_file.write(line)
|
||||
if not foundGenerics:
|
||||
print("No generics already specified - add the line")
|
||||
new_file.write("-generics { " + ' '.join(Pairs) + " }\n")
|
||||
|
||||
remove(SrcFile)
|
||||
move(abs_path,SrcFile)
|
||||
|
||||
|
||||
exit(0)
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
@echo on
|
||||
|
||||
@echo ----------------------------
|
||||
@echo Current Error Level is %errorlevel%
|
||||
@echo ----------------------------
|
||||
|
||||
REM --------------------------------------
|
||||
REM Set up tool environment
|
||||
REM --------------------------------------
|
||||
|
||||
REM Use externally defined variable if one defined
|
||||
set ALTERA_ROOT=%WORKSPACE%\a\ver
|
||||
|
||||
REM Set directory name (under workspace) that has the build scripts,
|
||||
REM unless one already defined externally
|
||||
set SCRIPTSDIRNAME=jobscripts
|
||||
|
||||
set QUARTUS_ROOT=%ALTERA_ROOT%\quartus
|
||||
set SOPC_BIN=%QUARTUS_ROOT%\sopc_builder\bin
|
||||
set QUARTUS_BIN=%QUARTUS_ROOT%\bin64
|
||||
set ALTERA_IP_DIR=%ALTERA_ROOT%\ip
|
||||
set FW_AUTO_GEN_DIR=%WORKSPACE%\autogenscripts\logic_memory_mapper
|
||||
REM Use NIOSEDS for cygwin environment
|
||||
set NIOSEDS=%ALTERA_ROOT%\nios2eds
|
||||
|
||||
REM Setup location of license file
|
||||
SET LM_LICENSE_FILE=1801@Agero
|
||||
|
||||
REM Add tools to path
|
||||
set PATH=%PATH%;%QUARTUS_BIN%;%SOPC_BIN%
|
||||
|
||||
REM Set up source
|
||||
set FIRMWARE_ROOT=%WORKSPACE%\el
|
||||
set PROJECT_ROOT=%FIRMWARE_ROOT%\firmware
|
||||
|
||||
REM Use externally defined variable if one defined
|
||||
set COMP_DIR=%PROJECT_ROOT%
|
||||
|
||||
set PROJECT_DIR=%COMP_DIR%\top\build
|
||||
set QSYS_OUTPUT_DIR=%COMP_DIR%\top\build\%TOP%
|
||||
|
||||
REM --------------------------------------
|
||||
REM Version info
|
||||
REM Create folder to export
|
||||
REM --------------------------------------
|
||||
|
||||
set VERSION_DIR=%WORKSPACE%\version
|
||||
if not exist "%VERSION_DIR%" mkdir "%VERSION_DIR%"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set buildStamp=1.20000.0.0
|
||||
|
||||
if exist "%VERSION_DIR%\buildstamp.txt" (
|
||||
set /p buildStamp=<"%VERSION_DIR%\buildstamp.txt"
|
||||
@echo buildStamp extracted from file as !buildStamp!
|
||||
) else (
|
||||
@echo buildstamp.txt not found. Default buildStamp to !buildStamp!
|
||||
)
|
||||
|
||||
@echo ----------------------------
|
||||
@echo Current Error Level is %errorlevel%
|
||||
@echo ----------------------------
|
||||
|
||||
REM End up with a 4 number build stamp
|
||||
for /f "tokens=1,2,3,4 delims=." %%a in ("%buildStamp%") do set FW_ZERO=%%a&set FW_ONE=%%b&set FW_TWO=%%c&set FW_THREE=%%d
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
%PYTHON34% %FW_AUTO_GEN_DIR%\update_fw_ver.py "%COMP_DIR%/generic_ip/generic_versioning/doc/generic_versioning.json" %FW_ZERO% %FW_ONE% %FW_TWO% %FW_THREE%
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
REM Extract the "embedded logic version" from the sysid block in the
|
||||
call "%NIOSEDS%\Nios II Command Shell.bat" "$WORKSPACE/$SCRIPTSDIRNAME/elogic_version.sh"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
@echo on
|
||||
|
||||
REM Location of sub-components
|
||||
set SEARCH_PATH=%COMP_DIR%\**\*,$
|
||||
|
||||
REM Do the build
|
||||
call "%NIOSEDS%\Nios II Command Shell.bat" "$WORKSPACE/$SCRIPTSDIRNAME/build_image.sh"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
REM Completed without errors
|
||||
exit /b 0
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
pipeline {
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
environment {
|
||||
TOP = "top"
|
||||
}
|
||||
agent { label "${AGENT_LABEL}" }
|
||||
stages {
|
||||
stage('Initial setup') {
|
||||
steps {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ except:
|
|||
print("Error updating fw version")
|
||||
sys.exit(1)
|
||||
|
||||
QPF_TOP=os.environ["QPF_TOP"]
|
||||
QSYS_TOP=os.environ["QSYS_TOP"]
|
||||
|
||||
ALTERA_ROOT=os.path.join(WORKSPACE,"a/ver")
|
||||
os.environ["ALTERA_ROOT"]=ALTERA_ROOT
|
||||
QUARTUS_ROOT=os.path.join(ALTERA_ROOT,"quartus")
|
||||
|
|
@ -31,7 +34,7 @@ os.environ["COMP_DIR"]=COMP_DIR
|
|||
VERSION_DIR=os.environ["VERSION_DIR"]
|
||||
os.environ["FW_AUTO_GEN_DIR"]=os.path.join(WORKSPACE,"autogenscripts/logic_memory_mapper")
|
||||
os.environ["PROJECT_DIR"]=os.path.join(COMP_DIR,"top/build")
|
||||
QSYS_OUTPUT_DIR=os.path.join(COMP_DIR,"top/build",os.environ["TOP"])
|
||||
QSYS_OUTPUT_DIR=os.path.join(COMP_DIR,"top/build",QSYS_TOP)
|
||||
SYNTHESIS_OUTPUT_DIR=os.path.join(QSYS_OUTPUT_DIR,"synthesis")
|
||||
os.environ["QSYS_OUTPUT_DIR"]=QSYS_OUTPUT_DIR
|
||||
os.environ["SYNTHESIS_OUTPUT_DIR"]=SYNTHESIS_OUTPUT_DIR
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue