From 2bd235f4776e967a66db46b228f805098723b52b Mon Sep 17 00:00:00 2001 From: Daniel Jobson Date: Mon, 11 Nov 2024 12:39:36 +0100 Subject: [PATCH] temp: add define to toggle the use of fw RAM --- hw/application_fpga/fw/tk1/syscall.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/application_fpga/fw/tk1/syscall.c b/hw/application_fpga/fw/tk1/syscall.c index 21b19f58..258edbea 100644 --- a/hw/application_fpga/fw/tk1/syscall.c +++ b/hw/application_fpga/fw/tk1/syscall.c @@ -10,11 +10,14 @@ #include +#define USE_FW_RAM_IN_SYSCALL + void inner_syscall(volatile syscall_t *ctx); void syscall(syscall_t *ctx) { +#ifdef USE_FW_RAM_IN_SYSCALL asm volatile("addi x5, sp, 0;" // Save current SP value in x5 "li sp, 0xd0000800;" // Change SP to top of FW_RAM "addi sp, sp, -4;" // Adjust SP to make space @@ -23,9 +26,11 @@ void syscall(syscall_t *ctx) : // No outputs : // No inputs : "x5", "memory"); // Clobbers +#endif //USE_FW_RAM_IN_SYSCALL inner_syscall(ctx); +#ifdef USE_FW_RAM_IN_SYSCALL asm volatile("lui t0, 0xd0000;" // Load the upper 20 bits "addi t0, t0, 0x7fc;" // Add the lower 12 bits for full "lw t1, 0(t0);" // Load the word at address in t0 to t1 @@ -33,6 +38,7 @@ void syscall(syscall_t *ctx) : // No outputs : // No inputs : "t0", "t1", "memory"); // Clobbers +#endif //USE_FW_RAM_IN_SYSCALL return; }