Skip to content

Commit be0a197

Browse files
galakioannisg
authored andcommitted
riscv: MTVAL CSR not supported on OpenISA RV32M1
Don't report MTVAL on the OpenISA RV32M1 SoC as this CSR isn't supported on the SoC. Fixes: #34014 Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
1 parent a632c52 commit be0a197

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/riscv/core/fatal.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,21 @@ void _Fault(z_arch_esf_t *esf)
103103
}
104104
}
105105
#endif /* CONFIG_USERSPACE */
106-
ulong_t mcause, mtval;
106+
ulong_t mcause;
107107

108108
__asm__ volatile("csrr %0, mcause" : "=r" (mcause));
109+
110+
#ifndef CONFIG_SOC_OPENISA_RV32M1_RISCV32
111+
ulong_t mtval;
109112
__asm__ volatile("csrr %0, mtval" : "=r" (mtval));
113+
#endif
110114

111115
mcause &= SOC_MCAUSE_EXP_MASK;
112116
LOG_ERR("");
113117
LOG_ERR(" mcause: %ld, %s", mcause, cause_str(mcause));
118+
#ifndef CONFIG_SOC_OPENISA_RV32M1_RISCV32
114119
LOG_ERR(" mtval: %lx", mtval);
120+
#endif
115121

116122
z_riscv_fatal_error(K_ERR_CPU_EXCEPTION, esf);
117123
}

0 commit comments

Comments
 (0)