cancel
Showing results for 
Search instead for 
Did you mean: 

Generate code from command-line

EmbDev
Senior

In my project I use TouchGFX for an STM32 microcontroller.
After visually changing the view, I need to generate the updated viewBase classes in the TouchGFX Designer.

Now I want to automate this process on my build-server. I am able to generate the files for the assets, but so far I am unable to generate these ..viewBase classes from the command line.

So I saw an old question https://community.st.com/t5/stm32-mcus-touch-gfx-and-gui/how-to-generate-source-code-cpp-hpp-for-touchgfx-on-linux/td-p/315134 which is no longer relevant as tgfx.exe does no longer exist.

With the current version there is a touchgfx executable which can be called with update:

 

touchgfx update

 

If I call this from the main directory of my project, nothing really seems to happen?
For now added all the generated (viewbase classes) code to git, but this is really undesirable.

Can someone explain to me how I can generate the updated files from a project.touchgfx file from the command line?

@Martin KJELDSEN do you know the updated command that should be use?

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @EmbDev ,

You can regenerate code from your command-line using this command:

C:/TouchGFX/4.23.0/designer/tgfx.exe generate -p [path to your project]/YourProject.touchgfx

You can also compile the application and flash the board using TouchGFX Environment. There are more information about the process here, and about the first command here.

 

I hope this helps you

Mohammad MORADI
ST Software Developer | TouchGFX

View solution in original post

5 REPLIES 5

Hello @EmbDev ,

You can regenerate code from your command-line using this command:

C:/TouchGFX/4.23.0/designer/tgfx.exe generate -p [path to your project]/YourProject.touchgfx

You can also compile the application and flash the board using TouchGFX Environment. There are more information about the process here, and about the first command here.

 

I hope this helps you

Mohammad MORADI
ST Software Developer | TouchGFX
EmbDev
Senior

Thanks a lot @Mohammad MORADI ESFAHANIASL so the tgfx executable is still there after all! Somehow I missed it. With this executable I am indeed able to generate the *viewBase sources 😁.

However I noticed that the generation is quite slow, and saw that everytime I run the tgfx generate command the TouchGfx sources of the middleware are updated/regenerated and a touchgfx_backup folder appears. This does not happen when I generate the sources from the designer.

When I add the flags --no-designer -v  to the command, the *viewBase files are no longer updated. I don't really see any other options with this command that could solve this.

What is the trigger of this Middleware sources regeneration? Or how can I stop this from happening? 

Hello again,
Yes, I can see that this folder is getting created. This should only happen when you change the TouchGFX version of your project. Sorry for this issue, we will try to fix it as soon as possible.

Mohammad MORADI
ST Software Developer | TouchGFX

Thanks for the quick response, will wait for the next release.

You are very welcome

Mohammad MORADI
ST Software Developer | TouchGFX