cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to build with USBPD

Renha
Associate

Hello! I am trying to build a simple project on STM32G431KBTx featuring USB PD.

I am using STM32CubeMX (latest version), all libraries, etc. are also of latest revisions. I've setup USB PD parameters via GUI, and generated code for Makefile.

When I call Make, I get these errors:

 

/lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: build/main.o: in function `main':
~/other/Core/Src/main.c:149: undefined reference to `USBPD_DPM_Run'
/lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: build/stm32g4xx_it.o: in function `SysTick_Handler':
~/workspace/other/Core/Src/stm32g4xx_it.c:192: undefined reference to `USBPD_DPM_TimerCounter'
/lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: build/usbpd.o: in function `MX_USBPD_Init':
~/other/USBPD/App/usbpd.c:44: undefined reference to `USBPD_DPM_InitCore'
/lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld: ~/workspace/other/USBPD/App/usbpd.c:58: undefined reference to `USBPD_DPM_InitOS'

 

 I haven't altered the generated code at all. I've tried downgrading the libraries, altering parameters, nothing helps...

I am attaching the project file.

3 REPLIES 3
Imen.D
ST Employee

Hello @Renha and welcome to the Community :)

Check Include Paths, check that the USB-PD stack library is well included in your project.

You can review the application in STM32CubeG4 package:STM32CubeG4/Projects/STM32G474E-EVAL/Applications/USB-PD at master · STMicroelectronics/STM32CubeG4 · GitHub

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Renha
Associate

Hi @Imen.D! Thank you kindly for the reply. I was sure the CubeMX should take care of all the inclusions. I found files and folders related to the PD copied to the project directory successfully, and these are also mentioned inside of the Makefile, not sure what else to check. If you would be able to check the generation for attached project file, that would be extremely helpful.

I've also tried the project at your link: downloaded it (the Sink one), opened in CubeMX, changed generation type to Makefile, and got a message "The Code is successfully generated under : [path here] Project language : C but Makefileproject generation have a problem.", with an empty directory as a result. So for my project generation "works" better than for this one.

Guenael Cadier
ST Employee

Hi @Renha 

Could you check that your project contains a usbpd_dpm_core.c object, that that this object is properly compiled and linked ?

Regards