cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H745I-DISCO STM32CubeIDE doesn't create middlewares for TouchGFX project.

HTD
Senior III

I just created STM32H745I-DISCO TouchGFX project with TouchGFX.

That passed, I was able to import the project to the STM32CubeIDE.

Then I just added USB_OTG_FS peripheral configured with host class (HOST_ONLY for USB disk).

Saving changes in CubeIDE caused several errors about missing files. I recently worked on the same thing on STM32H747I-DISCO board and it worked. So I compared those 2 projects. The STM32H745I-DISCO project just misses Middlewares directory in STM32CubeIDE dicrectory. The directory in project root exists, however it misses most of the necessary files. Also, the necessary include directories are not present in the 745 project.

So - to make it clear: The code generator for STM32H745I doesn't create any configuration for middleware files. It should do it, because this is how it works for STM32H747I project.

To reproduce the issue:

  1. Create new TouchGFX project for STM32H745I-DISCO.
  2. Import the project to a new STM32CubeIDE workspace.
  3. Build and run the project. (That should work.)
  4. Add USB_OTG_FS peripheral for CM7 core.
  5. Configure the peripheral as HOST_ONLY, Mass Storage Class
  6. Save the changes and try to build the project.

The steps performed for 745 fail. There are missing files.

The same steps performed for 747 pass.

UPDATE:

The problem seems to be specific to TouchGFX. When I generated new STM32CubeIDE project from STM32CubeIDE, not TouchGFX Designer, the middleware files are generated correctly. However, now I have completely no idea how to add TouchGFX support to it.

UPDATE:

A workaround. First, create an empty project for the board with STM32CubeIDE. Add required middlewares. At least the correct directory structure will be created, main application files to be used as templates also will be created. That's all about that project. Start a new project with TouchGFX Designer. Copy the application directories somewhere aside TouchGFX application directory. If the directories aren't already added to include paths, add them.

Then the most important part: clone the https://github.com/STMicroelectronics/STM32CubeH7 repository. Or other relevant one from STMicroelectronics. Copy some, or even all middlewares to the CubeIDE project. Add include directories if needed. Then try to build the project to see hundreds of errors. The important information is the files that cause errors. Exclude them from compilation (they probably require additional configuration in the project). Rinse and repeat until no more compile errors occur.

It works, however, it takes some time to apply. For STM32H747I-DISCO I didn't have to apply those workarounds, the code generator for the TouchGFX project just worked as intended. It both copied the necessary files, added include paths and created virtual links to the required c files.

Anyway - this allows using all STM32H745I-DISCO features with TouchGFX projects and STM32CubeIDE.

The problem is not solved - it's just a workaround. Is there a way to peek how TouchGFX configures the supported boards by ST? Is there a publicly accessible repo with boards configurations? How should I report possible bugs with those things/

23 REPLIES 23
MM..1
Chief II

Hi , you have two ways.

A. as you add create clean IDE project work ok , and in MX plugin wizard you can add software package TouchGFX.

B. use first variant , but projects from TouchGFX isnt perfect designed for import and change in IDE/MX.

Before your point 2 try compare ioc and mxproject files 747 vs 745 and correct it.

I tried to start the project as STM32CubeIDE project and import the IOC file generated by TouchGFX. It didn't work, guess what - another bug in this software. I get an empty dialog window with 2 buttons: "OPEN DIRECTORY" and "CANCEL". No matter what I click I get error that I'm missing a firmware package, but the IDE doesn't know which. It says something with a word "probably" like it wasn't even sure what is missing.

So I went for the clean project and adding TouchGFX Generator software package. Unfortunately, it starts unconfigured. Nothing is set. No LTDC settings, I'd have to set each of hundreds options manually copying from the other project. Seems like many hours of dull, repetitive work. No guarantee that it would even work.

I have another idea: maybe if I tried copying the hardware configuration from the TouchGFX generated project's IOC to the Cube generated project's IOC it could work... IDK.

It would be 100 times easier if the files in the project would be linked directly to the physical files on the disk, with no virtual links. Cube creates such projects and they are pretty straightforward to configure. The TouchGFX Designer creates additional directory named STM32CubeIDE, where it places empty directories that are copies of the "real" directories. The directories are empty, and the CubeIDE gets virtual links to the physical files that are somewhere else.

That's not all the madness. The building toolchain uses Include Directories settings. So one would think - just set the correct include directories and it would build. Wrong. There are scripts that don't belong to the Cube, automatically generated by TouchGFX that provide additional files used by the toolchain to build the project. So - move or rename any directory - everything breaks. At least - TouchGFX doesn't build anymore.

STM32CubeIDE projects can be built with a custom toolchain, like I can use VS Code and a simple makefile to build it. However - after several days of trying to make TouchGFX project to be built like that I gave up, it's way too complicated and convoluted. But maybe there's a way to do that anyway.

wired
Senior III

I don't see anything about which versions of the software you're using, but I had a similar problem (middlewares and drivers would disappear) during an attempt to upgrade my software when I compiled the .ioc file using CubeMX. I was using an STM32F469i-DISCO board, and the problem was that TouchGFX 4.20 was not compatible with the latest CubeMX release (6.6.1). Maybe you have a similar compatibility issue. The board setup description for the STM32H747I-DISCO under TouchGFX 4.20 says the BSP is based on a subset of the STM32CubeH7 driver package version 1.10.0. Make sure you are using the same version. And unlike the description for my board, it says nothing about the CubeMX version in the STM32H747I-DISCO description.

I have everything in the latest available versions. Also, I'm sure it's something broken with the device configuration tool, not just the project. Or IDK. It happens with many actions, not only adding middleware. Recently I tried to change the stack size for the project - it didn't do that. I left with the scratch.mx file, I learned the file has all the things the CubeIDE tried to do, but failed to do so. So now after applying a change I just check if there is a scratch.mx file, if it is, I must perform all actions specified in it manually. It was an overkill at first, but I got familiar with the project structure enough to not waste more than 10 minutes when it happens. And it happens... quite often.

My problem WAS that I had everything in the latest available versions. See here and here if you want to read more about it - some of what I went through might mirror some of the issues you've been having.

HTD
Senior III

What should I downgrade first to see if that's it? TouchGFX or Cube?

wired
Senior III

I would go to Cube 6.5.

I've just downgraded STM32CubeIDE to 1.9.0 (equivalent of Cube 6.5.0) - I created a new TouchGFX project with my TouchGFX 4.20. Same problems, Cube doesn't creates file links. I think it's a bug, do you have a suggestion where should I report it? I'm not sure if it's not TouchGFX fault, so I will test it again with TouchGFX 4.19.

Frustrating, isn't it? You can open a support ticket with ST. I'm trying this on my end also. Will let you know what happens.