cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX integration of TouchGFX user constants to CMake file

ReneAlexandeR
Visitor

Hi! 

I am working on creating a new build system for my for a software platform using CMake to help with management of different targets and toolchains. I have an .ioc file that is currently in use with the existing build system based on CubeIDE that contains all middleware (FreeRTOS, LwIP, TouchGFX) additions and configurations, so I am not changing anything. 
I am trying to make the build as modular as possible so I am trying to link the stm32cubemx and touchgfx CMake targets directly. I am using build presets to manage configuration. Creating the build system works fine, but when I try to run the build I get compilation errors because the TouchGFX related files can't find the user constants defined in CubeMX for TouchGFX, as shown below: 

ReneAlexandeR_0-1770109725764.png

This can be expected because these symbols are created in defines on main.h and the TouchGFX file being referred there does not include main.h. I could add it manually, but I'd like to try to get the system to work directly from autogeneration if possible. After investigating and getting some help from Copilot, it seems that TouchGFX expects these symbols to be provided differently. Apparently, these "User Constants" that are generated as defines in main.h should also appear in the CMakeLists.txt file for the stm32cubemx target under "MX_Defines_Syms".
The picture below shows the "User Constants" section on CubeMX:

ReneAlexandeR_1-1770110204223.png

And these symbols appear in the main.h file under Core/Inc:

ReneAlexandeR_2-1770110253188.png

But they are not generated in CMakeLists.txt for CubeMX, as it should (according to Copilot):

ReneAlexandeR_3-1770110354223.png

Is this expected behavior or is CubeMX failing to include those symbols in the CMake file? Is there anything I need to select on CubeMX for it to generate these on the CMake file? Maybe Copilot is hallucinating?

I'd like to know what you think is the best approach to build these two together using CMake. 
I am using CubeMX v6.16.1 and TouchGFX Designer v4.26.0

Thank you in advance. 
// Rene


 

2 REPLIES 2
Souhaib MAZHOUD
ST Employee

Hello @ReneAlexandeR 

Thank you for posting!

Which MCU are you using? or could you attach an IOC in order to investigate the issue?

BR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello Souhaib! 
Of course, I forgot to add those details. 
I am using the STM32H750XBH6 microcontroller. 
Please find attached the ioc file.

// Rene