2025-09-29 8:28 PM
Hi,
Exceptions allowed, the program abruptly terminates:
The program reaches this point before it terminates:
The debugger is set (I guess) no to halt on exceptions:
Any hints? Did I forget to initialize something?
2025-10-01 12:08 AM
Hello,
Could you please share the STM32CubeIDE and GCC versions that you are using?
Also, is it possible to send us your example?
Thanks.
2025-10-01 7:47 AM
Hi
What is working for me, is to select the correct the Runtime Library in the STM32CubeIDE for your project, in my case with v1.18.1, nano_c_standard_cpp
You can have a look in my public github repository (https://github.com/fenardC/B-U585I-IOT2A_EMW) with project in C/C++ on STM32.
This example uses C++ exceptions and i hope it will help you.
Regards.
C.Fenard
2025-10-01 11:29 PM
Hi!
From a project compilation I got this:
The project is a very simple one. I was testing some C++20 features and specially exceptions for embedded systems, 'cause I want to write a blog post on this matter, but first I need to be sure that exceptions work altogether!
2025-10-02 12:24 AM
Hi!
Thank you for the advice, it worked!.
I've been thinking that exceptions for embedded systems weren't that bad... until I made them work.
In fact the nano_c_stardad_cpp variant let the exceptions to run as expected, with a high price to pay, though: massive FLASH usage:
No exceptions at all: 6KB
nano_c_reduced_cpp: 12 KB and doesn't work
nano_c_standard_cpp: 52KB (OMG!)
For chips with plenty of memory that can be feasible, but not for small size uC.
Such figures are correct?