In this section we will discuss how to run a TouchGFX project without an operating system based on a TouchGFX Board Setup for one of the ST development kits available in TouchGFX Designer. This article is not aimed for custom projects started from STM32CubeMX or STM32CubeIDE.
Starting a project from a TouchGFX Board Setup
On most of the TouchGFX Board Setups available in TouchGFX Designer the OS FreeRTOS is enabled by default. To run without an operating system a few steps must be followed. Here we will use the TouchGFX Board Setup for the STM32H7B3-DK board as an example.
Create a project from TouchGFX Designer with the TouchGFX Board Setup for the STM32H7B3-DK board and generate code.
Open the provided
.iocfile with STM32CubeMX.
In the STM32CubeMX interface, navigate to the Middleware -> FreeRTOS settings and disable FreeRTOS
Turning on the backlight
The backlight on the displays are initially turned OFF in most of the TouchGFX Board Setups. This was done to prevent having a glitched display when booting up the board at the first tick. The backlight is then turned ON when the first framebuffer is ready in the
taskEntry() function in
TouchGFXHAL.cpp ( under the
TouchGFX/target folder). When running without an OS the
taskEntry() function is never called, meaning that the display will never be turned ON while the framebuffers are still properly updated. The solution is to turn ON the backlight at startup by setting the LTDC_HSYNC and VSYNC pins to HIGH.
- Navigate to the GPIO settings in the System Core -> GPIO section. Look for the PINs linked to the backlight of the display and set the GPIO output level to HIGH. For the STM32H7B3-DK board the pins are PA1 (User label: LCD_BL_CTRL) and PA2 (User label: LCD_ON/OFF).
- Generate code from STM32CubeMX, and then generate code from TouchGFX Designer.
Cleaning the code
STM32CubeMX and the TouchGFX Generator cannot remove potential calls of the RTOS functions if they are under "USER CODE" sections. It is then necessary to manually clean the code. For the STM32H7B3-DK TBS only the Touch Controller needs to be modified.
STM32TouchController.cppfile found under the
TouchGFX/targetfolder of the project. Manually remove
configASSERT(0)inside the if-statement.
Freertos.cfile in the
To flash your project on your board from TouchGFX Designer you will need to cleanthe
Makefile (found under the
gcc folder) by deleting or commenting OS related dependencies and paths. It is also needed to clean all OS related dependencies and paths in the different projects for the toolchain/IDE used.
You are now able to run your project without an OS on a project started from a TouchGFX Board Setup.