arch: riscv: fatal: make cause_str
reusable
Rename `cause_str` to `z_riscv_mcause_str` and make it non-static, so that it can be used in user-implemented `k_sys_fatal_error_handler`. Also, this function should return a constant string, so add `const` to it. Signed-off-by: Yong Cong Sin <ycsin@meta.com> Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
parent
951af0d457
commit
7844f5aebb
1 changed files with 2 additions and 2 deletions
|
@ -52,7 +52,7 @@ uintptr_t z_riscv_get_sp_before_exc(const struct arch_esf *esf)
|
|||
return sp;
|
||||
}
|
||||
|
||||
static char *cause_str(unsigned long cause)
|
||||
const char *z_riscv_mcause_str(unsigned long cause)
|
||||
{
|
||||
switch (cause) {
|
||||
case 0:
|
||||
|
@ -103,7 +103,7 @@ FUNC_NORETURN void z_riscv_fatal_error_csf(unsigned int reason, const struct arc
|
|||
|
||||
mcause &= CONFIG_RISCV_MCAUSE_EXCEPTION_MASK;
|
||||
LOG_ERR("");
|
||||
LOG_ERR(" mcause: %ld, %s", mcause, cause_str(mcause));
|
||||
LOG_ERR(" mcause: %ld, %s", mcause, z_riscv_mcause_str(mcause));
|
||||
|
||||
#ifndef CONFIG_SOC_OPENISA_RV32M1
|
||||
unsigned long mtval;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue