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
HTD
Senior III

Downgrade the TouchGFX to 4.19 also didn't help. What's interesting - the clock setup for MX is different for that project.

I've seen on that forum that some people tried to re-download firmware packages and it helped. Yes, of course I tried it. Nothing works. Except workarounds I already mentioned. The best way to link missing files is to drag and drop them from explorer. It's just infinitely faster than adding the links with "create new file" option. If there only a faster way to add include directories. This is the most annoying part, because you have to first find what's missing and then make a special relative path to it.

I successfully built the project prior to adding the USB Host as well, and after adding it and rebuilding got a missing usb_host.h. Added the path to the include file, and now getting more errors for the additional include files it references, e.g. usbh_core.h I see these are in a Middlewares folder, so it looks like we're going down the same rabbit hole. Sorry, but I need to get out of yours and hop back into mine ;)

I think there is not a whole lot of compatibility testing done when ST releases new software. Good luck with ST support.

HTD
Senior III

So, for now there are 2 quickest ways: either add the files by dragging and dropping them from physical project directories to the CubeIDE project directories OR replace folders with file links with links to physical folders. I'm talking about CubeIDE (Eclipse) project view. All C/C++ files visible in project tree are by default included for compilation. If you create a link to a folder, all files will be compiled, except those explicitly set in properties to exclude from being compiled. But for include directories you have to manually add them to project configuration in settings. After I've done it like 10 times in a row, I reduced my time to like 5 minutes per update ;) Also a script / external tool could be made to re-apply the missing changes from mx.scratch file, but well, I think STM32CubeIDE should just do it, it probably has a bug that breaks processing of the mx. scratch file. I hope it will be fixed in the next update.

For my quick workaround it's important to use drag and drop from File Explorer because it's order of magnitude faster than creating the links from the settings.

BTW, in my case all required files was present on the disk, they were unpacked from the internal CubeIDE's repository. In case that would fail too - there is a GitHub repo:

https://github.com/STMicroelectronics/STM32CubeH7

It contains all the required files plus some examples.

I've also created my own repo with a template that tests the USB disks and pre-configures the SDMMC for FATFS, but SDMMC feature doesn't work and it's disabled in Project Manager. It's in another topic on forum, the SDMMC driver seems to be broken, at least after spending 3 days trying to make it work I finally gave up and I'm waiting for clues from some more experienced engineers (maybe from ST).

Here's my repo:

https://github.com/HTD/STM32H745I-DISCO

It also contains a nice debug console displayed on the LCD. After running the project connect any USB pendrive to the FS port and the test should be performed. To actually use it in a TouchGFX application the file operations should be redirected to the USB thread, I'm not sure if they would work from another thread. I haven't quite figured it out yet, I'm working on other things RN.

Bvan .12
Associate II

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.

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.

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.

This is caused what I believe is another TouchGFX Designer bug. It makes a special configuration and build scripts for its own builds, and also for STM32Cube builds. Don't use "run target" - it will not work on most projects, it's also way slower than STM32CubeIDE build. OK, the exact reason for it is the include directories configuration. It has it's own list of include directories, if you really look for them, you will find them somewhere within TouchGFX directory. BTW, the feature is broken too - it's able to add cpp files to the build, but not the c / h files. Most of the drivers are C, not C++.

What I was talking about is a different thing. It's STM32CubeIDE crashing when generating code. It results with "scratch.mx" file being left in the main project directory. This occurs on SOME operations using STM32H745I-DISCO board, but not STM32H747I-DISCO board.

It's not even a matter of missing files, or the files not being copied. It's a matter of missing virtual links to the files in the STM32CubeIDE project. Oh, also missing include directories.

To help you roughly understand what is happening:

TouchGFX Designer creates basic project structure for some different tools, including STM32CubeIDE. It also tries to make most of the files COMMON for all tools, so when it makes changes to the GUI, the changes are seen by the other tools. You use TouchGFX only to change the GUI. And to be exact - only how it looks, not how it works. So - you create VIEWS in TouchGFX Designer, then use "Generate Code" and that's it. Everything else you make in other tools, like STM32CubeIDE. That includes presenters, model, and the model listener.

The TouchGFX Designer will not see the files you added with different tools, unless they are in directories it includes by default. Also, AFAIK it doesn't even compile all the C files in those directories, the files to compile are specified explicitly in one or more its configuration files / make scripts.

Now for STM32CubeIDE - the C / C++ files for the build are specified in the project settings. Those are the files that are either displayed in the Project Manager links to folders, or the files are just linked to any folder in the view. Also - each file and directory has a property "exclude from build", but it's not set by default. This property is inherited from the parent container. So if you exclude a directory, you can't include any file in it.

Another quirk is with include directories. Even if you have your header file included in the project (you see it in the directory tree and the IDE sees it) - it's not used during the build unless the directory (PHYSICAL ONE) is included in "Include files" section of the project configuration. That leads to this frustrating situation when the IDE can easily find the header and all the symbols when using F3 key on the code, but you still get compile errors like the header file could not be found.

NSeba
Associate III

I also do have the same problem.

My TouchGFX 4.20 is unable to find the *.cproject file.

Please have a look to my problem also

https://community.st.com/s/question/0D53W00001pLHRMSA4/touchgfx-with-stm32h745idisco

NSeba
Associate III

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

NSeba
Associate III

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

STM32H745I-DISCO

STM32CubeIDE Version: 1.10.1

TouchGFX version 4.20.0