What is the implementation of CONFIG_HW_STACK_PROTECTION on the nrf52840, using Zephyr (ncs 1.9.2)?
How does it differ from using CONFIG_STACK_SENTINEL?
What is the implementation of CONFIG_HW_STACK_PROTECTION on the nrf52840, using Zephyr (ncs 1.9.2)?
How does it differ from using CONFIG_STACK_SENTINEL?
Hello,
There is no hw based stack checking in Cortex M4 based IC, so you should do it through MPU instead. In ARM v8-M platforms, CONFIG_HW_STACK_PROTECTION is enabled by default for stack checking, instead of MPU. Hence we need to change the default to MPU, for which we can manually enable another config, i.e. the CONFIG_MPU_STACK_GUARD.
Kind Regards,
Abhijith
Hello,
There is no hw based stack checking in Cortex M4 based IC, so you should do it through MPU instead. In ARM v8-M platforms, CONFIG_HW_STACK_PROTECTION is enabled by default for stack checking, instead of MPU. Hence we need to change the default to MPU, for which we can manually enable another config, i.e. the CONFIG_MPU_STACK_GUARD.
Kind Regards,
Abhijith
So the CONFIG_MPU_STACK_GUARD configured should trigger an ASSERT immediately when a stack overflow occurs?
how does it exactly use the MPU in order to do this?
is there additional memory utilization in order to use this feature?
I did not exactly understand what did you mean by: "In ARM v8-M platforms, CONFIG_HW_STACK_PROTECTION is enabled by default for stack checking, instead of MPU. Hence we need to change the default to MPU,". I see that in ncs for nrf52840 CONFIG_HW_STACK_PROTECTION is set to y and CONFIG_MPU_STACK_GUARD is not set.