We recommend that upgrading to the the latest version of CubeMX (5.4) and the latest version of TouchGFX (4.12.3) in order to benefit from new features, bugfixes and integration improvements.
For a full overview on what's new in TouchGFX 4.12.3 please read Release of TouchGFX 4.12.3.
Developing graphic application on STM32
Enabling graphics on STM32 MCUs can be achieved by utilizing starting from CubeMX 5.0 and TouchGFX 4.10. The TouchGFX Designer also provides Application Templates which is pre-configured projects for STM32 Discovery/Evaluation boards.
- For fast graphical prototyping, it is recommended to use an pre-configured Application Template provided by TouchGFX Designer to start development.
- When multiple components are needed in the prototyping phase, including graphics, it is recommended to use CubeMX's mcu selector to start development.
Entry point: TouchGFX Designer
Selecting an Application Template in TouchGFX Designer provides an application which has been optimized for graphical performance and enabled all necessary peripherals for interacting with the graphical user interface. TouchGFX Designer provides a wide range of Discovery and Evaluation board of from both F4 and F7 MCU series.
These configuration each have:
- Image assets placed in external flash
- External SDRAM used for frame buffers
- Touch initialized
Selecting an Application Template and starting graphical development with TouchGFX Designer is explained in Getting Started: Tutorial 1.
These Application Templates are based on CubeMX and are a self contained project all required drivers to run the application on the target after compilation, if desired additional components can be configured using CubeMX by opening the .ioc file placed in the root of the project location.
Entry point: CubeMX
In CubeMX to start an Application Project can be done by either selecting the "MCU Selector", which is recommended when using custom hardware. For information on how to use CubeMX please refer to CubeMX's User Manual at st.com.
Adding TocuhGFX as a middleware to a CubeMX project requires the following components to be configured:
- FreeRTOS Middleware
- DMA2D IP Core
- CRC IP Core
- FMC SDRAM IP Core
- TIM IP Core
- LTDC IP
- DSIHOST IP Core (Only for DSI displays)
It is recommended to add components that is able to handle external memory mapped devices, eq. QUADSPI IP Core, this allows for storing and accessing assets in external flash as direct memory.
Use CubeMX to create a project please refer to the "Getting Started" section in CubeMX's User Manual found at st.com.
Known limitations for TouchGFX 4.10 and CubeMX 5.3
Using TouchGFX 4.10.0 with projects generated for STM32CubeIDE requires an update to the touchgfx-cli. The update improves the interopability between TouchGFX Designer and CubeIDE, to install please perform the following steps:
- Download touchgfx-cli gem version 4.10.2:
- In TouchGFX Environment 4.10 execute below line
gem install touchgfx-cli-4.10.2.gem
Executing TouchGFX from within CubeMX
The "Execute" action should only be performed once during CubeMX/TouchGFX project creation, this step instantiates a new empty TouchGFX application - resulting in existing work will be overwritten.
When execution TocuhGFX Designer from CubeMX a number of files are changed/overwritten, these are:
- Application.touchgfx - PostGenerateCommand is changed to:
"touchgfx update_project --project-file=../EWARM/MyApplication175.ewp --gui-group-name=Application/User/TouchGFX/gui --generated-group-name=Application/User/TouchGFX/generated"
- assets/texts/texts.xlsx - All translations and typographies are removed from the spreadsheet.
- gui/include/gui/common/FrontendApplication.hpp - Replaced with empty declaration of FrontendApplication class, user code is removed.
- gui/include/gui/common/FrontendHeap.hpp - Replaced with empty declaration of FrontendHeap class, user code is removed.
- gui/include/gui/model/Model.hpp - Replaced with empty declaration of Model class, user code is removed.
- gui/include/gui/model/ModelListener.hpp - Replaced with empty declaration of ModelListener class, user code is removed.
- gui/src/common/FrontendApplication.cpp -Replaced with empty implementation of FrontendApplication class functions, user code is removed.
- gui/src/model/Model.cpp - Replaced with empty implementation of Model class functions, user code is removed.
TouchGFX project generated by CubeMX does not provide MSVS project update, this can be added by adding the following to the post generate
"PostGenerateCommand": "touchgfx update_project --project-file=../EWARM/STM32F746G-DISCO.ewp",--project-file=../EWARM/STM32F746G-DISCO.ewp && touchgfx update_project --project-file=simulator/msvs/Application.vcxproj"
Creating a project with MDK-ARM as toolchain links TouchGFX library for both MDK-ARM and IAR8. Solutio: Remove the IAR TouchGFX library from the project.