Skip to main content
Associate
March 30, 2025
Solved

usbx_stm32_device_controllers files not included in cmake build

  • March 30, 2025
  • 5 replies
  • 1192 views

CubeMx v6.14, cmake project, stm32h573ritx.

 

Hi, I am developing a project using threadx and usbx on a h573ritx mcu in cmake using cubemx generator, I have encountered where all but usbx_stm32_device_controllers folder files are included in the CMakeLists.txt. Adding them does seem to fix the issue.

Best answer by Ghofrane GSOURI

Hello @MR5 

After checking the provided project  https://github.com/mrubli/stm32u5-usbx-cmake-test

You did not select the device controller HS. As a result, MX did not generate the file in the CMakeLists.txt.
If you need to use the file, navigate to /Middlewares/ST/usbx/common/usbx_stm32_device_controllers. You need to select usbx -> ux Device HS -> Device Controllers "

GhofraneGSOURI_0-1747917158895.png

GhofraneGSOURI_1-1747917367816.png

THX

Ghofrane

 

5 replies

Technical Moderator
April 2, 2025

Hi @Quazar 

Would you attach IOC file to replicate.

As far as I can see, 

${CMAKE_SOURCE_DIR}/Middlewares/ST/usbx/common/usbx_stm32_device_controllers

usbx_stm32_device_controllers is already included.

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.Best regards,FBL
QuazarAuthor
Associate
April 2, 2025

Missing files in cmake/stm32cubemx/CMakeFiles.txt.

Quazar_0-1743609424067.png

In project.zip i added a cleanly generated project using the exact same ioc i have in my project. No .c files under this folder are included in the project.

Quazar_1-1743609743183.png

I am using STM32CubeMx version 6.14.0. on windows 11

Quazar_2-1743609923698.png

 

Steps:

1. coppied ioc to new folder

2. opened ioc with cubemx

3. generated clean cmake project

4. imported project to vscode

5. build project - success

6. added `ux_dcd_stm32_initialize(0, 0);` in USBX/App/app_usbx_device.c:MX_USBX_Device_Init()

Quazar_1-1743610470510.png

7. build project - fail

Quazar_2-1743610506483.png

8. added *.c files to sources in ./CMakelists.txt

Quazar_3-1743610566062.png

9. build project - success

Technical Moderator
April 2, 2025

Thank you for the detailed steps @Quazar. An internal ticket 206676 is submitted to dedicated team.

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.Best regards,FBL
Technical Moderator
April 7, 2025

Hi @Quazar 

After checking with CubeMX team, they recommend cleaning your environment by deleting .stm32cubemx , this may solve the issue.

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.Best regards,FBL
Explorer
April 28, 2025

I ran into the exact same problem but deleting ~/.stm32cubemx didn't fix it for me. I'm also on CubeMX 6.14.0, running Linux.

For what it's worth, here's a sample project illustrating the problem:
https://github.com/mrubli/stm32u5-usbx-cmake-test

Obviously, re-generating the code in CubeMX overwrites the manual addition of the missing source files in CMakeLists.txt (the last commit), so it's not a proper solution.

@FBL What was the outcome of your internal ticket? Is this a confirmed bug and your earlier suggestion is merely a workaround? Or was the team unable to reproduce the issue? Anything else I can try?

@Quazar Did cleaning the environment actually solve the problem for you?

QuazarAuthor
Associate
April 28, 2025

No it didn't, which CMakeLists.txt did you change, because the CMakeLists in main folder isn't overwriten

Explorer
April 29, 2025

Thanks, then we're still waiting for a solution from ST. I would have been very surprised if just clearing .stm32cubemx fixed it because the problem is reproducible across machines.

Right, I had to change cmake/stm32cubemx/CMakeLists.txt in the example. For my actual project I'm likely going to just post-process the generated file because this isn't the only problem I'm having with generated CMake files.

Technical Moderator
May 22, 2025

Hi @Quazar @MR5 

I let my colleague @Ghofrane GSOURI further investigate the issue from MX point of view.

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.Best regards,FBL