LVGL on STM32H750 with LTDC

Description

LVGL 9.3 on STM32H750 with LTDC Full Render Mode

What MCU/Processor/Board and compiler are you using?

STM32H750XBHX - CubeMx 1.16.0

What do you want to achieve?

I’m using 2.1" 480x480 Round LCD to make Custom Gauges to my Car.

What have you tried so far?

  • My project was working fine. I have QSPI flash, SDMMC working, LCD shows and SDRAM works without any problem. I can open files from SDCard with FatFS and show images on my LCD. All works without problem. Now I need to start making the GUI

  • I’ve downloaded lvgl-master (v9.3) from GITHUB

  • I’ve move the files to my project root directory.

  • renamed it only “lvgl”

  • renamed the file “lv_conf_template.h” to “lv_conf.h” and set “#if 1”

  • I’ve made a file “lvgl_port_display.c” in my Core/Src directory and necessary header file.

  • I’ve made the “lvgl” directory into PATH with Properties> C/C++ Build> Settings> MCU/MPU GCC Compiler> Include paths> Add Path “…/lvgl”

Code to reproduce

Add the relevant code snippets here.

#ifndef __LVGL_PORT_DISPLAY_H
#define __LVGL_PORT_DISPLAY_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#include "../lvgl/lvgl.h"

/*********************
 *      DEFINES
 *********************/

#define MY_DISP_HOR_RES    480
#define MY_DISP_VER_RES    480
#define MY_DISP_BUF_SIZE   MY_DISP_HOR_RES * MY_DISP_VER_RES * 2

/**********************
 * GLOBAL PROTOTYPES
 **********************/

void  lvgl_display_init (void);

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /* __LVGL_PORT_DISPLAY_H */

The code block(s) should be between ```c and ``` tags:

/*********************
 *      INCLUDES
 *********************/

#include "lvgl_port_display.h"
#include "main.h"
#include "ltdc.h"
#include "dma2d.h"
#include "sdram.h"

/**********************
 *  STATIC PROTOTYPES
 **********************/

static void disp_flush (lv_display_t *, const lv_area_t *, uint8_t *);

/**********************
 *  STATIC VARIABLES
 **********************/
static lv_display_t * disp;
//static lv_thread_sync_t sync;

#define LVGL_BUFFER_1_ADDR_AT_SDRAM	(SDRAM_BANK_ADDR)
#define LVGL_BUFFER_2_ADDR_AT_SDRAM	(SDRAM_BANK_ADDR + MY_DISP_BUF_SIZE)

/**********************
 *   GLOBAL FUNCTIONS
 **********************/

void lvgl_display_init (void)
{
	/* display initialization */

	disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);

	lv_display_set_buffers(disp, (void*) LVGL_BUFFER_1_ADDR_AT_SDRAM, (void*) LVGL_BUFFER_2_ADDR_AT_SDRAM, MY_DISP_BUF_SIZE, LV_DISPLAY_RENDER_MODE_DIRECT);
	HAL_LTDC_SetAddress(&hltdc, (uint32_t)LVGL_BUFFER_2_ADDR_AT_SDRAM, 0);	// start with the second buffer: LVGL will render into the first buffer

	lv_display_set_flush_cb(disp, disp_flush);
}

/**********************
 *   STATIC FUNCTIONS
 **********************/

static void disp_flush (lv_display_t * display,
            const lv_area_t * area,
            uint8_t * px_map)
{

	if (lv_display_flush_is_last(disp))
	{
		SCB_CleanInvalidateDCache();
		// wait for VSYNC to avoid tearing
		while (!(LTDC->CDSR & LTDC_CDSR_VSYNCS));
		// swap framebuffers (NOTE: LVGL will swap the buffers in the background, so here we can set the LCD framebuffer to the current LVGL buffer, which has been just completed)
		HAL_LTDC_SetAddress(&hltdc, (uint32_t)(lv_display_get_buf_active(disp)->data), 0);
	}
	lv_display_flush_ready(disp);

}

Screenshot and/or video

But When I Rebuild the code, I get those errors.

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./Core/Src/lvgl_port_display.o: in function `disp_flush’:

C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/lvgl_port_display.c:51: undefined reference to `lv_display_flush_is_last’

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/lvgl_port_display.c:57: undefined reference to `lv_display_get_buf_active’

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/lvgl_port_display.c:59: undefined reference to `lv_display_flush_ready’

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./Core/Src/lvgl_port_display.o: in function `lvgl_display_init’:

C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/lvgl_port_display.c:34: undefined reference to `lv_display_create’

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/lvgl_port_display.c:36: undefined reference to `lv_display_set_buffers’

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/lvgl_port_display.c:39: undefined reference to `lv_display_set_flush_cb’

C:/ST/STM32CubeIDE_1.16.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./Core/Src/stm32h7xx_it.o: in function `SysTick_Handler’:

C:/Users/emre2/STM32CubeIDE/workspace_1.16.0/RoundLCD-SDRAM/Debug/…/Core/Src/stm32h7xx_it.c:194: undefined reference to `lv_tick_inc’

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:96: RoundLCD-SDRAM.elf] Error 1

“make -j32 all” terminated with exit code 2. Build might be incomplete.

What did I forget ?