mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-24 10:58:09 +08:00
NuttX 12.12.0 added arm_initialize_stack(), which moves thread mode onto the process stack pointer whenever CONFIG_ARCH_INTERRUPTSTACK > 7. Every bootloader config qualifies, so the bootloader now reaches arch_do_jump() with CONTROL.SPSEL set, where previously it ran on the main stack. arch_do_jump() writes the MSP and branches, but never selects it. The application therefore starts on the bootloader's PSP while its own startup code initialises a stack pointer the CPU is not using. Boards booted far enough to reach NSH and start MAVLink, then hard faulted once the stale bootloader stack was overwritten, surfacing as an assertion in Idle_Task with no useful backtrace. Clear CONTROL.SPSEL so control passes on the stack the application expects. The i.MX RT bootloader performs the same jump and its configs also exceed the interrupt stack threshold, so fix both. Verified on CubePilot CubeOrange and Pixhawk 6C; the prebuilt bootloaders for both are regenerated, as the shipped binaries have the defect. Assisted-by: Claude:claude-opus-5 Signed-off-by: Julian Oes <julian@oes.ch>