cancel
Showing results for 
Search instead for 
Did you mean: 

Can't compile example projects from STUSB010 software library

AOliv.7
Associate

Hello,

I'm evaluating different solutions for USB Power Delivery and I wanted to try out STUSB010 software library. I downloaded the library from the official ST website (STSW-STUSB010 v1.3.0) and I opened a project on STM32CubeIDE 1.9.0 on a Linux machine.

The project does not build by default (as is, directly from the zip without any modifications), it seems like it is not trying to link the USB PD library. I'm not very familiar with the IDE and for the life of me I can't figure out how to fix the generated compiler command. I can't post the compiler output here, the form complains about the post being too long. I get a bunch of errors like this one:

arm-none-eabi-gcc -o "STM32F072_MB1303_DRP_SRCING_DEVICE.elf" @"objects.list"  -mcpu=cortex-m0 -T"/home/andres.oliva/Downloads/en.STSW-STUSB010/STSW_STUSB010_v1.3/Projects/STM32F072RB-Nucleo/Appli/usbpd/STM32F072_MB1303_DRP_SRCING_DEVICE/STM32CubeIDE/STM32F072RBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="STM32F072_MB1303_DRP_SRCING_DEVICE.map" -Wl,--gc-sections -static -L../../../../../../../Middlewares/ST/STM32_USBPD_Library/Core/lib --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
/opt/st/stm32cubeide_1.9.0/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.linux64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: ./Application/User/usbpd_dpm_user.o: in function `USBPD_DPM_UserExecute':
/home/andres.oliva/Downloads/en.STSW-STUSB010/STSW_STUSB010_v1.3/Projects/STM32F072RB-Nucleo/Appli/usbpd/STM32F072_MB1303_DRP_SRCING_DEVICE/Src/usbpd_dpm_user.c:401: undefined reference to `USBPD_PE_SVDM_RequestIdentity'

Any clues? I expected this to work out-of-the-box. Thank you for your support!

2 REPLIES 2
AOliv.7
Associate

I found this post: https://community.st.com/s/question/0D53W000016p8ihSAA/unable-to-compile-stm32f072mb1303drp2ports-project-on-stm32cubeide

Turns out I had the same issue (which requires a pretty obscure fix if you ask me), and it did fix the compiler errors realted to the library not being linked, but now I'm getting this:

arm-none-eabi-gcc -o "STM32F072_MB1303_DRP_SRCING_DEVICE.elf" @"objects.list"  -l:USBPDCORE_PD3_FULL_CM0_wc32.a -mcpu=cortex-m0 -T"/home/andres.oliva/Downloads/en.STSW-STUSB010/STSW_STUSB010_v1.3/Projects/STM32F072RB-Nucleo/Appli/usbpd/STM32F072_MB1303_DRP_SRCING_DEVICE/STM32CubeIDE/STM32F072RBTX_FLASH.ld" --specs=nosys.specs -Wl,-Map="STM32F072_MB1303_DRP_SRCING_DEVICE.map" -Wl,--gc-sections -static -L../../../../../../../Middlewares/ST/STM32_USBPD_Library/Core/lib --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
/opt/st/stm32cubeide_1.9.0/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.linux64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: STM32F072_MB1303_DRP_SRCING_DEVICE.elf section `.text' will not fit in region `ROM'
/opt/st/stm32cubeide_1.9.0/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.linux64_1.0.0.202111181127/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: region `ROM' overflowed by 12936 bytes
collect2: error: ld returned 1 exit status
make: *** [makefile:76: STM32F072_MB1303_DRP_SRCING_DEVICE.elf] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.

I find it unsettling that the examples don't build out-of-the-box to be honest. What's the point of including examples that supposedly can run on the given hardware (I'm testing on a P-NUCLEO-USB002), if the example doesn't even fit in the flash of the devkit?

NBALL
ST Employee

Hello

Seems that you use CubeIDE with debug option and without any optimization: that's reason why you get this error.

Best regards