Skip to content

Difference between CONFIG_HW_STACK_PROTECTION and CONFIG_STACK_SENTINEL #28866

Answered by ioannisg
XavierChapron asked this question in Q&A
Discussion options

You must be logged in to vote

The HW stack protection relies on HW-based mechanisms to detect thread stack overflows. Examples:

  • In ARMv8-M, HW_STACK_PROTECTION makes use of the Cortex-M stack pointer limit registers, which trigger a Usage fault if stack pointers descent below their values.
  • In ARMv7-M, HW_STACK_PROTECTION is implemented with a read-only MPU region guard, so a MemManage fault is triggered when a thread attempts to push into the guard area.

Stack sentinel is supposed to be used when the CPU does not have a native HW stack protection mechanism. It marks a "guard" area at the end of the thread stack with a given pattern. Each time a thread switches-out, -in or during IRQ exit, the area is checked whether…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by XavierChapron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
platform: nRF Nordic nRFx
2 participants