https://blog.japaric.io/stack-overflow-protection/ Describes how to put the stack at the bottom of RAM (with heap at the top) providing an automatic way to check overflow. Requires linking twice.