cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX designer, CubeMX generation order?

Martin294
Associate III

Hello all,

I'll be starting a project in TouchGFX designer from an existing template, say STM32F469I DISCO. How does the code generation by the TouchGFX designer and CubeMX interact? Say when I add an UI element and regenerate the code in designer, does it respect the hardware changes done in  CubeMX? Or, if I do some changes in CubeMX (for example, add some GPIOs or an UART), does CubeMX generation preserve all TouchGFX code?

Is there an order I need to be aware of or can I mix both? What about custom code I added, will it be overwritten by TouchGFX designer code generation? I work a lot with CubeMX so I know how the system with the tags work.

What about CubeMX not used standalone, but from within STM32CubeIDE?

 

Thanks! Martin

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Martin294,

As you might have noticed in the board templates, TouchGFX is enabled as one of the Middleware and Software Packs (X-CUBE-TOUCHGFX) in the STM32CubeMX project. This means that TouchGFX is a sub-section of the main project.

This relationship allows the TouchGFX project to be developed separately, but when there are hardware changes, you need to regenerate code from STM32CubeMX to reflect the changes on TouchGFX. 

You can read more about this relationship here.

And, about the user code, there is a thorough explanation available at Code Structure.

I hope this helps you!

 

Mohammad MORADI
ST Software Developer | TouchGFX

View solution in original post

4 REPLIES 4

Hello @Martin294,

As you might have noticed in the board templates, TouchGFX is enabled as one of the Middleware and Software Packs (X-CUBE-TOUCHGFX) in the STM32CubeMX project. This means that TouchGFX is a sub-section of the main project.

This relationship allows the TouchGFX project to be developed separately, but when there are hardware changes, you need to regenerate code from STM32CubeMX to reflect the changes on TouchGFX. 

You can read more about this relationship here.

And, about the user code, there is a thorough explanation available at Code Structure.

I hope this helps you!

 

Mohammad MORADI
ST Software Developer | TouchGFX
Martin294
Associate III

Thanks @Mohammad MORADI ESFAHANIASL for the explanation.

One thing that's still not clear is what TouchGFX generator is doing exactly. The docs say that some files are generated only once (when you start an empty project). Does that mean that these files stay the same regardless of what I change in the GUI editor? Or, if I am doing any changes in the designer, does the generator alway produce up to date and correct code?

I already noticed that things get messy if you change screen names.

On a more practical side, can you have TouchGFX designer, CubeMX and CubeIDE open in parallel and generate/compile in any order without messing things up (in CubeIDE you have to F5 reload the project)? Or should one restart the tools after having done modification in another?

What about CubeMX in the CubeIDE? It seems this does not handle TouchGFX projects.

 

Thanks! Martin

Hello @Martin294,

When you create a Screen in TouchGFX Designer, TouchGFX generator creates required files and code for the screen in a folder with screen's name. The files that are generated once can be used by the user to implement their desired functionalities. That's why when you change the name of a screen, TouchGFX generator considers it as a new screen and generate new files and code corresponding with the new name. 

TouchGFX generator translates the GUI to C++ code that can be run on the hardware. So, when you add a new widget or change something related to graphics, TouchGFX generator will update the files that represent the code for displaying the graphics. However, the user code which is responsible for the behavior of the GUI stays intact.

And, you can have all three projects opened simultaneously. When you generate code from TouchGFX, STM32CubeIDE project will be updated, and when you generate from STM32CubeMX, both TouchGFX and STM32CubeIDE will be updated. 

Mohammad MORADI
ST Software Developer | TouchGFX
MM..1
Chief III

Your question require split into two maybe three project types.

A. Project created in TochGFX from template . In unziped structure exist valid ioc file for MX and valid .project for IDE. May exist more project for MDK , IAR or ...

B. Project created in MX (IDE or standalone) with added TochGFX software package

C. Project as A , but ioc dont exist or is only reference. Use it on MX corrupt project. 

 

Normal custom project is B and here you can have opened all and switch between in any order, but too exist exceptions. For example change RGB format in MX not change TGFX setup target etc. And for more fun every version make own specials...