debug: checkpoint of trying to get simulation tests working
[riscv-tests.git] / debug / testlib.py
index 5a5d6e360def979992c6b567215936b600d51e25..b0a625beeb6a49fd6557ac48a59a652dec439764 100644 (file)
@@ -19,8 +19,11 @@ def find_file(path):
     return None
 
 def compile(args, xlen=32): # pylint: disable=redefined-builtin
-    cc = os.path.expandvars("$RISCV/bin/riscv%d-unknown-elf-gcc" % xlen)
+    cc = os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gcc")
     cmd = [cc, "-g"]
+    if (xlen == 32):
+        cmd.append("-march=rv32imac")
+        cmd.append("-mabi=ilp32")
     for arg in args:
         found = find_file(arg)
         if found:
@@ -28,7 +31,7 @@ def compile(args, xlen=32): # pylint: disable=redefined-builtin
         else:
             cmd.append(arg)
     process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE)
+                               stderr=subprocess.PIPE)
     stdout, stderr = process.communicate()
     if process.returncode:
         print