cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 TouchGFX cannot find HAL library files

woozl
Associate II

I enabled a UART peripheral in my touchgfx project. When I ran the project in STM32CubeIDE, it gave an error saying the HAL_UART_Init function was undefined. When I checked

${ProjectDir}\Drivers\STM32H7xx_HAL_Driver\Src

There were no HAL library files, so I pasted them in the folder:

0693W00000KaifZQAR.png 

This allowed STM32CubeIDE to compile and run the program. However, when I try to "Run Target" in TouchGFX, it gives the following error:

        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_crc_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma2d.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hsem.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_ltdc.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_ltdc_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_qspi.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_sdram.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c
        Compiling Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_fmc.c
        Compiling CM7/Core/Src/main.c
        Compiling CM7/Core/Src/main_user.c
        Compiling CM7/Core/Src/freertos.c
        Compiling CM7/Core/Src/stm32h7xx_it.c
        Compiling CM7/Core/Src/stm32h7xx_hal_msp.c
        Compiling CM7/Core/Src/stm32h7xx_hal_timebase_tim.c
        Compiling Common/Src/system_stm32h7xx_dualcore_boot_cm4_cm7.c
        Compiling ASM gcc/startup_stm32h745xihx_cm7.s
        Linking CM7/TouchGFX/build/bin/target.elf
        CM7/TouchGFX/build/STM32H745I_DISCO/CM7/Core/Src/main.o: In function `MX_USART3_UART_Init':
        c:\TouchGFXProjects\UWBSurveying/CM7/Core/Src/main.c:471: undefined reference to `HAL_UART_Init'
        c:\TouchGFXProjects\UWBSurveying/CM7/Core/Src/main.c:475: undefined reference to `HAL_UARTEx_SetTxFifoThreshold'
        c:\TouchGFXProjects\UWBSurveying/CM7/Core/Src/main.c:479: undefined reference to `HAL_UARTEx_SetRxFifoThreshold'
        c:\TouchGFXProjects\UWBSurveying/CM7/Core/Src/main.c:483: undefined reference to `HAL_UARTEx_DisableFifoMode'
        collect2.exe: error: ld returned 1 exit status
        make[3]: *** [CM7/TouchGFX/build/bin/target.elf] Error 1
        gcc/makefile_cm7:372: recipe for target 'CM7/TouchGFX/build/bin/target.elf' failed
        make[3]: Leaving directory 'c:/TouchGFXProjects/UWBSurveying'
        make[2]: *** [generate_assets] Error 2
        gcc/makefile_cm7:368: recipe for target 'generate_assets' failed
        make[2]: Leaving directory 'c:/TouchGFXProjects/UWBSurveying'
        makefile_cm7:49: recipe for target 'all' failed
        make[1]: *** [all] Error 2
        make[1]: Leaving directory 'C:/TouchGFXProjects/UWBSurveying/gcc'
        ../../gcc/Makefile:10: recipe for target 'flash' failed
        make: *** [flash] Error 2
        Failed

It seems TouchGFX is looking for the library files in a different folder than STM32CubeIDE, because it isn't compiling stm32h7xx_hal_uart.c

Am I overlooking something? Thanks for the help.

1 REPLY 1
MM..1
Chief III

Your steps isnt standart.

  1. Paste files isnt way howto regenerate project , but can work ofcourse
  2. Run target in IDE use IDE CDT build, but run target on TGFX use makefile build, that isnt updated with new files.

Better is dont use run target on TGFX after IDE MX reconfig, or change commands in TGFX for run target...