Porting lvgl to STM32H7B3I-DK

Description

I am trying to port the LVGL demo to the STM32H7B3I-DK based on the existing demo on the lv_port_stm32f746_disco port (https://github.com/lvgl/lv_port_stm32f746_disco).

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

I am using the STM32H7B3I-DK and STMCUBEIDE.

What LVGL version are you using?

v8.0

What do you want to achieve?

I would like to port LVGL to STM32H7B3I-DK.

What have you tried so far?

I have downloaded the demo port for STM32F746_disco and replaced the necessary files e.g. BSP drivers for the STM32H7B3I-DK. I am basing my port on the STM32F746_disco as I believe it uses the same TFT LCD display. I have also edited enable and control pins in tft.c to match the pins on my STM32H7B3I-DK board. However, I am currently getting some errors in tft.c and touchscreen.c (I have posted the errors below) and I am unsure how to solve these issues as I am not familiar with porting. What do the errors mean and could someone provide me with some pointers on how to fix the issue?

I have read the LVGL porting guide but I’m confused. Are tft.c and touchscreen.c the display driver configuration files mentioned in ‘display interface’ of the porting guide?

Thank you for your help.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

make -j12 all 
arm-none-eabi-gcc "../hal_stm_lvgl/touchpad/touchpad.c" -mcpu=cortex-m7 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32H7B3xxQ -c -I../Core/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"hal_stm_lvgl/touchpad/touchpad.d" -MT"hal_stm_lvgl/touchpad/touchpad.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "hal_stm_lvgl/touchpad/touchpad.o"
arm-none-eabi-gcc "../hal_stm_lvgl/tft/tft.c" -mcpu=cortex-m7 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32H7B3xxQ -c -I../Core/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"hal_stm_lvgl/tft/tft.d" -MT"hal_stm_lvgl/tft/tft.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "hal_stm_lvgl/tft/tft.o"
arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m7 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32H7B3xxQ -c -I../Core/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc -I../Drivers/STM32H7xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
../hal_stm_lvgl/touchpad/touchpad.c:31:8: error: unknown type name 'TS_StateTypeDef'
   31 | static TS_StateTypeDef  TS_State;
      |        ^~~~~~~~~~~~~~~
In file included from ../hal_stm_lvgl/touchpad/touchpad.c:9:
../hal_stm_lvgl/touchpad/touchpad.c: In function 'touchpad_init':
../hal_stm_lvgl/touchpad/../tft/tft.h:20:21: warning: passing argument 2 of 'BSP_TS_Init' makes pointer from integer without a cast [-Wint-conversion]
   20 | #define TFT_VER_RES 272
      |                     ^~~
      |                     |
      |                     int
../hal_stm_lvgl/touchpad/touchpad.c:46:30: note: in expansion of macro 'TFT_VER_RES'
   46 |     BSP_TS_Init(TFT_HOR_RES, TFT_VER_RES);
      |                              ^~~~~~~~~~~
In file included from ../hal_stm_lvgl/touchpad/touchpad.c:13:
../hal_stm_lvgl/touchpad/../../Drivers/BSP/STM32H7B3I-DK/stm32h7b3i_discovery_ts.h:184:51: note: expected 'TS_Init_t *' {aka 'struct <anonymous> *'} but argument is of type 'int'
  184 | int32_t BSP_TS_Init(uint32_t Instance, TS_Init_t *TS_Init);
      |                                        ~~~~~~~~~~~^~~~~~~
../hal_stm_lvgl/touchpad/touchpad.c: In function 'touchpad_read':
../hal_stm_lvgl/touchpad/touchpad.c:74:21: warning: passing argument 1 of 'BSP_TS_GetState' makes integer from pointer without a cast [-Wint-conversion]
   74 |     BSP_TS_GetState(&TS_State);
      |                     ^~~~~~~~~
      |                     |
      |                     int *
../hal_stm_lvgl/tft/tft.c: In function 'LCD_ClockConfig':
In file included from ../hal_stm_lvgl/touchpad/touchpad.c:13:
../hal_stm_lvgl/touchpad/../../Drivers/BSP/STM32H7B3I-DK/stm32h7b3i_discovery_ts.h:188:34: note: expected 'uint32_t' {aka 'long unsigned int'} but argument is of type 'int *'
  188 | int32_t BSP_TS_GetState(uint32_t Instance, TS_State_t *TS_State);
      |                         ~~~~~~~~~^~~~~~~~
../hal_stm_lvgl/tft/tft.c:302:27: error: 'RCC_PeriphCLKInitTypeDef' {aka 'struct <anonymous>'} has no member named 'PLLSAI'
  302 |     periph_clk_init_struct.PLLSAI.PLLSAIN = 192;
      |                           ^
../hal_stm_lvgl/touchpad/touchpad.c:74:5: error: too few arguments to function 'BSP_TS_GetState'
   74 |     BSP_TS_GetState(&TS_State);
      |     ^~~~~~~~~~~~~~~
In file included from ../hal_stm_lvgl/touchpad/touchpad.c:13:
../hal_stm_lvgl/touchpad/../../Drivers/BSP/STM32H7B3I-DK/stm32h7b3i_discovery_ts.h:188:9: note: declared here
  188 | int32_t BSP_TS_GetState(uint32_t Instance, TS_State_t *TS_State);
      |         ^~~~~~~~~~~~~~~
../hal_stm_lvgl/tft/tft.c:303:27: error: 'RCC_PeriphCLKInitTypeDef' {aka 'struct <anonymous>'} has no member named 'PLLSAI'
  303 |     periph_clk_init_struct.PLLSAI.PLLSAIR = RK043FN48H_FREQUENCY_DIVIDER;
      |                           ^
../hal_stm_lvgl/touchpad/touchpad.c:75:16: error: request for member 'touchDetected' in something not a structure or union
   75 |     if(TS_State.touchDetected) {
      |                ^
../hal_stm_lvgl/tft/tft.c:304:27: error: 'RCC_PeriphCLKInitTypeDef' {aka 'struct <anonymous>'} has no member named 'PLLSAIDivR'
  304 |     periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
      |                           ^
../hal_stm_lvgl/touchpad/touchpad.c:76:37: error: request for member 'touchX' in something not a structure or union
   76 |             data->point.x = TS_State.touchX[0];
      |                                     ^
../hal_stm_lvgl/touchpad/touchpad.c:77:37: error: request for member 'touchY' in something not a structure or union
   77 |             data->point.y = TS_State.touchY[0];
      |                                     ^
make: *** [hal_stm_lvgl/touchpad/subdir.mk:19: hal_stm_lvgl/touchpad/touchpad.o] Error 1
make: *** Waiting for unfinished jobs....
../hal_stm_lvgl/tft/tft.c:304:41: error: 'RCC_PLLSAIDIVR_4' undeclared (first use in this function); did you mean 'RCC_PLLDIV_4'?
  304 |     periph_clk_init_struct.PLLSAIDivR = RCC_PLLSAIDIVR_4;
      |                                         ^~~~~~~~~~~~~~~~
      |                                         RCC_PLLDIV_4
../hal_stm_lvgl/tft/tft.c:304:41: note: each undeclared identifier is reported only once for each function it appears in
../hal_stm_lvgl/tft/tft.c: In function 'LCD_Init':
../hal_stm_lvgl/tft/tft.c:359:5: error: too few arguments to function 'BSP_SDRAM_Init'
  359 |     BSP_SDRAM_Init();
      |     ^~~~~~~~~~~~~~
In file included from ../hal_stm_lvgl/tft/tft.c:17:
../hal_stm_lvgl/tft/../../Drivers/BSP/STM32H7B3I-DK/stm32h7b3i_discovery_sdram.h:104:9: note: declared here
  104 | int32_t BSP_SDRAM_Init(uint32_t Instance);
      |         ^~~~~~~~~~~~~~
../hal_stm_lvgl/tft/tft.c:360:5: warning: implicit declaration of function 'HAL_EnableFMCMemorySwapping' [-Wimplicit-function-declaration]
  360 |     HAL_EnableFMCMemorySwapping();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../hal_stm_lvgl/tft/tft.c: In function 'DMA_Config':
../hal_stm_lvgl/tft/tft.c:416:19: error: 'DMA_InitTypeDef' {aka 'struct <anonymous>'} has no member named 'Channel'
  416 |     DmaHandle.Init.Channel = CPY_BUF_DMA_CHANNEL;                   /* DMA_CHANNEL_0                    */
      |                   ^
make: *** [hal_stm_lvgl/tft/subdir.mk:19: hal_stm_lvgl/tft/tft.o] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.

Link to my project files

Here is the link to the project:https://github.com/fastworld555/lvgl_stm32h7b3i-dk_port

Update 1:

What I have Done?

I have updated my project and solved all the compilation errors by editing the values according to the hardware of the stm32h7b3i-dk. I configured the LTDC pin configuration and clock configuration by copying from “stm32h7xx_hal_msp.c” I also realised that some of the functions for the BSP driver in “touchscreen.c” are different for the stm32h7b3i-dk, so I changed them accordingly. However, I am still unable to get the demo widgets to display anything. All I see is a white screen. Could someone kindly help guide me in the right direction? Thank you for your help!