Skip to main content

Running without an RTOS on a TouchGFX Board Setup

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.

  1. Create a project from TouchGFX Designer with the TouchGFX Board Setup for the STM32H7B3-DK board and generate code.

  2. Open the provided .ioc file with STM32CubeMX.

  3. In the STM32CubeMX interface, navigate to the Middleware -> FreeRTOS settings and disable FreeRTOS

FreeRTOS settings in STM32CubeMX for the STM32H7B3-DK

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.

  1. 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).

Turning the backligh ON for the STM32H7B3-DK

  1. 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.

  1. Open the STM32TouchController.cpp file found under the TouchGFX/target folder of the project. Manually remove #include <cmsis_os.h> and configASSERT(0) inside the if-statement.

  2. Remove the Freertos.c file in the Core/src folder.

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.