Skip to content

FreeRTOS: add ARMv8-M (Cortex-M33) NTZ thread context support#1957

Open
LukasLendvorsky wants to merge 1 commit intopyocd:mainfrom
LukasLendvorsky:main
Open

FreeRTOS: add ARMv8-M (Cortex-M33) NTZ thread context support#1957
LukasLendvorsky wants to merge 1 commit intopyocd:mainfrom
LukasLendvorsky:main

Conversation

@LukasLendvorsky
Copy link
Copy Markdown

Freertos stack decode doesn't work for The Cortex-M33, because its FreeRTOS port (portable/GCC/ARM_CM33_NTZ) uses a different PendSV stacking order than the Cortex-M4 port.

This adds support specifically for M33 without trust zone. Its written by Claude and I tested that it works well with my MCU. It will still break with trust zone and possibly with other freertos versions/configurations, but this is surely better than without any specific M33 support.

The Cortex-M33 NTZ FreeRTOS port (portable/GCC/ARM_CM33_NTZ) uses a
different PendSV stacking order than the Cortex-M4 port:

  M4:  [r4-r11, <exc_return>, <s16-s31>] [HW frame]
  M33: [psplim, exc_return, r4-r11, <s16-s31>] [HW frame]

This caused incorrect stack unwinding for non-current FreeRTOS threads
when debugging Cortex-M33 targets, as the register offset tables
assumed M4 stacking.

Add M33-specific register offset tables that account for the extra
psplim and exc_return words at the start of the software-saved frame,
and select them based on the core's architecture at runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant