This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Catching C++ Exceptions with GCC Arm None EABI

I've been struggling to get exceptions to work properly on a Cortex-M4 project with the Arm's GCC distribution. The throw seems to work successfully but not the catch.

class MyExc : public std::exception {
	virtual const char* what() const noexcept {
		return "My exception!";
} my_exc;

main(int argc, char* argv[])
  // Send a greeting to the trace device (skipped on Release).
  trace_puts("Hello ARM World!");

  // At this stage the system clock should have already been configured
  // at high speed.
  trace_printf("System clock: %u Hz\n", SystemCoreClock);

  try {
	  throw my_exc;
  } catch (...) {
	  trace_printf("Caught exception\n");


I've checked:

I've put together a minimal reproduction project at that builds with Eclipse Embedded CDT. I've been running that project in QEMU but the full project has the same problem on real hardware (an Infineon XMC4700). Output from building and running are in the build_log.txt and run_log.txt files.

If someone could point me to what I'm doing wrong in that project that would be really helpful. Thanks!

Originally posted at which I now see was the wrong place.