‎2021-04-11 10:49 PM
The steps to reproduce this build error:
Core/Src/main.c:24:10: fatal error: usb_device.h: No such file or directory
#include "usb_device.h"
^~~~~~~~~~~~~~
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?
Solved! Go to Solution.
‎2021-04-20 04:39 AM
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
‎2021-04-11 11:44 PM
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?
‎2021-04-15 02:41 AM
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
‎2021-04-19 06:57 PM
Hi @Romain DIELEMAN​ , thank you for your attention!
I implemented com port with following setting:
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.
‎2021-04-20 04:39 AM
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
‎2021-04-20 06:57 AM
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 :)
‎2021-04-20 07:05 AM
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
‎2021-04-20 07:35 AM
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.
‎2021-04-21 07:00 AM