raiden00pl opened a new pull request, #21404:
URL: https://github.com/apache/nuttx/pull/21404
## Summary
start() runs before .bss is cleared, so with function instrumentation it
reads stale instrument state and can call a handler left in SRAM by the
previous image, which locks up the core after a reset.
## Impact
Fixes a lockup at boot after a reset without power loss, when the previous
image used instrumentation.
## Testing
Hardware: NUCLEO-H533RE, `nucleo-h533re:nsh` (has `ARMV8M_STACKCHECK=y`).
Reproduction:
1. Flash and run `nucleo-h533re:nsh`.
2. Without power cycling the board, flash the same config with
`CONFIG_ARMV8M_STACKCHECK_BREAKPOINT=y` added, then reset.
This option makes `__stack_overflow_trap()` larger, so
`stack_check_enter()` ends up at a different address than in the first
image.
Without this patch the second image never boots: the core locks up in
`__cyg_profile_func_enter()`, called from `start()`. It calls the
`stack_check_enter()` address left in SRAM by the first image, which in the
new image points into the middle of `__stack_overflow_trap()`. Reproduced
5/5. If `g_magic` is zeroed over SWD before the reset, the second image
boots.
With this patch the second image boots 5/5.
Reflashing the same image, or an image where only applications changed,
boots with and without the patch: `stack_check_enter()` stays at the same
address, so the stale pointer still points to the right function.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]