cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Assert Info after user code in the MVP Has Asserted

JAlbr.1
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
JAlbr.1
Associate III

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?

View solution in original post

5 REPLIES 5
LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX
JAlbr.1
Associate III

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?

LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX

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. 

LouisB
ST Employee

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,

Louis BOUDO
ST Software Developer | TouchGFX