@RAc, thanks for responding. To be clear, I am not looking to protect tasks from each other. I am merely looking for a way to detect the type of stack overflow that the current scheme does not detect. I don’t need to recover from a stack overflow, I just need to know that it happened, and by how much so that I can log it and shut down. With luck this should mean that a greater proportion of stack overflows are discovered during beta testing.
@richard-damon, thanks too. I do create the tasks statically. There is never a “good” area of memory for the stack to overflow into and we can’t afford the RAM needed to increase all the task stacks by 256 bytes or more. That’s why I was looking for a way to detect if a stack tries to overflow into a region of RAM that is being used for something, but that the task has no reason to write to. The ARM MPU supports regions of 32 bytes and higher powers of 2, so protecting just 256 or perhaps 512 bytes is entirely possible.