From cc6621a6d7a9ef30e95fbf13e9f7fa425798e705 Mon Sep 17 00:00:00 2001
From: vauban353 <vauban353@gmail.com>
Date: Sun, 11 Jun 2023 21:37:40 +0100
Subject: [PATCH] Programming: Add SPI flash programming file generation.

---
 BUILD_BVF_GATEWARE.tcl                  |  3 +++
 script_support/export_spi_prog_file.tcl | 35 +++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 script_support/export_spi_prog_file.tcl

diff --git a/BUILD_BVF_GATEWARE.tcl b/BUILD_BVF_GATEWARE.tcl
index 9b74822..ec63c54 100644
--- a/BUILD_BVF_GATEWARE.tcl
+++ b/BUILD_BVF_GATEWARE.tcl
@@ -249,7 +249,10 @@ if !{[info exists ONLY_CREATE_DESIGN]} {
     } else {
         run_tool -name {GENERATEPROGRAMMINGDATA}
     }
+    source ./script_support/export_spi_prog_file.tcl
     configure_spiflash -cfg_file {./script_support/spiflash.cfg} 
+    run_tool -name {GENERATEPROGRAMMINGFILE} 
+#    run_tool -name {GENERATE_SPI_FLASH_IMAGE} 
     source ./script_support/export_flashproexpress.tcl
 } 
 
diff --git a/script_support/export_spi_prog_file.tcl b/script_support/export_spi_prog_file.tcl
new file mode 100644
index 0000000..08c72f7
--- /dev/null
+++ b/script_support/export_spi_prog_file.tcl
@@ -0,0 +1,35 @@
+export_bitstream_file \
+         -file_name ${top_level_name} \
+         -export_dir $FPE_EXPORT_PATH/../LinuxProgramming \
+         -format {SPI} \
+         -for_ihp 0 \
+         -limit_SVF_file_size 0 \
+         -limit_SVF_file_by_max_filesize_or_vectors {} \
+         -svf_max_filesize {} \
+         -svf_max_vectors {} \
+         -master_file 0 \
+         -master_file_components {} \
+         -encrypted_uek1_file 0 \
+         -encrypted_uek1_file_components {} \
+         -encrypted_uek2_file 0 \
+         -encrypted_uek2_file_components {} \
+         -trusted_facility_file 1 \
+         -trusted_facility_file_components {FABRIC SNVM ENVM} \
+         -zeroization_likenew_action 0 \
+         -zeroization_unrecoverable_action 0 \
+         -master_backlevel_bypass 0 \
+         -uek1_backlevel_bypass 0 \
+         -uek2_backlevel_bypass 0 \
+         -master_include_plaintext_passkey 0 \
+         -uek1_include_plaintext_passkey 0 \
+         -uek2_include_plaintext_passkey 0 \
+         -sanitize_snvm 0 \
+         -sanitize_envm 0 \
+         -trusted_facility_keep_fabric_operational 0 \
+         -trusted_facility_skip_startup_seq 0 \
+         -uek1_keep_fabric_operational 0 \
+         -uek1_skip_startup_seq 0 \
+         -uek1_high_water_mark {} \
+         -uek2_keep_fabric_operational 0 \
+         -uek2_skip_startup_seq 0 \
+         -uek2_high_water_mark {} 
-- 
GitLab