Skip to main content
HTD
Senior II
August 21, 2022
Question

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

  • August 21, 2022
  • 5 replies
  • 5544 views

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/

This topic has been closed for replies.

5 replies

MM..1
Chief III
August 21, 2022

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.

HTD
HTDAuthor
Senior II
August 21, 2022

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.

NSeba
Associate II
September 29, 2022

I feel like TouchGFX and CubeIDE are released without any checks about interoperability.

wired
Senior II
August 24, 2022

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.

HTD
HTDAuthor
Senior II
August 24, 2022

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.

wired
Senior II
August 24, 2022

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.

wired
Senior II
August 24, 2022

I would go to Cube 6.5.

HTD
HTDAuthor
Senior II
August 24, 2022

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.

wired
Senior II
August 24, 2022

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.

Bvan .12
Visitor II
August 27, 2022

Hey Everyone,

I have been heading down the same path but trying to get lwip running on touchgfx. I am new to CubeIDE and have now been through 3 different versions of the IDE and TouchGFX with none of them working properly over the past 6 months.

Selecting run target in TouchGFX returns errors when everything else builds fine. I started doing the same thing manually moving files based on the missing includes and errors but gave up with this ridiculous method.

I was excited to use this product as it has much potential but the wasted time has me thinking of moving to other vendors.

wired
Senior II
August 27, 2022

Why are you using Run Target in TouchGFX instead of building the project and debugging in the IDE? That's only used for loading TouchGFX demos and examples into a DISCO or EVAL board.

Bvan .12
Visitor II
August 28, 2022

I am currently using F7508 and F746 Disco boards. Any of the tutorials I have gone through from ST or YouTube all use Run Target to upload the TouchGFX. From my understanding building from the IDE doesn't upload the graphic content to the board, although I could be wrong as I have not tested that out yet.

If that is true, maybe a work around is to upload your GUI then build and program from the IDE. I'll give it a try.

One of the videos did state that running the simulator with hardware code will return errors, at least in an older version.

NSeba
Associate II
September 29, 2022

Can you please upload a working project just to start with TouchGFX.

STM32H745I-DISCO

STM32CubeIDE Version: 1.10.1

TouchGFX version 4.20.0

HTD
HTDAuthor
Senior II
September 30, 2022

Since I played with the 745I-DISCO board more, I think I've found a good workaround for most issues, especially the broken links causing compile errors. Not all of mentioned bugs can be fixed with this, but adding and removing components to the projects (as drivers and middlewares) is day to night now. I'm very busy at the moment, but I'll create a new project on GitHub with some internal hardware preconfigured and a debugging console for LCD screen to perform some tests like GPIO, PWM, mass storage and such. I can also add my eMMC FATFS diskio driver, since it's probably the easiest way to make use of the built-in eMMC. It also illustrates how to convert BSP API from the STM H745 repo templates to HAL compatible drivers. Expect the project on Monday.