Change the global pointer symbol to __global_pointer$
[riscv-tests.git] / debug / programs / entry.S
index 80904cdb38191967deb1958e18955c4365fc1c91..b507a934a584c99eddabcc3b1128aba34d6c16b5 100755 (executable)
@@ -5,7 +5,7 @@
 
 #define STACK_SIZE 512
 
-#ifdef __riscv64
+#if XLEN == 64
 # define LREG ld
 # define SREG sd
 # define REGBYTES 8
@@ -35,11 +35,20 @@ handle_reset:
   csrwi mie, 0
 
   # initialize global pointer
-  la gp, _gp
+  la gp, __global_pointer$
 
   # initialize stack pointer
   la sp, stack_top
 
+  # Clear all hardware triggers
+  li    t0, ~0
+1:
+  addi  t0, t0, 1
+  csrw  CSR_TSELECT, t0
+  csrw  CSR_TDATA1, zero
+  csrr  t1, CSR_TSELECT
+  beq   t0, t1, 1b
+
   # perform the rest of initialization in C
   j _init