Skip to content

Commit

Permalink
arch: rp2040: Fix the initial stack pointer
Browse files Browse the repository at this point in the history
Summary:
- The NuttX for raspberrypi-pico boots via the boot_stage2 provided
  by the pico-sdk which sets the MSP at the end of the SRAM.
- However, the NuttX expects the MSP is set to the top of the idle stack.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with nsh, nshsram and smp configrations
masayuki2009 authored and xiaoxiang781216 committed Apr 25, 2021
1 parent 05f743a commit dc9223f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm/src/rp2040/rp2040_start.c
Original file line number Diff line number Diff line change
@@ -89,6 +89,10 @@ void __start(void)
uint32_t *dest;
int i;

/* Set MSP to the top of the IDLE stack */

__asm__ __volatile__ ("\tmsr msp, %0\n" :: "r" (g_idle_topstack));

if (up_cpu_index() != 0)
{
while (1)

0 comments on commit dc9223f

Please sign in to comment.