cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Fault in Line Widget and Memory Allocation Error

SKim.2344
Associate II

I have two questions.

first:

When I add the Line widget to the container widget, a HardFault interrupt occurs.

I confirmed that adding the Line widget to the normal screen worked well.

What is the problem?

second:

When I allocate memory using the "new" operator, the system is showdown.

But I have no problem using the "malloc" function.

How can I solve this?

I have set the Heap memory size enough.

The development environment is as follows.

IDE: STM32CubeIde 1.1

TouchGFX 4.12.3

1 REPLY 1
Martin KJELDSEN
Chief III

With "Lines" and other canvas widgets you need to enable a cache. or "canvas buffer".

#include <touchgfx/canvas_widget_renderer/CanvasWidgetRenderer.hpp>
#define CANVAS_BUFFER_SIZE (3600)
 
static uint8_t canvasBuffer[CANVAS_BUFFER_SIZE];
CanvasWidgetRenderer::setupBuffer(canvasBuffer, CANVAS_BUFFER_SIZE);

/Martin