From caf2d9f0c597b2aaef73ac1dc2452a5b5f0798c3 Mon Sep 17 00:00:00 2001 From: andy <1414772332@qq.com> Date: Thu, 12 Jun 2025 17:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0while(1)=20timer=E4=B8=AD?= =?UTF-8?q?=E6=96=AD=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- riscv/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/riscv/main.c b/riscv/main.c index ed9b092..91b21a1 100644 --- a/riscv/main.c +++ b/riscv/main.c @@ -46,6 +46,9 @@ int main() int b=2; typedef void (*fun_t)(void); fun_t fun = (fun_t)0; + set_csr(mstatus, 0x00000008); + set_csr(mie, (1 << 3) | (1 << 7)); + set_csr(mip, (1 << 3)); fun(); int c = add(a, b); my_printf("Hello World! %s\n", "Andy"); @@ -55,10 +58,10 @@ int main() fun(); my_printf("mul(%d, %d)=%d\n", a, b, a * b); my_printf("ram_val test: %s\n", g_string); - set_csr(mstatus, 0x00000008); - set_csr(mie, (1 << 3)); - set_csr(mip, (1 << 3)); cpu_test(); + my_printf("enter while 1\n"); + while (1) { + } return 0; } \ No newline at end of file