Skip to main content
SKim.2344
Associate
Mar 19, 2020 2:10 AM UTC
Question

Hard Fault in Line Widget and Memory Allocation Error

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

This topic has been closed for replies.

1 reply

Martin KJELDSEN
Principal III
Mar 31, 2020 3:02 PM UTC

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