Skip to content

Commit 85fe8fc

Browse files
author
Jukka Laitinen
committed
arch/risc-v/src/common/riscv_initialstate.c: Fix stack pointer in coloration
The logical CPU index should be retrieved with up_cpu_index(); the riscv_mhartid() returns the actual hart id of the SoC. For mpfs target for example, NuttX can run on a single HART, for example on mhartid 2, but there is still just one logical CPU for the NuttX. Signed-off-by: Jukka Laitinen <[email protected]>
1 parent e96174d commit 85fe8fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/risc-v/src/common/riscv_initialstate.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void up_initial_state(struct tcb_s *tcb)
9797

9898
if (tcb->pid == IDLE_PROCESS_ID)
9999
{
100-
tcb->stack_alloc_ptr = (void *)g_cpux_idlestack(riscv_mhartid());
100+
tcb->stack_alloc_ptr = (void *)g_cpux_idlestack(up_cpu_index());
101101
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
102102
tcb->adj_stack_size = SMP_STACK_SIZE;
103103

0 commit comments

Comments
 (0)