Logo
Sign in
  1. TouchGFX
  2. Knowledge Base
  3. CubeMX

Getting Started with CubeMX and TouchGFX

Enabling graphics on STM32 MCUs can now also be achieved by utilizing CubeMX 5.0.0 and TouchGFX 4.10.0. The TouchGFX Designer still provides Application Templates based CubeMX 5.0.0 in addition to STM32Cube only projects.

  • 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 board selector to start development.CubeMXTouchGFXv2.png

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 vide range of Discovery and Evaluation board of from both F4 and F7 MCU series.

Currently three Application Templates are based on project generated by CubeMX 5.0.0,
these are: STM32F746G-DISCOVERY, STM32F7508-DISCOVERY, and STM32F769I-DISCOVERY.

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 5.0.0 by opening the .ioc file placed in the root of the project location. 

Tree structure of CubeMX generated project.

  • When configuring a project provided by TouchGFX Designer in CubeMX, please read the "Known Limitations section" before proceeding.

 

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 or by using the "Board Selector" for ST Discovery or Evaluation boards. When using the "Board Selector" the CubeMX project is pre configured to match the current MCU on the board and has the minimal components configured to start developing graphical applications. For information on how to use CubeMX please refer to CubeMX's User Manual at st.com.

Board Selector

Using the board selector in CubeMX give the option to start with a Discovery- or Evaluation-board, starting a project this way allows the project to have pre-configured components.

STM32CubeMX C code generation covers only initialization code for peripherals and middleware components that use the drivers included in STM32Cube embedded software packages. The code generation of some peripherals and middleware components is not yet supported.

Three articles have been made as step-by-step guides to help add the remaining BSP files to achieve a fully functional graphical application. All nessesary code files and snippes are found in the STM32F7cube package used by CubeMX to gernerate the project. 

  • Configuring STM32F746G-DISCO by adding touch support and access to assets in external flash.
  • Configuring STM32F7508-DISCO to use a bootloader and place the entire application in external flash.
  • Configuring STM32F769I-DISCO's DSI display and access to assets in external flash.

MCU Selector

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)

Additional 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

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.

Project Updater

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"

MDK-ARM

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.

Was this article helpful?
2 out of 3 found this helpful
  • Facebook
  • Twitter
  • LinkedIn
  • Google+
Have more questions? Please create a post on the forum.

Related articles

  • Configuring STM32F746G-DISCO
  • Configuring STM32F769I-DISCO
  • Step 1: Installation of TouchGFX
  • Using other IDEs with TouchGFX
  • Configuring STM32F7508-DISCO