aboutsummaryrefslogtreecommitdiff
path: root/debug/programs
diff options
context:
space:
mode:
authorliangzhen <zhen.liang@spacemit.com>2023-10-16 13:47:52 +0800
committerliangzhen <zhen.liang@spacemit.com>2023-10-16 13:47:52 +0800
commit4dfd2e7b4b6ef3f1dc134d299cc2ea4d2bbadab1 (patch)
treeba118d19cf517afb88cc6795b7937bd2f7777b94 /debug/programs
parentc36c814ae49610bc407a5c4e144866fa50e4510e (diff)
downloadriscv-tests-4dfd2e7b4b6ef3f1dc134d299cc2ea4d2bbadab1.zip
riscv-tests-4dfd2e7b4b6ef3f1dc134d299cc2ea4d2bbadab1.tar.gz
riscv-tests-4dfd2e7b4b6ef3f1dc134d299cc2ea4d2bbadab1.tar.bz2
Make CLINT address configurable
Signed-off-by: liangzhen <zhen.liang@spacemit.com>
Diffstat (limited to 'debug/programs')
-rw-r--r--debug/programs/init.h6
-rw-r--r--debug/programs/run_halt_timing.S6
2 files changed, 9 insertions, 3 deletions
diff --git a/debug/programs/init.h b/debug/programs/init.h
index 06d5384..e79681d 100644
--- a/debug/programs/init.h
+++ b/debug/programs/init.h
@@ -1,8 +1,10 @@
#ifndef INIT_H
#define INIT_H
-#define MTIME (*(volatile long long *)(0x02000000 + 0xbff8))
-#define MTIMECMP ((volatile long long *)(0x02000000 + 0x4000))
+#ifdef CLINT
+#define MTIME (*(volatile long long *)(CLINT + 0xbff8))
+#define MTIMECMP ((volatile long long *)(CLINT + 0x4000))
+#endif
typedef void* (*trap_handler_t)(unsigned hartid, unsigned mcause, void *mepc,
void *sp);
diff --git a/debug/programs/run_halt_timing.S b/debug/programs/run_halt_timing.S
index ce4000a..dc5d58b 100644
--- a/debug/programs/run_halt_timing.S
+++ b/debug/programs/run_halt_timing.S
@@ -8,10 +8,14 @@
# define REGBYTES 4
#endif
+#ifdef CLINT
+#define MTIME_ADDR CLINT + 0xbff8
+#endif
+
.global main
main:
li s0, 0
- li s1, 0x0200bff8
+ li s1, MTIME_ADDR
loop:
addi s0, s0, 1
LREG s2, 0(s1)