Skip to main content
BParh.1
Senior III
April 12, 2021
Solved

Build erros when using TouchGFX Designer and STM32CubeMX Interchangeably

  • April 12, 2021
  • 8 replies
  • 1965 views

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?

This topic has been closed for replies.
Best answer by Romain DIELEMAN

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

8 replies

BParh.1
BParh.1Author
Senior III
April 12, 2021

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?

Romain DIELEMAN
ST Employee
April 15, 2021

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

BParh.1
BParh.1Author
Senior III
April 20, 2021

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.