diff --git a/autobuild/synthesis/build_image.sh b/autobuild/synthesis/build_image.sh index 71f5cb3..1dd3034 100644 --- a/autobuild/synthesis/build_image.sh +++ b/autobuild/synthesis/build_image.sh @@ -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 diff --git a/autobuild/synthesis/elogic_version.sh b/autobuild/synthesis/elogic_version.sh index 614a749..b18c1a6 100644 --- a/autobuild/synthesis/elogic_version.sh +++ b/autobuild/synthesis/elogic_version.sh @@ -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" diff --git a/autobuild/synthesis/modify_qsys_params.py b/autobuild/synthesis/modify_qsys_params.py deleted file mode 100644 index 280b60f..0000000 --- a/autobuild/synthesis/modify_qsys_params.py +++ /dev/null @@ -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: .qsys |") - print("| Pairs : = ... |") - 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: - -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("