2024-08-07 01:00 AM
Hello ST Community,
I'm working on implementing C++ exceptions in my project. My setup includes an STM32H735 board and I'm using FreeRTOS. Here’s a snippet of my code that involves try and catch blocks:
extern "C" void myTaskFunction(void* pvParameters) noexcept {
try {
//throw exp seems work fine with debug
} catch (const std::exception& e) {
// print something that I cant see in console
}
// HARDFAULT
}
From my research, it seems that I need to disable the --specs=nano.specs option.
However, in the IDE, under Runtime library options, I have the following choices:
With the first option, the compilation fails because it can't find the asserts. I'm currently using the third option, but I encounter a hard fault when exiting the catch block.
I've tried modifying the makefile, but some script seems to re-include the specs after building.
I need guidance on how to avoid this error and properly handle exceptions. Any help would be greatly appreciated.
Thank you for your assistance.
Best regards,
Emo
2024-08-07 05:22 AM
Use Standard C, Standard C++ to enable exception handling. What asserts can it not find?
Exception handling is typically not used on embedded platforms as it vastly complicates the code.