diff --git a/arch/risc-v/src/common/riscv_common_memorymap.h b/arch/risc-v/src/common/riscv_common_memorymap.h index efe3e050d63..f6352fb48e9 100644 --- a/arch/risc-v/src/common/riscv_common_memorymap.h +++ b/arch/risc-v/src/common/riscv_common_memorymap.h @@ -68,7 +68,7 @@ EXTERN uintptr_t g_idle_topstack; /* Address of per-cpu idle stack base */ #define g_cpux_idlestack(cpuid) \ - (g_idle_topstack - SMP_STACK_SIZE * ((cpuid) + 1)) + (g_idle_topstack - SMP_STACK_SIZE * (CONFIG_SMP_NCPUS - (cpuid))) /* Address of the saved user stack pointer */