Jump to content

SSD1306 HardFault bitmap


Rafael Zingler

Recommended Posts

Hello.

I was able to make SSD1306 work (logo is shown, display API is working well). However, when I try to open a image from Flash memory, I'm getting a HardFault, caused by FreeRTOS memory allocator (using FreeRTOS heap4.c). The debugger shows me that the failure happens on the second call of gdispImageAlloc function (image attached): in this second call, the size to be allocated is 2 bytes. Could this be leading to a memory corruption due to unalignment? It is also important to mention that it's my fisrt time dealing with monochrome BMP's on uGFX.

When I try with a 24 bit BMP, the program doesn't stuck, and both gdispImageOpenMemory and gdispImageDraw return SUCCESS, despite of no image data being shown on the display.

Any idea of what could be wrong?

Thanks in advance.

debug.PNG

Link to comment
Share on other sites

The gfxAlloc() function is simply a wrapper macro around pvPortMalloc() if you use the FreeRTOS GOS port.

Could you tell us which architecture/platform you're running on? If it's Cortex-M based system, we might be able to get a bit more information out of this by printing out register values etc. in the hardfault handler. FreeRTOS has a resource on this: https://www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.html

@inmarket Any insights into this?

Link to comment
Share on other sites

It is more likely it is caused by the sequence of Alloc's and Free's.

Another possibility is that there is a buffer overrun problem in the uGFX image code. This is also possible but unlikely as the uGFX image code is very well tested.

What strikes me as unusual here is an Alloc of just 2 bytes.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...