From 141053b55ef59c3bb342414642a2f3cae49fcb11 Mon Sep 17 00:00:00 2001
From: dam1n19 <dam1n19@soton.ac.uk>
Date: Mon, 3 Apr 2023 15:18:31 +0100
Subject: [PATCH] Updated git submodules

---
 .gitmodules       |  5 +++++
 flow/soc-pull     | 13 +++++++------
 flow/socrepo-init | 25 +++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 6 deletions(-)
 create mode 100755 flow/socrepo-init

diff --git a/.gitmodules b/.gitmodules
index a565e9c..5f134ec 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,15 +1,20 @@
 [submodule "accelerator-wrapper"]
 	path = accelerator-wrapper
 	url = git@git.soton.ac.uk:soclabs/accelerator-wrapper.git
+	branch = main
 [submodule "nanosoc"]
 	path = nanosoc
 	url = git@git.soton.ac.uk:soclabs/nanosoc.git
+	branch = main
 [submodule "socsim"]
 	path = socsim
 	url = git@git.soton.ac.uk:soclabs/socsim.git
+	branch = main
 [submodule "CHIPKIT"]
 	path = CHIPKIT
 	url = git@git.soton.ac.uk:soclabs/CHIPKIT.git
+	branch = main
 [submodule "secworks-sha256"]
 	path = secworks-sha256
 	url = git@git.soton.ac.uk:soclabs/secworks-sha256.git
+	branch = main
diff --git a/flow/soc-pull b/flow/soc-pull
index ae36354..42ff651 100755
--- a/flow/soc-pull
+++ b/flow/soc-pull
@@ -1,9 +1,10 @@
 #!/bin/bash
 
 # Update all Submodules to latest commit
-for d in $DESIGN_ROOT/* ; do
-    if [ -f "$d/.git" ]; then
-        echo "Git Pulling $d"
-        cd $d; git pull; cd ..
-    fi
-done
\ No newline at end of file
+cd $DESIGN_ROOT; git submodule foreach --recursive git pull
+# for d in $DESIGN_ROOT/* ; do
+#     if [ -f "$d/.git" ]; then
+#         echo "Git Pulling $d"
+#         cd $d; git pull; cd ..
+#     fi
+# done
\ No newline at end of file
diff --git a/flow/socrepo-init b/flow/socrepo-init
new file mode 100755
index 0000000..18fe269
--- /dev/null
+++ b/flow/socrepo-init
@@ -0,0 +1,25 @@
+#-----------------------------------------------------------------------------
+# SoC Labs socsim script to run required simulation
+# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license.
+#
+# Contributors
+#
+# David Mapstone (d.a.mapstone@soton.ac.uk)
+#
+# Copyright  2022, SoC Labs (www.soclabs.org)
+#-----------------------------------------------------------------------------
+
+#!/usr/bin/env bash
+
+# Source environment variables for all submodules
+for d in $SOC_TOP_DIR/* ; do
+    if [ -e "$d/.git" ]; then
+        echo $d
+        if [ -f "$d/set_env.sh" ]; then
+        # If .git file exists - submodule
+            git config -f .gitmodules submodule.$d.branch main
+        fi
+    fi
+done
+git submodule update --remote --recursive
+git submodule foreach --recursive git checkout main
\ No newline at end of file
-- 
GitLab