soc/integration/csr_bridge: use registered version only when SDRAM is present.
[litex.git] / litex_setup.py
index a432c9a5a1a289018b8e6627cc2eb106a0b1754a..d1e9a6cafe4ea5d1298a9729c6519f368e103ebf 100755 (executable)
@@ -4,13 +4,13 @@ import os
 import sys
 import subprocess
 import shutil
+import hashlib
 from collections import OrderedDict
 
 import urllib.request
 
 current_path = os.path.abspath(os.curdir)
 
-
 # Repositories -------------------------------------------------------------------------------------
 
 # name,  (url, recursive clone, develop, sha1)
@@ -34,6 +34,7 @@ repos = [
     ("litescope",    ("https://github.com/enjoy-digital/", False, True, None)),
     ("litejesd204b", ("https://github.com/enjoy-digital/", False, True, None)),
     ("litespi",      ("https://github.com/litex-hub/",     False, True, None)),
+    ("litehyperbus", ("https://github.com/litex-hub/",     False, True, None)),
 
     # LiteX boards support
     ("litex-boards", ("https://github.com/litex-hub/",     False, True, None)),
@@ -45,11 +46,12 @@ repos = [
     ("pythondata-cpu-picorv32",    ("https://github.com/litex-hub/", False, True, None)),
     ("pythondata-cpu-serv",        ("https://github.com/litex-hub/", False, True, None)),
     ("pythondata-cpu-vexriscv",    ("https://github.com/litex-hub/", False, True, None)),
+    ("pythondata-cpu-vexriscv-smp",("https://github.com/litex-hub/", True,  True, None)),
     ("pythondata-cpu-rocket",      ("https://github.com/litex-hub/", False, True, None)),
     ("pythondata-cpu-minerva",     ("https://github.com/litex-hub/", False, True, None)),
-    ("pythondata-cpu-microwatt",   ("https://github.com/litex-hub/", False, True, 0xa7859fb)),
+    ("pythondata-cpu-microwatt",   ("https://github.com/litex-hub/", False, True, 0xba76652)),
     ("pythondata-cpu-blackparrot", ("https://github.com/litex-hub/", False, True, None)),
-    ("pythondata-cpu-cv32e40p",    ("https://github.com/litex-hub/", False, True, None)),
+    ("pythondata-cpu-cv32e40p",    ("https://github.com/litex-hub/", True,  True, None)),
 ]
 
 repos = OrderedDict(repos)
@@ -96,8 +98,28 @@ if len(sys.argv) < 2:
     print("- update")
     print("- install (add --user to install to user directory)")
     print("- gcc")
+    print("- dev (dev mode, disable automatic litex_setup.py update)")
     exit()
 
+# Check/Update litex_setup.py
+
+litex_setup_url = "https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py"
+current_sha1 = hashlib.sha1(open(os.path.realpath(__file__)).read().encode("utf-8")).hexdigest()
+print("[checking litex_setup.py]...")
+try:
+    import requests
+    r = requests.get(litex_setup_url)
+    if r.status_code != 404:
+        upstream_sha1 = hashlib.sha1(r.content).hexdigest()
+        if current_sha1 != upstream_sha1:
+            if "dev" not in sys.argv[1:]:
+                print("[updating litex_setup.py]...")
+                with open(os.path.realpath(__file__), "wb") as f:
+                    f.write(r.content)
+                os.execl(sys.executable, sys.executable, *sys.argv)
+except:
+    pass
+
 # Repositories cloning
 if "init" in sys.argv[1:]:
     for name in repos.keys():
@@ -124,6 +146,7 @@ if "update" in sys.argv[1:]:
         # update
         print("[updating " + name + "]...")
         os.chdir(os.path.join(current_path, name))
+        subprocess.check_call("git checkout master", shell=True)
         subprocess.check_call("git pull --ff-only", shell=True)
         if sha1 is not None:
             os.chdir(os.path.join(current_path, name))