cancel
Showing results for 
Search instead for 
Did you mean: 

Does CubeMX 5.0.0 Ready to Build a TouchGFX Project?

Zhi Pang
Associate III

I upgraded my CubeMX to 5.0.0 and installed F4 1.22.0 firmware recently.

So, I tried to use CubeMX build a TouchGFX Project that use TrueSTUDIO as IDE.Since I was successful run a STemWin Project as my custom F429IGx board graphic solution.

In order to enable TouchGFX middleware in CubeMX, I activated and configured FreeRTOS, CRC, LTDC, DMA2D, TIM7 and FMC-SDRAM1.All setting were the same with my previous STemWin project, excepted in GRAPHICS I used TouchGFX as Graphics Framework. And then I generated code.

1. When opened the project, there were *.c , *.cpp , *.h and *.hpp files. But in C/C++ Build - Tool Setting , neither C++ Compiler and C++ Linker existed. So if I build the project under this settings, I will get a link error say something like main function undefined. Because main function is in main.cpp file and wound't be compile by GCC like other cpp files.

2. So I converted the project to C++ project, by using File - New - Convert to a C/C++ Project (Adds C/C++ nature) method. Now the C++ Compiler showed up and C++ Linker replaced C Linker.I built the project again, but a ton of error message like head files couldn't find show up. I fixed by copied and changed include path from C compiler directories to C++ compiler.But things not go well,some directories in Project Resources Manager's Includes still in grey which implicate those directories did not exist in that location.

3. Then I use TouchGFX Designer to generated a simple project which is only contains a single screen of a text and a background image.After code generation, I put the entire folder in TrueSTUDIO project's root. Now the "Includes" didn't has grey directories any more.I dragged all the cpp files which is generated by TouchGFX Designer into TrueSTUDIO project path [Application-User-TouchGFX-generated|gui].Things going in here is a bit out of my ability, since I am new in TouchGFX and new in mixin C(GCC) and C++(G++) code together.

4. I tried out lots of combination of Assembler, C Complier, C++ Complier, C++ Linker settings which mention in TouchGFX website.I can't describe all of them.The best result I can get is all c files compile into *.o successfully by GCC and all C++ files compile into *.o successfully by G++, but when executed

arm-atollic-eabi-g++ -o LC-MC001.elf *.o ...

command,which as we know is linking, tons of error show up.

d:/program files (x86)/atollic/truestudio for stm32 9.0.0/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/bin/ld.exe: error: LC-MC001.elf uses VFP register arguments, Application\User\Core\main.o does not
d:/program files (x86)/atollic/truestudio for stm32 9.0.0/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/bin/ld.exe: failed to merge target specific data of file Application\User\Core\main.o
d:/program files (x86)/atollic/truestudio for stm32 9.0.0/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/bin/ld.exe: error: LC-MC001.elf uses VFP register arguments, Application\User\TouchGFX\generated\ApplicationFontProvider.o does not
d:/program files (x86)/atollic/truestudio for stm32 9.0.0/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/bin/ld.exe: failed to merge target specific data of file Application\User\TouchGFX\generated\ApplicationFontProvider.o
...

5. The last information about this I can find is related to floating point implementation? I already tried to switch all implementation to HW or SW the same time.But no luck.

UPDATE

6. I switch Assembler, C compiler, C++ compiler, C++ Linker floating point option to Hardware implementation.And remove -mfloat-abi=softfp parameter which is recommend by this article:

https://touchgfx.zendesk.com/hc/en-us/articles/206116381-Using-other-IDEs-with-TouchGFX

So, after that, all of the processor will have a united floating point setting. Then put SysTick_Handler function back into stm32f4xx_it.c file. Finally, my project build without any error for the first time.

7. I download the program in my board. Sadly, I got this.0690X000006CSy2QAG.jpg

 And my original design is below.

0690X000006CSy7QAG.jpg

I will keep you update if any further information.

Thanks for your reading, I know it's a very long problem description.😂

58 REPLIES 58

Thank you for that advice! I did that and everything compiled!

Now, during linking, I'm getting a large number of multiple definition errors:

make all 
Building target: Test_SW4STM33.elf
Invoking: MCU G++ Linker
arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-sp-d16 -L"C:\Users\Administrator\workspace\Test_SW4STM33\Middlewares\ST\TouchGFX\touchgfx\lib\core\cortex_m7\gcc"  -specs=nosys.specs -specs=nano.specs -T"../STM32F746NGHx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -fno-exceptions -fno-rtti -o "Test_SW4STM33.elf" @"objects.list"  -l:libtouchgfx-float-abi-hard.a -lm
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::initialize()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:18: multiple definition of `touchgfx::OSWrappers::initialize()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:18: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::takeFrameBufferSemaphore()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:30: multiple definition of `touchgfx::OSWrappers::takeFrameBufferSemaphore()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:25: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::giveFrameBufferSemaphore()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:36: multiple definition of `touchgfx::OSWrappers::giveFrameBufferSemaphore()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:29: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::tryTakeFrameBufferSemaphore()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:42: multiple definition of `touchgfx::OSWrappers::tryTakeFrameBufferSemaphore()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:34: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::giveFrameBufferSemaphoreFromISR()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:48: multiple definition of `touchgfx::OSWrappers::giveFrameBufferSemaphoreFromISR()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:39: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::signalVSync()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:54: multiple definition of `touchgfx::OSWrappers::signalVSync()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:49: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::waitForVSync()':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:63: multiple definition of `touchgfx::OSWrappers::waitForVSync()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:60: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::taskDelay(unsigned short)':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:74: multiple definition of `touchgfx::OSWrappers::taskDelay(unsigned short)'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:69: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `vApplicationStackOverflowHook':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:104: multiple definition of `vApplicationStackOverflowHook'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:91: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `vApplicationMallocFailedHook':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:110: multiple definition of `vApplicationMallocFailedHook'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:97: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `vApplicationIdleHook':
C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:115: multiple definition of `vApplicationIdleHook'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:\Users\Administrator\workspace\Test_SW4STM33\Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:102: first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [Test_SW4STM33.elf] Error 1
makefile:92: recipe for target 'Test_SW4STM33.elf' failed
 
15:55:40 Build Finished (took 1s.567ms)

Anyone have any ideas how to fix this?

Hi Nick, do you mind explaining briefly your workflow with workbench, cubemx and touchgfx? Thanks, I am stuck trying to get something to work on my 429 board. Thanks

  1. generate project in STM32CubeMx ver. 5.0 using most recent version of FW SDK library
  2. turn on TouchGfx in Multimedia section
  3. configure to proper resolution of active video frame
  4. configure RESET for LCD (please check with board layout what is the option need to be chosen on 429)
  5. name and generate code for STM32 Workbench using Generate Code button
  6. go back to TouchGfx configuration tab and set Designer executable location on your HDD, click execute button and wait for Designer to start
  7. use block with border just to create minimal content
  8. save project and generate code
  9. run simulator to make sure there are no issues with compilation (you could see Compilation/Build log using button in bottom right corner)
  10. you need to close Designer otherwise CubeMx won't respond to your actions (I think this is the bug 🙂 )
  11. generate code again using CubeMx and open project in STM32 Workbench
  12. you will need to exclude from build any SDL2*.cpp file: this belongs to simulator
  13. there is also emulator for touchscreen SDL2TouchController.cpp: exclude it from build

I think this is all.

I still have problem with getting nonGUI task to gain some time from scheduler: seems GUI task hogging it. I tried to increase defaultTask's priority but it did not help. I was thinking in meantime to make sure ChromART is activated but have not tried this yet. Just to make sure, I tried same project in IAR with same outcome: defaultTask is on hold.

make sure your linker has path to touchgfx library. I don;t remember doing this myself.

on other hand, it seems you have more than one object file with references to touchgfx library content

I've added this path for linker: ../Middlewares/ST/TouchGFX/touchgfx/lib/core/cortex_m7/gcc

Hi @PPiar​  and @Clark Sann​ 

If you use SW4STM32 of TrueSTUDIO as the toolchain/IDE.

Try to NOT select the "under the root" checkbox in CubeMX project manager.

Project structure use "Advanced".

Delete all files and directories you generated previously.

And generate code through CubeMX again.

I also post other information in this link

https://community.st.com/s/question/0D50X0000A4q22HSQQ/custom-pcb-using-tgfx

I hope that will give you some help.

PPiar
Associate II

full list of excluded from build files:

/Middlewares/ST/TouchGFX/touchgfx/framework/source/platform/driver/touch/SDL2TouchController.cpp

/Middlewares/ST/TouchGFX/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2_icon.cpp

/Middlewares/ST/TouchGFX/touchgfx/framework/source/platform/hal/simulator/sdl2/HALSDL2.cpp

/Middlewares/ST/TouchGFX/touchgfx/framework/source/platform/hal/simulator/sdl2/OSWrappers.cpp

/TouchGFX/simulator/*.*

/TouchGFX/simulator/msvs/*.*

/TouchGFX/simulator/gcc/*.*

I have no luck with TRUE studio so far.

BTW: how to disable interrupts while in step debugging mode? IAR has such menu option, I don't see anything like that in STM32, but I suspect there should be command to gdb/openocd/STLink, right?

I've figured how to make GUI task to let other tasks to work for me: I simply moved GRAPHICS_MainTask() call to separate task:

void StartGuiTask(void const * argument)
{
 
/* Graphic application */
  GRAPHICS_MainTask();
 
}

Thanks Nick. I will try that.