cancel
Showing results for 
Search instead for 
Did you mean: 

Build erros when using TouchGFX Designer and STM32CubeMX Interchangeably

BParh.1
Senior III

The steps to reproduce this build error:

  1. Use TouchGFX Designer to create simple GUI by using the template for STM32F769-DISCO.
  2. Build and Run it on target -> OK
  3. Then open the .ioc using STM32CubeMX to configure for Virtual Com Port.
  4. Use STM32IDE to open the project , build and run -> OK
  5. But when we open the project using TouchGFX designer to edit some GUI, it had build error on target (simulation is ok).
  6.  

 Core/Src/main.c:24:10: fatal error: usb_device.h: No such file or directory

     #include "usb_device.h"

         ^~~~~~~~~~~~~~

  1.     compilation terminated.

It compains as it cannot find the file that CubeMX just generated from step 3.

Are my steps wrong to cause this? How to resolve this?

1 ACCEPTED SOLUTION

Accepted Solutions

Ok that makes sense then. When you run on target from TouchGFX Designer you are actually using gcc and not STM32CubeIDE. You then need to edit the Makefile in the /gcc folder to add the path to the new USB_DEVICE folder you generated when enabling USB in STM32CubeMX, otherwise the project is not aware of where to find usb_device.h

/Romain

View solution in original post

8 REPLIES 8
BParh.1
Senior III

I guess what I am trying to ask here is that , is it possible the code generated from CubeMX is automatically included in TouchGFX Designer as well?

Hi,

Could you share what you implemented in CubeMX to configure the Virtual Com Port so that we can replicate it ? After doing the changes did you generate code or you just opened CubeIDe then build it ? Normally when you do changes in CubeMX you need to generate code from CubeMX, then reopen the TouchGFX project in Designer and generate code. Then you open (or reload) the STM32CubeIDe project.

The compilation issue was faced when running from Designer or from STM32CubeIDE ? In both case have a look at the include paths (in the makefile under the gcc folder for running with TouchGFX Designer).

/Romain

Hi @Romain DIELEMAN​ , thank you for your attention!

I implemented com port with following setting:

  1. System Core -> RCC -> High Speed Clock (HSE) : Crystal/Ceramic Resonator
  2. Connectivity-> OSB_OTG_HS -> External Phy : Device_Only
  3. Middleware->USB_Device->Class for HS IP: Communication Device Class(Virtual Com Port).

Then generate the code in CubeMX and I can see a new generated folder 'USB_DEVICE' containing C/H files related to com port.

I build the project in STM32CubeIDE and it is ok. But when I close this IDE and open TouchGFX Designer, run target fail to build as mentioned in my failure description above.

Ok that makes sense then. When you run on target from TouchGFX Designer you are actually using gcc and not STM32CubeIDE. You then need to edit the Makefile in the /gcc folder to add the path to the new USB_DEVICE folder you generated when enabling USB in STM32CubeMX, otherwise the project is not aware of where to find usb_device.h

/Romain

Thank you @Romain DIELEMAN​ , but is editing the Makefile meant to be a manual step from ST perspective? Since the code was generated and TouchGFX is integrated to STM32IDE I was hoping that can be done automatically too :)

I don't know to be honest. I believe it is supposed to be a manual step as this depends on what you wish to do, there could be more configuration and additional files added by yourself to it. It seems complicated to automate that without any risks. The makefile generated when you create a project with an application template from TouchGFX Designer is a makefile we configured ourselves, it is not automatically configured by STM32CubeMX.

/Romain

Thank you @Romain DIELEMAN​ but at least it clarify now :). Ok then I'd edit the Makefiles. If you have some pointer which particular line to change would be great, otherwise I'd try to figure out myself.

I tried to do it quickly but it still faces some errors but at least it will give you an idea of what to do. Look at all the things named usb to see what I did.

I'll try to work more on it but not in the near future as I have a lot of other tasks sorry :sad_but_relieved_face:

/Romain