To detect a stack overflow during run-time, using the C compiler options, you can use Stack overflow check.
To add a stack overflow check, you can use the following C compiler option:
--runtime (-r) :+/-stack s/S check for stack overflow
In the Eclipse IDE, you can enable this option via Project |Properties | C/C++ Build | Settings | C/C++ Compiler | Debugging | [x]Generate code for stack overflow checks.
For more information, see Stack overflow check in the TriCore user guide.