From 968dcc9fda930b1703bbd00689a497d16d271bad Mon Sep 17 00:00:00 2001 From: Dawid Niedzwiecki Date: Tue, 27 May 2025 13:42:43 +0200 Subject: [PATCH] arch: riscv: guard some funcions Guard some functions with ifdefs to avoid unused function compilation errors. Signed-off-by: Dawid Niedzwiecki --- arch/riscv/core/pmp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/core/pmp.c b/arch/riscv/core/pmp.c index e29c8abd76d..f6784d28201 100644 --- a/arch/riscv/core/pmp.c +++ b/arch/riscv/core/pmp.c @@ -204,6 +204,7 @@ static bool set_pmp_entry(unsigned int *index_p, uint8_t perm, return ok; } +#ifdef CONFIG_PMP_STACK_GUARD static inline bool set_pmp_mprv_catchall(unsigned int *index_p, unsigned long *pmp_addr, unsigned long *pmp_cfg, unsigned int index_limit) @@ -231,6 +232,7 @@ static inline bool set_pmp_mprv_catchall(unsigned int *index_p, return ok; } +#endif /* CONFIG_PMP_STACK_GUARD */ /** * @brief Write a range of PMP entries to corresponding PMP registers @@ -447,6 +449,7 @@ void z_riscv_pmp_init(void) /** * @Brief Initialize the per-thread PMP register copy with global values. */ +#if (defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING)) || defined(CONFIG_USERSPACE) static inline unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr, unsigned long *pmp_cfg, unsigned int index_limit) @@ -466,6 +469,7 @@ static inline unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr, return global_pmp_end_index; } +#endif #ifdef CONFIG_PMP_STACK_GUARD