AnsweredAssumed Answered

using c++ exceptions with freertos

Question asked by Markus Klemm on Sep 13, 2016
Latest reply on Jan 3, 2017 by Markus Klemm

I'm using a ARM Cortex M4 with freertos using freescales freedom Kinetis IDE (gnu arm toolchain). Problem is that

try {
throw std::runtime_error("wut");
} catch (...) {
results in a halted CPU and code after the try or (when some is added) in the catch handler is not executed.

I ASSUMED that this results in an SVC interrupt, I'm sorry I got that wrong, Freertos tricked me into this, because when I throw something it halts in DefaultISR.

The throw indeeds jump to **__cxa_throw then from there to ___Unwind_RaiseException __gnu_Unwind_RaiseException __cxa_begin_catch>
So it looks like `std::terminate` is called, but the catch all block should not allow this. Or is my assumption wrong and this behavior is because the gcc C++ runtime exception support is a stub which always calls terminate?!


we are using
Kinetis Design Studio 3.2.0. with the
GNU ARM C/C++ Cross Compiler
for our