cancel
Showing results for 
Search instead for 
Did you mean: 

Bug when generating projet for STM32 with TouchGFX

ANauz.1
Senior II

Hello

I'm working on a F412G-Disco board, with a TouchGFX application. When generating the initialisation code with MX, in the Core inc directory, MX generate a nema_hal.c file

It contain only a file header. So, this is not a big problem but it is annoying. I tried to find what component was generating this file with no success.

What can I do to avoid this file to be generated?

My configuration:

STM32CubeMX version 6.7.1

F4 Firmware version 1.27.1

TouchGFX version 4.21.0

I tried to find out with the log of the MX, STM32CubeMX.log what component was creating the file. But there is not enough information. How to change the log level generated by MX?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Yoann KLEIN
ST Employee

Hello,

The STMicroelectronics.X-CUBE-TOUCHGFX.4.21.0_Configs.xml file contains the config of what we call the TouchGFX Generator, which is a pack of CubeMX.

In the line you highlighted, you can see that there is a condition : "sem_gpu2d_enabled & oswrapper_threadx". That means that, to generate the nema_hal.c file inside the target/generated/nema_hal.c, you need to enable GPU2D (sem_gpu2d_enabled) and ThreadX (oswrapper_threadx), inside CubeMX.

So if this condition is not true, CubeMX will never generate this file in this directory.

The fact that nema_hal.c exists inside your Core directory is because it is integrated by default in our TBS, so every time you create a project on F412-G starting from TouchGFXDesigner, this file will be included there.

To be honest, I don't really understand why that is an issue for you, and why you want to put this file in target/generated, if you are not using GPU2D and ThreadX.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

View solution in original post

7 REPLIES 7
Yoann KLEIN
ST Employee

Hello @ANauz.1​,

This file is generated when you enable GPU2D with ThreadX or NoOS, but that is not enabled in the CubeMX project of the F412G TBS project in TouchGFXDesigner, so it should not appear in your project.

Did you create your project starting from TouchGFXDesigner and selected the F412G-Disco TouchGFX Board Setup from there ? Or did you create your project from CubeMX ?

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ANauz.1
Senior II

Hello Yoann,

The ioc file was created using TouchGFX and the default template for the board.

Is there an option I can swith on and off so that MX remove it from the ioc file to avoid generating the file? What can I do to have it generated in the "correct" directory and not in my "core/inc"?

Thank you

Yoann KLEIN
ST Employee

Hello again,

My bad, I checked in the TBS and those files are indeed included by default in the project, in Core/Inc, like you said.

CubeMX will not remove those files even if you disable GPU2D and generate code, because it can only add references to files but not remove them unfortunately.

I recommend you to simply delete this file if it bothers you.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ANauz.1
Senior II

Ok

Is it possible to "correct" on of the X-CUBE-TOUCHGFX package to make a least copy it to a touchGFX source directory?

In the STMicroelectronics.X-CUBE-TOUCHGFX.4.21.0_Configs.xml, last block, i'm able to change the name, but not the directory.

Line 390:

<File Category="source" Condition="sem_gpu2d_enabled &amp; oswrapper_threadx" Name="target/generated/nema_hal.c" Version="4.21.0"/>

Changing the "Name" indeed change the name generated, but the directory is ignored!

Yoann KLEIN
ST Employee

Hello,

The STMicroelectronics.X-CUBE-TOUCHGFX.4.21.0_Configs.xml file contains the config of what we call the TouchGFX Generator, which is a pack of CubeMX.

In the line you highlighted, you can see that there is a condition : "sem_gpu2d_enabled &amp; oswrapper_threadx". That means that, to generate the nema_hal.c file inside the target/generated/nema_hal.c, you need to enable GPU2D (sem_gpu2d_enabled) and ThreadX (oswrapper_threadx), inside CubeMX.

So if this condition is not true, CubeMX will never generate this file in this directory.

The fact that nema_hal.c exists inside your Core directory is because it is integrated by default in our TBS, so every time you create a project on F412-G starting from TouchGFXDesigner, this file will be included there.

To be honest, I don't really understand why that is an issue for you, and why you want to put this file in target/generated, if you are not using GPU2D and ThreadX.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
ANauz.1
Senior II

It is not a issue. It is just that I do not like to have a source file, in a header directory. Moreover when the source file is not used at all. So I was wondering if it was possible to avoid this. Putting it in the directory it would be use seems a solution.

But indeed, it is not a major problem

Yoann KLEIN
ST Employee

Then, you can simply move those files to the folder manually, or delete them.

That is the best solution for your case.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX