2024-02-23 07:34 AM
Hi all,
I've got a custom Assert Failure Handler ready to go, and I'm wondering if there's a good way to display assert information (file name/line number) after an assertion has happened in the MVP context? I'm thinking the only way to do this is to write directly to frame buffers? Is there HAL code available for the H7 (using custom hardware with an STM32H750 chip) to do something like this? Or is there a better solution available within TouchGFX?
Solved! Go to Solution.
2024-02-27 07:38 AM
I'm afraid this won't work for me. This solution needs to work even in cases where the TouchGFX Task is not initialized or locked up (i.e. in the Bootloader, in main before initialization, asserting in the MVP code, etc.) I've found some archaic looking examples of doing things with stuff like `UTIL_LCD...()` (see here: https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/NUCLEO-H743ZI/Examples/BSP/Src/lcd.c), but this is very ugly C code, and hard to read/understand. Perhaps it's my only option?
2024-02-27 06:21 AM
Hi @JAlbr.1,
About the assert, that depends on what your custom assert exactly do. If you can retrieve a string, then you will be able to print the informations.
You can print directly debug text to the framebuffer with :
LCD16DebugPrinter debugPrinter;
Application::setDebugPrinter(&debugPrinter);
Then use :
static void setDebugString(const char* string)
{
if (debugPrinter)
{
debugPrinter->setString(string);
invalidateDebugPrinterRegion();
}
}
You more information here :
Debugging | TouchGFX Documentation
I hope it helps,
Regards,
2024-02-27 07:38 AM
I'm afraid this won't work for me. This solution needs to work even in cases where the TouchGFX Task is not initialized or locked up (i.e. in the Bootloader, in main before initialization, asserting in the MVP code, etc.) I've found some archaic looking examples of doing things with stuff like `UTIL_LCD...()` (see here: https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/NUCLEO-H743ZI/Examples/BSP/Src/lcd.c), but this is very ugly C code, and hard to read/understand. Perhaps it's my only option?
2024-02-29 03:11 AM
Hello @JAlbr.1 ,
Unfortunately that's the best solution that TouchGFX offers, but I'll recommend you to ask share your issue on the STM32 Embedded Software Forum .
I hope that helps,
Regards,
2024-02-29 07:10 AM
Thanks for your help. Will definitely utilize the DebugPrinter in other ways, but for now I've adapted some of that example code for our project. It's not pretty, but it works.
2024-03-04 12:09 AM
Hello @JAlbr.1,
You are welcome, don't hesitate if you have any other questions.
Also I invite you to select a best answer, so the community can find the answer easily.
Regards,