Skip to main content
Andrew Neil
Super User
Question

USBX on STM32C0 in practice: Download doesn't build

This:

 

Download from: https://github.com/ST-TOMAS-Examples-USB/c0_usbx_hid_mouse

 

I downloaded the Zip, unzipped, and tried to import into CubeIDE v2.1.1:

 

When I press ‘Finish’, nothing happens; the project does not appear in the Project Explorer. Even with a new, empty workspace.

 

It does import OK to CubeIDE v1.13.0, but then the build fails:

this error popup has to be cleared 9 times:

and the console says:

12:32:19 **** Build of configuration Debug for project c0_usbx_hid_mouse ****
make -j8 all
USBX/App/subdir.mk:25: *** unable to generate command line. Stop.
"make -j8 all" terminated with exit code 2. Build might be incomplete.

12:32:21 Build Failed. 1 errors, 0 warnings. (took 1s.666ms)

 

There are no specific download instructions given on the GitHub page - am I missing something?

Should the zipfile download work?

 

On Windows11 Pro

2 replies

Frantz LEFRERE
ST Technical Moderator

Hello ​@Andrew Neil 

I’ve quickly tested it on STM32CubeIDE2.2.0 without any issue on the import.
But at compilation phase, a function prototype is missed :
void MX_USB_PCD_Init(void);
in app_usbx_device.c
Could you try with CubeIDE 2.2.0 ?
Best regards,

Frantz 

Andrew Neil
Super User

Could you try with CubeIDE 2.2.0 ?

I didn’t have that installed.

As v2.3.0 is now the latest, I installed that - it behaved the same as my v2.1.1

So then I installed v2.2.0 - it also behaved the same as my v2.1.1

(Yes, a new separate workspace for each).

 

So then I tried:

  1. create a blank project in v2.3.0
  2. close the IDE, and delete everything from that project folder (using the Windows Explorer)
  3. copy everything from the ZIP into that project folder (using the Windows Explorer)
  4. re-open the IDE
  5. refresh the project

And then it built with only the MX_USB_PCD_Init error - as you said.

Adding #include "main.h" in app_usbx_device.c fixed that, and it built with 0 errors & 0 warnings.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.