cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE 1.0.0 + TouchGFX 4.10.0: Working project inside (STM32F746G-DISCO)

Martin KJELDSEN
Chief III

Hello everyone,

Due to an increasing number of people having issues with CubeIDE and TouchGFX Integration i'm attaching a working project for STM32F746G-DISCO for your inspection - There were a good number of things to do before it worked, only some of which i highlighted in my quick-guide and even some of those steps were a bit ambiguous and could be executed in different ways.

I've written down what i've done to get this project working and i will use this in planning a video tutorial - It has to be somewhat official, so i can't simply start up the screencast and start talking. But i'll keep you updated.

/Martin

84 REPLIES 84

Thank you very much for the replies. I appreciate your support.

I am experiencing some strange behavior within the project window now. Yesterday I was able to set the "simulator" folder to be "Exclude resource from build". I know it took effect because the folder was grayed out in the project viewer.

Today when doing a build, I am getting the same error I was before:

===============================================

/Middlewares/ST/TouchGFX/touchgfx/framework/include/platform/hal/simulator/sdl2/HALSDL2.hpp:22:10: fatal error: SDL2/SDL_video.h: No such file or directory

===============================================

And when I looked at the simulator folder it is no longer grayed out, nor can I change it. In fact, there is a key icon above the folder in the viewer:

0690X000008iCpCQAU.png

I tried to deselect "Exclude resource from build" and select it again, and am not able to exclude it any more. I will start over with a fresh project and see if that helps. But do you have any ideas in the meantime why the folder now appears to be locked from excluding it?

Update: I just noticed that you stated up above that even though the tool can indicate that it not excluded it actually is, so maybe you already answered this question.

I created a new project and was able to select the simulator folder and "Exclude resource build". However I still get the fatal error on the file:

===============================

/Middlewares/ST/TouchGFX/touchgfx/framework/include/platform/hal/simulator/sdl2/HALSDL2.hpp:22:10: fatal error: SDL2/SDL_video.h: No such file or directory

===============================

Martin,

I tried an experiment to see if I can get your example to do this same thing. I assume your configuration is correct and wanted to see if I can make it fail when going through these steps. I created a new workspace and imported your example project (f746g-disco-test). I was able to successfully import the project and debug it (via Run > Debug Configurations > STM32 MCU Debugging > f746g-disco-test.elf). My Discovery board loaded up with your code of a red and green screen, each with a button on it causing it to switch between screens.

Because I need to utilize more quad SPI flash, I opened up CubeMX by double-clicking the file "f746g-disco-test.ioc" and set the QUADSPI configuration as the following link describes:

https://touchgfx.zendesk.com/hc/en-us/articles/360019884752-Configuring-STM32F746G-DISCO

0690X000008iDWkQAM.png

Then I attempted to run the debugger again and I got the following fatal error on the build:

===============================

/Middlewares/ST/TouchGFX/touchgfx/framework/include/platform/hal/simulator/sdl2/HALSDL2.hpp:22:10: fatal error: SDL2/SDL_video.h: No such file or directory

===============================

When I checked the simulator directory it was selected to "Exclude resource from build", but I could no longer set it to be excluded from the build.

I set the quad spi flash to the previous settings but this did not resolve the issue.

It appears that whenever the configuration is edited, something in the project files changes to cause this. I differenced the files and found a number of things that had been changed. I copied them from your original project to my project and still had an issue. There was a missing file called OSWrappers_cmsis.cpp (located Middlewares/ST/TouchGFX/touchgfx/os) . Once I copied that file from your project to my project, the code compiled.

I copied the previous project files back over into my project and it worked fine, so I do suspect something is being messed up when the CubeMX is edited.

In fact, I do not believe that the configuration file needs to be edited to cause this issue. I created a new project based on your example. Opened the configurator by double-clicking the file "f746g-disco-test.ioc" then doing a CubeMX "generate" without making any changes. After this point, the project will not build and I am not able to exclude the simulator directory ( i get the fatal error on SDL_video.h).

​The same procedure happened to me too!

If I install the example for the first time everything is fine - also changing the touchgfx screens and some behavior of buttons but without generating any code, only saving the changes, compilation is without errors. 

After leaving .ioc and a new generate from inside of CubeIDE there is the same mistake like you described above - simulator is activated again...

Me too.

Through much trial and error, I have found that after I do a CubeMX generate and then use a text difference tool to compare the ".cproject" file between Martin's original project and my project. I can get the new project to compile if I copy over the following lines (line numbers based on original project file): 27, 32, 33, 34, 167, 180, and 184. Then I also need to copy over the file OSWrappers_cmissis.cpp (located in Middlewares/ST/TouchGFX/touchgfx/os) which disappears after an attempt to Build after a code generate..

Maybe this will help the STM32CubeIDE software engineers pinpoint what is happening to the project when generating CubeMX code prior to a build?

Hi guys,

If you regenerate code from CubeIDE/CubeMX you will lose all your changes (excludes), so thats probably what's happening. The reason for the video is to try to correct bugs/inconsistensies in CubeIDE. I suggest you version control using git and revert the changes that CubeIDE makes to changes you've made (to make things work).

/Martin

jea74
Associate III

Hello Martin,

Your example works fine but It does not work anymore if I do any modification in the Designer !? If I try to (re) generate the code, I get this error:

C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx/generators/sw4_project_updater.rb:74:in `block in ensure_source_nodes': undefined method `add_child' for nil:NilClass (NoMethodError)

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx/generators/sw4_project_updater.rb:62:in `each'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx/generators/sw4_project_updater.rb:62:in `ensure_source_nodes'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx/generators/sw4_project_updater.rb:24:in `run'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx/generators/update_project.rb:44:in `run'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx/cli/inside.rb:45:in `update_project'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx.rb:16:in `<module:CLI>'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx.rb:9:in `<module:TouchGFX>'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/lib/touchgfx.rb:8:in `<top (required)>'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/lib/ruby/gems/1.9.1/gems/touchgfx-cli-4.10.0/bin/touchgfx:6:in `<top (required)>'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/bin/touchgfx:22:in `load'

from C:/TouchGFX/4.10.0/env/MinGW/msys/1.0/Ruby193/bin/touchgfx:22:in `<main>'

and of course in Cube I also get errors:

Src/BoardConfiguration.o: In function `FrontendApplication::handleTickEvent()':

C:/Users/jea/ws_1.0.0/SPIREX/Debug/../TouchGFX/gui/include/gui/common/FrontendApplication.hpp:18: undefined reference to `Model::tick()'

Src/BoardConfiguration.o: In function `FrontendHeapBase::gotoStartScreen(FrontendApplication&)':

C:/Users/jea/ws_1.0.0/SPIREX/Debug/../TouchGFX/generated/gui_generated/include/gui_generated/common/FrontendHeapBase.hpp:75: undefined reference to `FrontendApplicationBase::gotoScreen1ScreenNoTransition()'

Src/BoardConfiguration.o: In function `FrontendHeap::FrontendHeap()':

C:/Users/jea/ws_1.0.0/SPIREX/Debug/../TouchGFX/gui/include/gui/common/FrontendHeap.hpp:68: undefined reference to `FrontendApplication::FrontendApplication(Model&, FrontendHeap&)'

C:/Users/jea/ws_1.0.0/SPIREX/Debug/../TouchGFX/gui/include/gui/common/FrontendHeap.hpp:68: undefined reference to `Model::Model()'

Src/BoardConfiguration.o:(.data._ZL12fontProvider+0x0): undefined reference to `vtable for ApplicationFontProvider'

I have also to re-exclude the simulator stuff folders and files...

Any ideas ?

Thanks in advance,

J.

jea74
Associate III

Finally got it working... have to re-exclude folders and files *each time* the code is regenerated ! And also re-edit the .touchgfx file

& relaunch code generation several times !! Really time consuming ... Hope a better integration in CubeIDE will arrive soon.

But I still cannot update a text value from the default task in main.cpp ?! Is there somewhere an example of this ? Looks like it has to do with Model::tick() ?

It is not clear if I need to declare to field I want to update with <d> or not ? Even with a default value set in Designer the field is not visible !?

Hi @jea74​,

You must remove the "post generate" command in the .touchgfx project file. It's trying to execute sw4_project_updater.rb but it does not know CubeIDE. It's a bug that has been reported.

/Martin