cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with USB library on discovery f4 board

Bogdan
Senior
Posted on July 06, 2014 at 00:11

Hi guys, i`ve spent several hours trying to figure whats wrong in my initialization routine, but no luck at all...

Here is my code

#include ''system_stm32f4xx.c''
#include ''stm32f4xx.h''
#include ''usbd_cdc_core.h''
#include ''usbd_cdc.h''
#include ''usbd_usr.h'' 
#include ''usbd_desc.h'' 
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
#pragma data_alignment = 4 
#endif
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
__ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END;
void main() {
SystemInit(); 
USBD_Init(&USB_OTG_dev,
USB_OTG_FS_CORE_ID,
&USR_desc, 
&USBD_CDC_cb, 
&USR_cb);
}

Beside the files included in the project above there is nothing else included, only what you see. My problem is that the complier reports me with errors saying :

Building configuration: imu - Debug

Updating build tree... main.cpp Linking Error[Li005]: no definition for ''USBD_Init'' [referenced from C:\Users\Bogdan\Desktop\discovery F4\IMU Project\Debug\Obj\main.o] Error[Li005]: no definition for ''USR_desc'' [referenced from C:\Users\Bogdan\Desktop\discovery F4\IMU Project\Debug\Obj\main.o] Error[Li005]: no definition for ''USBD_CDC_cb'' [referenced from C:\Users\Bogdan\Desktop\discovery F4\IMU Project\Debug\Obj\main.o] Error[Li005]: no definition for ''USR_cb'' [referenced from C:\Users\Bogdan\Desktop\discovery F4\IMU Project\Debug\Obj\main.o] Error while running Linker Total number of errors: 4 Total number of warnings: 0

My question is where are these variabile defined? i tryied several projects from internet, and on all variants i get to this point.

Why is it saying that are not defined? When i try to complie the code, it complies, but when i try to build/burn to the board it reports me thouse errors. This is my first time i try to play with usb libs... thanks
3 REPLIES 3
rigomate2
Associate II
Posted on July 06, 2014 at 00:15

I'd advise you to download Atollic Truestudio Lite.

It does have lots of examples for the discovery board series, all guaranteed to work out of the box. Just import an example fror USB CDC, and have a look at it, how it should all function together.

Bogdan
Senior
Posted on July 06, 2014 at 12:35

Hello Mate,

yes i know what you mean.   I forgot to mention that i build the project with IAR ewarm 6.30 wich i have licence at work.

Tryied today to instal the trial version of iar 7.20, and the same error ocurs.

I was wondering if anyone had this issue before

Bogdan
Senior
Posted on July 07, 2014 at 05:51

Hello, after spending all night, i managed to work`it out with iar.

Since my experience with ide`s is quite small.. tought if i just use the #include ''.c/.h'' is ok, but after trying to port the same project in keil... the same errors there.

Then i started to creeate a ''add folder/file'' structure inside the workspace and after that the project worked perfectly...

Thanks