From 5a598b46158da3bac7a3f178120b4943aef2026a Mon Sep 17 00:00:00 2001
From: Jason Kridner <jkridner@beagleboard.org>
Date: Tue, 28 Nov 2023 09:35:58 -0500
Subject: [PATCH] fire: mchp tools setup: directly include setup script

---
 .../mchp-fpga-tools-installation-guide.rst    |  9 ++--
 .../setup-microchip-tools.sh                  | 42 +++++++++++++++++++
 2 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100755 boards/beaglev/fire/demos-and-tutorials/setup-microchip-tools.sh

diff --git a/boards/beaglev/fire/demos-and-tutorials/mchp-fpga-tools-installation-guide.rst b/boards/beaglev/fire/demos-and-tutorials/mchp-fpga-tools-installation-guide.rst
index ff2fd56b..072fe758 100644
--- a/boards/beaglev/fire/demos-and-tutorials/mchp-fpga-tools-installation-guide.rst
+++ b/boards/beaglev/fire/demos-and-tutorials/mchp-fpga-tools-installation-guide.rst
@@ -102,13 +102,16 @@ Request a Libero Silver license
 
 You will get an email with a license.dat file. Copy it into the ~/Microchip/license directory. Edit the License.dat file to replace the <put.hostname.here> string with... localhost.
 
-Download tool setup script
+Execute tool setup script
 ***************************
 
-.. code-block:: 
+Download the script:
 
-  git clone https://git.beagleboard.org/beaglev-fire/Microchip-FPGA-Tools-Setup 
+.. literalinclude:: ./setup-microchip-tools.sh
+    :caption: Libero environment and license setup script
+    :language: bash
 
+:download:`setup-microchip-tools.sh <./setup-microchip-tools.sh>`
 
 Source the script:
 
diff --git a/boards/beaglev/fire/demos-and-tutorials/setup-microchip-tools.sh b/boards/beaglev/fire/demos-and-tutorials/setup-microchip-tools.sh
new file mode 100755
index 00000000..ccfb3207
--- /dev/null
+++ b/boards/beaglev/fire/demos-and-tutorials/setup-microchip-tools.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+#===============================================================================
+# Edit the following section with the location where the following tools are
+# installed:
+#   - SoftConsole (SC_INSTALL_DIR)
+#   - Libero (LIBERO_INSTALL_DIR)
+#   - Licensing daemon for Libero (LICENSE_DAEMON_DIR)
+#===============================================================================
+export SC_INSTALL_DIR=/home/$USER/Microchip/SoftConsole-v2022.2-RISC-V-747
+export LIBERO_INSTALL_DIR=/home/$USER/Microchip/Libero_SoC_v2023.2
+export LICENSE_DAEMON_DIR=/home/$USER/Microchip/Linux_Licensing_Daemon
+export LICENSE_FILE_DIR=/home/$USER/Microchip/license
+
+#===============================================================================
+# The following was tested on Ubuntu 20.04 with:
+#   - Libero 2023.2
+#   - SoftConsole 2022.2
+#===============================================================================
+
+#
+# SoftConsole
+#
+export PATH=$PATH:$SC_INSTALL_DIR/riscv-unknown-elf-gcc/bin
+export FPGENPROG=$LIBERO_INSTALL_DIR/Libero/bin64/fpgenprog
+
+#
+# Libero
+#
+export PATH=$PATH:$LIBERO_INSTALL_DIR/Libero/bin:$LIBERO_INSTALL_DIR/Libero/bin64
+export PATH=$PATH:$LIBERO_INSTALL_DIR/Synplify/bin
+export PATH=$PATH:$LIBERO_INSTALL_DIR/Model/modeltech/linuxacoem
+export LOCALE=C
+export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu:$LD_LIBRARY_PATH
+
+#
+# Libero License daemon
+#
+export LM_LICENSE_FILE=1702@localhost
+export SNPSLMD_LICENSE_FILE=1702@localhost
+
+$LICENSE_DAEMON_DIR/lmgrd -c $LICENSE_FILE_DIR/License.dat -l $LICENSE_FILE_DIR/license.log
-- 
GitLab