cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX + TouchGFX 'Error during code generation'

Ade W
Associate II

Hi,

I'm trying to generate a new project for the STM32F469IDISCOVERY using CubeMX 5.2.0 and TouchGFX 4.10.0. All peripherals are initialized with the default modes. I use STM32CubeIDE as toolchain/IDE.

After enabling the Graphics framework using TouchGFX in 'middleware', I press the 'generate code' button and code is generated. After that I press 'execute' to execute the TouchGFX GUI. Right after TouchGFX is started, I get the following error code: 'Error during code generation'.

The following errors can be observed from the log:

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>'

No matter what I do in CubeMX, this error in TouchGFX is always the same. Is there something I do wrong? I just follow the CubeMX manual chapter 19.

Regards

John

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi @Ade W​,

The bug is with the project updater (run after "generate code" in the TouchGFX designer). You can disable it in your .touchgfx file and update your project manually with new generated source files. The script is incompatible with changes to the project format. The problem is still there in CubeIDE we've confirmed in another thread.

I'm raising the issue here.

/Martin

View solution in original post

12 REPLIES 12
Mon2
Senior III

Hi. Judging by the number of issues on this forum, guessing something is broken again with the tool integration.

Try the following,

1) launch TouchGFX 4.10.0 first. Select this same target -> create your GUI / Simulate and even test on the target hardware.

2) Once satisfied with above, select Generate Code -> manually browse the code folders and launch the tool of your choice. Just did the same procedure to launch the Keil based compiler.

3) Then build the project inside your preferred compiler. Keil compiled fine.

Personally have not yet tested with CubeIDE and have not launched the CubeMX for this procedure. There is no doubt that the CubeMX is breaking assorted projects.

Give it a try and post back.

Ade W
Associate II

Hi Mon2,

Thank you for your reply. It is indeed the integration of the tools. When I launch TouchGFX and select the target, then everything works fine. Loading it into STM32CubeIDE is not that strait forward apparently.

I would like to initialize SPI and I2C too. Therefore the integration of the two tools seemed perfect. I guess I will have to do this manually then.

Thanks for your input 😉

Cheers,

John

Mvill.17
Associate III

Hi everybody

I have the same problem with STM32F469 discovery board. I installed the new STM32CubeIde this morning, tried to build a new project including TouchGFX

and run the TouchGFX designer. The generation code from TouchGFX designer failed. The log achieved when trying to generate the code of a simple gui with TouchGFX is more or less the same as John.

Ade W
Associate II

This error occurs when (in CubeMX) the STM32CubeIDE or TrueStudio toolchains are chosen. I tested the above mentioned scenario, but then with EWARM V8 as toolchain, then it works fine. At least it creates a complete project error free.

Unfortunately this doesn't help me, because I don't have the IAR toolchain.

My conclusion is that there are bugs in these verions of CubeMX and/or TouchGFX, related to the Eclipse based IDE's.

Cheers,

John

Mvill.17
Associate III

Thank you for the reply.

Yes I can confirm you that the mistake is due to a misconfiguration of CUBEMX when using it with TrueStudio. I noticed that in the *.touchgfx

created by CUBEMX, the path of TrueStudio in PostGenerateCommand was wrong. I fixed it and I was able to generate a TouchGFX project.

Nevertheless the full project doesn't build correctly.

Anyway with STM32CubeIDE in which everything should be integrated, the path above is correct and errors are just those you mentioned earlier.

No way to find a workaround.

Bye

Martin KJELDSEN
Chief III

Hi @Ade W​,

The bug is with the project updater (run after "generate code" in the TouchGFX designer). You can disable it in your .touchgfx file and update your project manually with new generated source files. The script is incompatible with changes to the project format. The problem is still there in CubeIDE we've confirmed in another thread.

I'm raising the issue here.

/Martin

Ade W
Associate II

Hi Martin,

Thank you for your reply.

I will test your workaround as soon as possible.

Thanks for raising the issue.

Regards,

John

Martin KJELDSEN
Chief III

No problem! Hope we can get this issue fixed asap.

KMunj
Associate II

​I tried STM32CUBEIDE and 32F746NGDISCO. I enabled TouchGFX and do a build (without executing TouchGFX).

I get build errors as shown in attachment. I hope ST fixes these issues, since if you start with TouchGFX, you can do GUI very well. But I have lots of sensors and wireless connectivity.  It's not easy to integrate the rest of the system code with TouchGFX code. I had it working with SW4STM32 and CUBEMX4.0. But now moved to CUBEMX5.2 and it doesn't work any more with SW4STM32.

Thanks

Kiran