cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with new version STM32CubeIDE ver1.5.1 and STM32CubeMX ver6.1.1 (fatal error: usb_device.h: No such file or directory)

ADysh.1
Associate II

Before that there was STM32CubeIDE ver1.4.0 STM32CubeMX ver6.0.0 everything was fine.

Installed STM32CubeIDE ver1.5.1 and STM32CubeMX ver6.1.1, there was an error when connecting USB_DEVICE.

Tried creating a project from scratch with nothing but USB_DEVICE. Gives an error message.

What to do?

0693W000007BX7KQAW.png

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

I took your IOC, hit generate code, loaded the project and hit build. It built fine. Win10, CubeIDE 1.5.1, CubeMX 6.1.1, latest HAL package.

I know it's frustrating. Sorry, good luck.

...
Finished building target: new_new_f407vet6.elf
 
arm-none-eabi-size   new_new_f407vet6.elf 
arm-none-eabi-objdump -h -S  new_new_f407vet6.elf  > "new_new_f407vet6.list"
arm-none-eabi-objcopy  -O binary  new_new_f407vet6.elf  "new_new_f407vet6.bin"
   text	   data	    bss	    dec	    hex	filename
  25584	    492	   7948	  34024	   84e8	new_new_f407vet6.elf
Finished building: default.size.stdout
 
Finished building: new_new_f407vet6.bin
Finished building: new_new_f407vet6.list

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

10 REPLIES 10
TDK
Guru

Check your include directories

Project properties -> C/C++ Build -> Setting -> Tool Settings -> MCU GCC Compiler -> Include Paths

If you feel a post has answered your question, please click "Accept as Solution".
ADysh.1
Associate II

Added everything. It didn't get any easier. Error again!

0693W000007BXRjQAO.pngI specifically looked at the settings on the old version. The settings on both the old and the new version are the same. But the new one doesn't work!

0693W000007BXRtQAO.png

Different error message. It sees the file now. The init function should be within main.c. Regenerate the code. If that doesn’t work, attach your IOC file.
If you feel a post has answered your question, please click "Accept as Solution".
ADysh.1
Associate II

1) I'm launching a new version of STM32CubeIDE ver1.5.1 (STM32CubeMX ver6.1.1).

I indicate the directory with the old project on STM32CubeIDE ver1.4.0 STM32CubeMX ver6.0.0.

At startup it says: “The workspace was written with an older version. Continue and update workspace which may make it incompatible with older version? ".

0693W000007BXbyQAG.pngI click Continue.

An older version message appears.

0693W000007BXc8QAG.pngI click Continue.

The project opens and works as expected.

Settings in the photo.

0693W000007BXcDQAW.png2) I click to create a new project.

I indicate the same chip.

USB only settings in virtual com port mode.

I generate a project.

Checking - again the same error!

Attach the IOC file.

Half a day was wasted. The new version does not work as expected out of the box. Very upset. I roll back to STM32CubeIDE ver1.4.0 STM32CubeMX ver6.0.0. Extremely disappointed.

Thank you for helping me. But this is beyond my strength.

My system: Windows 10 Pro, Lenovo ThinkPad T590 laptop. All updates have been installed.

TDK
Guru

I took your IOC, hit generate code, loaded the project and hit build. It built fine. Win10, CubeIDE 1.5.1, CubeMX 6.1.1, latest HAL package.

I know it's frustrating. Sorry, good luck.

...
Finished building target: new_new_f407vet6.elf
 
arm-none-eabi-size   new_new_f407vet6.elf 
arm-none-eabi-objdump -h -S  new_new_f407vet6.elf  > "new_new_f407vet6.list"
arm-none-eabi-objcopy  -O binary  new_new_f407vet6.elf  "new_new_f407vet6.bin"
   text	   data	    bss	    dec	    hex	filename
  25584	    492	   7948	  34024	   84e8	new_new_f407vet6.elf
Finished building: default.size.stdout
 
Finished building: new_new_f407vet6.bin
Finished building: new_new_f407vet6.list

If you feel a post has answered your question, please click "Accept as Solution".
ADysh.1
Associate II

Thanks for the answer. Now I will know that the problem is on my side.

Good luck.

O'li
Associate II

Did you manage to solve your problem?

I had something similar and I suspect the code generation to not go all the way to the end: in your project's screenshot there's an "mx.scratch" file leftover, which should disappear once the code is generated.

Then, CubeMX might not generate/include all the driver files such as your usb_device.h one.

I managed to get rid of it by re-doing all the project creation from the *.ioc file. It worked for some time but it happens again, and it's quite laborious to re-do everything...

Hello.

No. The problem could not be resolved. I am working on version 1.4.

I even rolled back Windows to the old version, when I didn't have the CubeIDE program. Actually installed CubeIDE v1.5 from scratch.

And when creating a project, the same error came out!

Java is the latest version.

I tried to install Java of a different version, and noticed that a new error related to the usb library popped up. I didn't understand. The strength was gone.

IPaku.1
Associate

I had exactly the same problem with CubeIDE 1.9.0 and was stuck. Then I thought it'd be great to see some codegen logs, as it seems like codegen fails, since mx.scratch file stays in the project after codegen completes. That basically means there was something wrong with codegen.

So I though of that CubeIDE seems eclipse based, so I googled where eclipse's logs are, and they turn out to be in the workspace folder, under ".metadata' folder

In the logs I saw a weird error

!ENTRY com.st.stm32cube.common.mx 4 0 2022-06-08 16:42:07.293
!MESSAGE Error on line 9 of document file:/C:/STM32CubeIDE/workspace_1.9.0/another-try/mx.scratch: Invalid byte 2 of 2-byte UTF-8 sequence.
!STACK 0
org.jdom.input.JDOMParseException: Error on line 9 of document file:/C:/STM32CubeIDE/workspace_1.9.0/another-try/mx.scratch: Invalid byte 2 of 2-byte UTF-8 sequence.
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:530)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:905)
	at org.jdom.input.SAXBuilder.build(SAXBuilder.java:884)

So I looked into mx.scratch file, line 9

And that line is specifying Firmware installation repository path. And that path has my name spelled in cyrillic.

So I went on to change the repository path, which you can do using "Window -> Preferences -> STM32Cube -> Firmware Updater -> Firmware installation repository"

You might as well want it fixed for CubeMX, "Help -> Updater Settings -> Repository Folder"

I changed it to "C:\ST\Repository"

Changing it as you might have guessed would not move the files, but it will redownload everything next time you try to build or codegen.

If this doesn't help, maybe you could further look into the logs file for clues..

Good luck with that :grinning_face: