cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX with Zephyr RTOS on STM32H745

devanshu5
Associate II

Hi Community,

We are exploring the migration of our FreeRTOS-based firmware to Zephyr. Our current design heavily relies on TouchGFX (provided by ST) for controlling an 800×480 touch display.

Here are some key details of our setup:

  • TouchGFX with external SDRAM for a double frame buffer using the FMC peripheral
  • Images, fonts, and text stored in external QSPI Flash
  • LTDC controller in use
  • DMA2D accelerator enabled
  • RGB image compression utilized

Is there any sample application or detailed documentation available for achieving this on Zephyr?

I have already briefly reviewed the following resources:

However, I need more guidance, specifically:

  • Examples or reference projects for TouchGFX on Zephyr
  • Detailed documentation on integration steps

We have a tight project deadline, so I need to quickly determine:

  1. Whether TouchGFX can work with Zephyr
  2. How complex the migration effort would be

Any insights, references, or experiences would be greatly appreciated.

Regards,
Devanshu Agarwal

5 REPLIES 5
mathiasmarkussen
ST Employee

We have internal proof of concept of this, and are working towards a way to handle documentation and release of an example project or two.

At the same time, Zephyr is not a supported target for TouchGFX, so there will be some things we cannot help you with here.

I will check if we can share one of the proof of concept projects at this stage.

The simplest way to get your setup to work should be to get the QSPI flash memory and maybe your FMC RAM mapped in Zephyr, and handle the rest of the peripherals you listed in the STM32Cube driver port for Zephyr. You will need to do the LTDC this way to be able to register an interrupt handler, and for DMA2D there is no Zephyr interface.

You will need to enable the specific driver files you need to include as Zephyr modules and disable the peripherals from device tree, and then you should be able to copy the code from your old main.c into the zephyr main.c, along with relevant code for each peripheral from you hal_msp.c file.

You will also need to register some interrupt handlers(LTDC and DMA2D, at least), they should just call the HAL interrput handler, just like the _it.c file from your CubeMX project does, then TouchGFX will either override the callback or register a callback function to them.

When all the peripherals are enabled, you can copy your entire TouchGFX folder from your old project into the Zephyr project. You will need to create a Cmakelist.txt for TouchGFX and include that in your Zephyr application.

You can enable a CMSIS wrapper in Zephyr, this will enable you to reuse your oswrapper file from your FreeRTOS project. Main should start a thread that calls TouchGFX_Task().

There is a bit too much to detail here, and I'm not sure it would be all that easy to glean all of it from an example project anyway, since it will always be a somewhat weird mix of a Zephyr project that has been massaged to be able to fit a TouchGFX project inside.

I will try to get a project cleared for sharing with you, but the first step should be to get your peripherals initialized and confirmed working in Zephyr. Even with the example project there will be details that I have forgotten, but I will try to help to the best of my ability.

Thank you for the prompt response and clear explanations. It would be greatly appreciated if you could share the project with us. We'd like to quickly test, modify, and validate it on an evaluation/development kit to better understand the porting efforts.

mathiasmarkussen
ST Employee

I will be able to share a proof of concept project for the STM32U5G9J-DK2 discovery kit, but I will need to make some small changes and cleanup before it is ready for sharing. I will try to prioritize this task as soon as possible.

In the mean time you could consider acquiring the board if you want to be able to run the sample project.

Here's the project for the U5G9-DK2.

It should be placed in a Zephyr workspace and can be built with west build -b stm32u5g9j_dk2 app --pristine auto from the root of the project. Flash using west flash. Alternatively, the run target button in the TouchGFX designer builds and flashes automatically. External memory is supported, and an external loader is supplied and used by west flash.

The LTDC, CRC, DMA2D and GPU2D are initialised using STM32 HAL code, all other peripherals including the touch screen is handled in device tree.

The LTDC can also be initialised using device tree, it is disabled in board overlay, but the display driver captures the line interrupt which is needed by TouchGFX. I'll work on a solution to this before publishing the final project and documentation, but this works well for now.

Have a look at prj.conf, there are some things that are crucial for the project to work there.

Hi,

Thanks for sharing the sample project and steps. We will refer to it and make changes for our STM32H7 dev board. I will reach out to you if we need further help. Thanks again.

Regards,

Devanshu Agarwal