Handling stack overflows in embedded systems

后端 未结 4 1068
终归单人心
终归单人心 2021-02-04 15:35

In embedded software, how do you handle a stack overflow in a generic way? I come across some processor which does protect in hardware way like recent AMD processors. There are

4条回答
  •  清歌不尽
    2021-02-04 16:09

    A stack overflow occurs the stack memory is exhausted by too large of a call stack ? e.g. a recursive function too many levels deep.

    There are techniques to detect a stack overflow by placing known data after the stack so it could be detected if the stack grew too much and overwrote it.

    There are static source code analysis tools such as GnatStack, StackAnalyzer from AbsInt, and Bound-T which can be used to determine or make a guess at the maximum run-time stack-size.

提交回复
热议问题