Skip to content

Commit

Permalink
adding more granularity to build outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ruck314 committed Dec 11, 2023
1 parent 20df08f commit 2516409
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 26 deletions.
34 changes: 29 additions & 5 deletions system_vivado.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,46 @@ ifndef REPORT_QOR
export REPORT_QOR = 0
endif

ifndef GZIP_BUILD_IMAGE
export GZIP_BUILD_IMAGE = 0
##############################################################################

ifndef GEN_BIT_IMAGE
export GEN_BIT_IMAGE = 1
endif

ifndef GEN_BIT_IMAGE_GZIP
export GEN_BIT_IMAGE_GZIP = 0
endif

ifndef GEN_BIN_IMAGE
export GEN_BIN_IMAGE = 0
endif

ifndef GEN_BIT_IMAGE
export GEN_BIT_IMAGE = 1
ifndef GEN_BIN_IMAGE_GZIP
export GEN_BIN_IMAGE_GZIP = 0
endif

ifndef GEN_PDI_IMAGE
export GEN_PDI_IMAGE = 1
endif

ifndef GEN_PDI_IMAGE_GZIP
export GEN_PDI_IMAGE_GZIP = 0
endif

ifndef GEN_MCS_IMAGE
export GEN_MCS_IMAGE = 1
endif

ifndef GEN_MCS_IMAGE_GZIP
export GEN_MCS_IMAGE_GZIP = 0
endif

ifndef GEN_XSA_IMAGE
export GEN_XSA_IMAGE = 1
export GEN_XSA_IMAGE = 0
endif

##############################################################################

ifndef RECONFIG_CHECKPOINT
export RECONFIG_CHECKPOINT = 0
export RECONFIG_STATIC_HASH = 0
Expand Down
24 changes: 14 additions & 10 deletions vivado/proc/output_files.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@ proc CreateFpgaBit { } {
# Copy the .BIT file to image directory
if { $::env(GEN_BIT_IMAGE) != 0 } {
exec cp -f ${IMPL_DIR}/${topModule}.bit ${imagePath}.bit
if { $::env(GZIP_BUILD_IMAGE) != 0 } {
exec gzip -c -f -9 ${IMPL_DIR}/${topModule}.bit > ${imagePath}.bit.gz
}
puts "Bit file copied to ${imagePath}.bit"
}
if { $::env(GEN_BIT_IMAGE_GZIP) != 0 } {
exec gzip -c -f -9 ${IMPL_DIR}/${topModule}.bit > ${imagePath}.bit.gz
puts "Bit file copied to ${imagePath}.bit.gz"
}

# Copy the .BIN file to image directory
if { $::env(GEN_BIN_IMAGE) != 0 } {
exec cp -f ${IMPL_DIR}/${topModule}.bin ${imagePath}.bin
if { $::env(GZIP_BUILD_IMAGE) != 0 } {
exec gzip -c -f -9 ${IMPL_DIR}/${topModule}.bin > ${imagePath}.bin.gz
}
puts "Bin file copied to ${imagePath}.bin"
}
if { $::env(GEN_BIN_IMAGE_GZIP) != 0 } {
exec gzip -c -f -9 ${IMPL_DIR}/${topModule}.bin > ${imagePath}.bin.gz
puts "Bin file copied to ${imagePath}.bin.gz"
}

# Copy the .ltx file (if it exists)
CopyLtxFile
Expand Down Expand Up @@ -70,12 +72,14 @@ proc CreateVersalOutputs { } {
set topModule [file rootname [file tail [glob -dir ${IMPL_DIR} *.pdi]]]

# Copy the .pdi file to image directory
exec cp -f ${IMPL_DIR}/${topModule}.pdi ${imagePath}.pdi
puts "PDI file copied to ${imagePath}.pdi"

if { $::env(GEN_PDI_IMAGE) != 0 } {
exec cp -f ${IMPL_DIR}/${topModule}.pdi ${imagePath}.pdi
puts "PDI file copied to ${imagePath}.pdi"
}
# Check if gzip-ing the image files
if { $::env(GZIP_BUILD_IMAGE) != 0 } {
if { $::env(GEN_PDI_IMAGE_GZIP) != 0 } {
exec gzip -c -f -9 ${IMPL_DIR}/${topModule}.pdi > ${imagePath}.pdi.gz
puts "PDI file copied to ${imagePath}.pdi.gz"
}

# Copy the .ltx file (if it exists)
Expand Down
29 changes: 18 additions & 11 deletions vivado/promgen.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,36 @@ if { ${loaddata} != "" } {
if { ${inteface} == "SPIx8" } {

# Copy the images from build tree to source tree
exec cp -f ${outputFilePri} ${imagesFilePri}
exec cp -f ${outputFileSec} ${imagesFileSec}
puts "PROM file copied to ${imagesFilePri}"
puts "PROM file copied to ${imagesFileSec}"
if { $::env(GEN_MCS_IMAGE) != 0 } {
exec cp -f ${outputFilePri} ${imagesFilePri}
puts "PROM file copied to ${imagesFilePri}"
exec cp -f ${outputFileSec} ${imagesFileSec}
puts "PROM file copied to ${imagesFileSec}"
}

# Check if gzip-ing the image files
if { $::env(GZIP_BUILD_IMAGE) != 0 } {
if { $::env(GEN_MCS_IMAGE_GZIP) != 0 } {
# Create a compressed version of the image files
exec gzip -c -f -9 ${imagesFilePri} > ${imagesFilePri}.gz
exec gzip -c -f -9 ${imagesFileSec} > ${imagesFileSec}.gz
exec gzip -c -f -9 ${outputFilePri} > ${imagesFilePri}.gz
puts "PROM file copied to ${imagesFilePri}.gz"
exec gzip -c -f -9 ${outputFileSec} > ${imagesFileSec}.gz
puts "PROM file copied to ${imagesFileSec}.gz"
}

# Else single file PROM format
} else {

# Copy the image from build tree to source tree
exec cp -f ${outputFile} ${imagesFile}
puts "PROM file copied to ${imagesFile}"
if { $::env(GEN_MCS_IMAGE) != 0 } {
exec cp -f ${outputFile} ${imagesFile}
puts "PROM file copied to ${imagesFile}"
}

# Check if gzip-ing the image files
if { $::env(GZIP_BUILD_IMAGE) != 0 } {
if { $::env(GEN_MCS_IMAGE_GZIP) != 0 } {
# Create a compressed version of the image file
exec gzip -c -f -9 ${imagesFile} > ${imagesFile}.gz
exec gzip -c -f -9 ${outputFile} > ${imagesFile}.gz
puts "PROM file copied to ${imagesFile}.gz"
}

}

0 comments on commit 2516409

Please sign in to comment.