2021-05-31 04:45 AM
I'm trying to build a Touch Application using the STML496G-DISC0 Board.
I try to create my project using the TouchGFX Designer App, selecting my Board and either a blank or the one matching Template (doesn't make a difference in this case). I can than Generate Code, Run Simulator or Run Target (which also works btw, the Application is successfully flashed onto my Board and i can see whatever i have made inside of the Designer).
However i want to open and edit the Project and write Code and Logic for the GUI with an IDE (STM Cube IDE in my Case). So after i Generate Code from the Touch GFX Designer i open the Project with STM CubeMX to generate a project with STM Cube IDE as target IDE and check the box with 'Generate Under Root'.
The first problem here is that CubeMX is showing me an Error in the Pinout & Configurations tab under Software Packs -> STM X-Cube TouchGFX (i'm using version 4.16.0, since 4.16.1 doesn't seem to be supported by TouchGFX Designer) -> TouchGFX Generator -> Display -> Interface is set to disp_fmc and marked with a pink 'X' (see image below) the only other Option i can choose for this is Custom, which will lead to the same compiling errors in CubeIDE.
Once i have generated my code from CubeMX and open the project in the Cube IDE and try to Build the project it fails with this output:
make -j8 all
arm-none-eabi-g++ -o "STM32L496G-DISCO.elf" @"objects.list" -l:libtouchgfx-float-abi-hard.a -mcpu=cortex-m4 -T"C:\TouchGFXProjects\L496_Test\STM32L496AGIX_FLASH.ld" --specs=nosys.specs -Wl,-Map="STM32L496G-DISCO.map" -Wl,--gc-sections -static -Wl,--start-group -l:libtouchgfx-float-abi-hard.a -Wl,--end-group -L"C:\TouchGFXProjects\L496_Test\Middlewares\ST\touchgfx\lib\core\cortex_m4f\gcc" -L"C:\TouchGFXProjects\L496_Test\Middlewares\ST\touchgfx\framework\include\touchgfx" -L"C:\TouchGFXProjects\L496_Test\Drivers" -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -lstdc++ -lsupc++ -Wl,--end-group
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: Drivers/BSP/Components/st7789h2/st7789h2.o: in function `ST7789H2_Init':
C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:119: undefined reference to `LCD_IO_Init'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:123: undefined reference to `LCD_IO_Delay'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:128: undefined reference to `LCD_IO_Delay'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:133: undefined reference to `LCD_IO_Delay'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: Drivers/BSP/Components/st7789h2/st7789h2.o: in function `ST7789H2_ReadID':
C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:344: undefined reference to `LCD_IO_Init'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: Drivers/BSP/Components/st7789h2/st7789h2.o: in function `ST7789H2_WriteReg':
C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:431: undefined reference to `LCD_IO_WriteReg'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:436: undefined reference to `LCD_IO_WriteData'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: Drivers/BSP/Components/st7789h2/st7789h2.o: in function `ST7789H2_ReadReg':
C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:448: undefined reference to `LCD_IO_WriteReg'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:451: undefined reference to `LCD_IO_ReadData'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:454: undefined reference to `LCD_IO_ReadData'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: Drivers/BSP/Components/st7789h2/st7789h2.o: in function `ST7789H2_DrawHLine':
C:/TouchGFXProjects/L496_Test/Debug/../Drivers/BSP/Components/st7789h2/st7789h2.c:525: undefined reference to `LCD_IO_WriteData'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: TouchGFX/target/TouchGFXHAL.o: in function `TouchGFXHAL::flushFrameBuffer(touchgfx::Rect const&)':
C:/TouchGFXProjects/L496_Test/Debug/../TouchGFX/target/TouchGFXHAL.cpp:183: undefined reference to `LCD_IO_ReadData'
C:\ST\STM32CubeIDE_1.6.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\bin\arm-none-eabi-ld.exe: TouchGFX/target/TouchGFXHAL.o: in function `TouchGFXHAL::copyFrameBufferBlockToLCD(touchgfx::Rect)':
C:/TouchGFXProjects/L496_Test/Debug/../TouchGFX/target/TouchGFXHAL.cpp:199: undefined reference to `LCD_IO_WriteMultipleData'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:135: STM32L496G-DISCO.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
all the LCD_IO_* functions are declared extern in the st7789h2.h, but aren't defined anywhere i can find.
Once i have Generated the Code from inside CubeMX 'Run Target' from TouchGFX Designer also fails with the same output as Cube IDE.
So how can i resolve this issue? I assume it's some problem with the Linker that doesn't know where to get the LCD_IO_* functions from, but i'm fairly new to the STM Boards and the Cube Apps, so i'm not too sure here.
2021-06-15 04:10 AM
Upon investing a lot more time into this, i'm still not able to build the project. I've tried using the new Versions of TouchGFX (4.16.1) and also the older Version of CubeMX (6.0.1, i'm using 6.2.1 usally), but same result.
Although i can now say that i was wrong and it's definitly not a linker issue, the LCD_IO functions are simply just defined inside st7789h2.h, but are never declared. From what i saw they are a part of the AL of X-CUBE-DISPLAY package, but that isn't available for the L496, so i don't think thats the Solution...
I know that the problem lies in the implementation of the Display drivers, but not having to worry about things like that was pretty much the main reason to choose a Discovery Board, also the L496-DISCO Application Template is mentioned as an example in the TouchGFX Documentation on how to implement drivers for a FMC Display Interface..
Also here are steps to reproduce the issue:
I could really need some help here please.
2021-06-15 11:51 PM
Hi,
Why do you really want to work with code generated "under source" ? In your project folder you already have a STM32CubeIDE folder containing a STM32CubeIDE project, there is no need to regenerate a project in another folder, which you will have to reconfigure (include paths, linker scripts, ...)
/Romain
2021-06-16 12:44 AM
Hey Romain,
thanks for the answer!
I hadn't tried skipping over CubeMX entirely, but that actually works, i can also inspect and edit all the source files in CubeIDE and build and flash the Project that way, although the LCD_IO functions still aren't declared anywhere, at least nowhere i can find. Also opening the Project in CubeIDE gives me C/C++ Indexer Errors, but they don't make the project build fail. All in all this works and would be a viable solution if the Project would be a Touch Application only, but since we'll need more Hardware Peripherals that need to be configured it's not really a viable option skipping over CubeMX entirely.
I also don't know if this is something i'm misunderstanding in the general Workflow of TouchGFX Projects and if CubeMX is just meant to not be used when working with a project generated from TouchGFX, but on the F4 discovery board i previously had that worked fine.
I mainly wanted to use the Project Template as a sort of guideline or example on how i can implement a TouchGFX driver for a display thats connected to the FMC connector, since in the end we'll use a different display (most likely based on an R61580 display driver) anyway, but not having a working Project to look at and also not being able to see what the LCD_IO functions do since they seem to handle basically the entire communication with the display was kind of a problem for me here, i have a general idea of how it could be done, but i wasn't able to figure out how the actual communication is supposed to work.
Anyway thanks again for the answar and i'd really appreciate if you would have some further information/guideline for me on this
Janek
2021-06-16 06:05 AM
Okay i think i found the problem with CubeMX. In the original Project created by TouchGFX has a section which declares all the LCD_IO functions as '__weak' at the bottom of `TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp`which will just be deleted by CubeMX as soon as you click Generate Code. Just copy-pasting those into the same file after generating the Code from CubeMX makes the project compilable and runnable again.
For the final Project i guess i'll just put these functions into some file which can than be included into TouchGFXHAL and the TouchGFX Display driver i'm writing.
2023-11-18 11:49 AM
hey there
I have the same problem
please someone help me to solve it
Error :
C:/ST/STM32CubeIDE_1.13.2/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.1.202309131626/tools/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find -l:libtouchgfx-float-abi-hard.a: No such file or directory
collect2.exe: error: ld returned 1 exit status
"make -j8 all" terminated with exit code 2. Build might be incomplete.
I also check the setting patch but I don't know what I have to do there