From 3a77878f571d5cfad01f4b1a83a0c43395097acf Mon Sep 17 00:00:00 2001
From: Reinier van der Walle <walle@astron.nl>
Date: Mon, 7 Dec 2020 10:26:47 +0100
Subject: [PATCH] Added copy command to copy the .mif file

---
 .../hardware/ta2_unb2b_bsp/scripts/pre_flow_pr.tcl   | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/applications/ta2/bsp/hardware/ta2_unb2b_bsp/scripts/pre_flow_pr.tcl b/applications/ta2/bsp/hardware/ta2_unb2b_bsp/scripts/pre_flow_pr.tcl
index cb6dd4342a..438f99f0a1 100755
--- a/applications/ta2/bsp/hardware/ta2_unb2b_bsp/scripts/pre_flow_pr.tcl
+++ b/applications/ta2/bsp/hardware/ta2_unb2b_bsp/scripts/pre_flow_pr.tcl
@@ -108,7 +108,7 @@ if {[file exists "$::env(RADIOHDL_BUILD_DIR)/unb2b/quartus/$board_name/$board_na
   exit 2
 
 }
-# Copy memory initialization file
+# Copy memory initialization files
 if {[file exists "$::env(RADIOHDL_BUILD_DIR)/unb2b/quartus/$board_name/onchip_memory2_0.hex"] == 1} {
   file copy -force $::env(RADIOHDL_BUILD_DIR)/unb2b/quartus/$board_name/onchip_memory2_0.hex onchip_memory2_0.hex 
 } else {
@@ -116,9 +116,15 @@ if {[file exists "$::env(RADIOHDL_BUILD_DIR)/unb2b/quartus/$board_name/onchip_me
   post_message -type error "quartus_config unb2b; run_qsys unb2b $board_name board.qsys"
   post_message -type error "Terminating pre-flow script"
   exit 2
-
 }
-
+if {[file exists "$::env(RADIOHDL_BUILD_DIR)/unb2b/quartus/$board_name/$board_name.mif"] == 1} {
+  file copy -force $::env(RADIOHDL_BUILD_DIR)/unb2b/quartus/$board_name/$board_name.mif $board_name.mif
+} else {
+  post_message -type error "It seems that the BSP has not been initialized yet, please execute the following commands and try again:"
+  post_message -type error "quartus_config unb2b; run_qsys unb2b $board_name board.qsys"
+  post_message -type error "Terminating pre-flow script"
+  exit 2
+}
 post_message "Compiling $revision_name revision: generating and archiving board.qsys"
 post_message "    qsys-generate -syn --family=\"Arria 10\" --part=$device_name board.qsys"
 qexec "qsys-generate -syn --family=\"Arria 10\" --part=$device_name board.qsys"
-- 
GitLab