cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Generate All Source Files

nlippitt
Associate II

Scenario: I am using STM32CubeMX (v6.13.0) to generate the necessary project files for a default STM32U5A9J-DK project with ThreadX enabled.  The project files are copied into a docker container and built with cmake.  Building and debugging in the container works until I attempt to add the ThreadX middleware.  Outside of the container building and debugging with STM32CubeIde is not an issue.

Problem: The STM32CubeMX generated project files are not sufficient to compile a ThreadX program.  Undefined reference problems flood the output.

Debug:

1) I have tried combinations of the settings in STM32CubeMX including: "Generate Under Root," "Enable multi-threaded support," and "copy all used libraries into the project folder" to no avail.  My cmake program recursively adds all .h, .c, and .s/.S files as sources or include paths as appropriate in the project folder, so all generated files are always used.

2) I attempted to resolve the undefined issues by manually adding the source files missing from the firmware package STM32Cube_FW_U5_V1.7.0.  I pull down the repository from git during my container setup.  First, I included all files in the package.  This was unsuccessful and resulted in errors.  Next, I included only necessary files and directories, viewed the remaining dependencies, and repeated the process.  This was a painful and undesirable tactic, and did not solve the problem either.  A file that did not exist in the firmware package was referenced.  Because ThreadX functions outside of the container referencing the same firmware package, I do not understand how to reference all the required files and why the option to "copy all used libraries into the project folder" fails for this middleware.

Please send support on resolving this issue.  I am hoping I am unaware of the proper way to access the needed files.  I can send more information on specific errors as desired.

Note: FreeRTOS was previously used in a similar fashion with a STM32H7 uC in a docker container without issue due to all necessary files being generated.  However with the STM32U5 I must use LevelX and USB operations, so ThreadX is the natural choice and I do not want to run into the same missing files issues when I add the LevelX and USB middlewares to the project.  Thanks!

6 REPLIES 6
STea
ST Employee

Hello @nlippitt ,

Can you send the output message and the include paths for the failing project.

Also, can you specify the exact way you pulled the repository from GitHub as missing the --recursive option can lead to missing middleware files as they are not part of the same repository.
Regards 

In order 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.

@STea wrote:

specify the exact way you pulled the repository from GitHub as missing the --recursive option can lead to missing middleware files 


@nlippitt see: https://community.st.com/t5/stm32-mcus/downloading-stm32cube-packages-from-github-correctly/ta-p/725288 

nlippitt
Associate II

Without cloning the repository and using only the generated files, I get the following errors:

nlippitt_0-1734969817681.png

When I clone the repository using:

"git clone --recursive "https://github.com/STMicroelectronics/STM32CubeU5.git" "

"git pull"

"git submodule update --init --recursive"

I get the errors: (Cropped for visibility)

nlippitt_1-1734969955033.png

My CMakeLists.txt uses lists of include directories and source files generated from a Python script that recursively starts from a base directory and adds all directories with .h files as include directories and all .c .s and .S files as source files where .s and .S files have property appended for "assembler-with-cpp"  This setup works without any errors without cloning the STM32CubeU5 repository when ThreadX is not used and I am able to run and debug firmware within VSCode.  I need this functionality to continue working when middlewares are added.

In the first scenario only the temp_fw/stm32_dev_fw base directory is used.  In the second scenario both temp_fw/stm32_dev_fw and the git cloned STM32CubeU5 base directories are used.  For example, in the second scenario these are the include paths. (Cropped for visibility)

 

nlippitt_3-1734970335501.png

 

 

Hello @nlippitt ,

did you manage to solve this compiling issue. are you sure you are getting the complete Cubefirmware package from GitHub some components or files might be missing if you don't use the option -- recursive in the git clone command.
Regards

In order 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.

Yes I am still having the same problem.  And yes I am using the recursive option.  Please see my previous message for more details.