cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB MSC +HID cause L6985E link error

Tai.Cheng Chung
Associate II
Posted on February 01, 2016 at 04:51

Hi:

 My project use STM32F427compiled at uVision 5.11, I use USB library V2.1.0 for MSC Host class. It builds OK and works OK. Then I try to merge HID host lib, now the compiler report link error L6985E when I add a line to change class callback function from USBH_MSC_cb to HID_cb (These two callback funs are from library example, which can build OK on original example. I can't see the relationship between link errorL6985E and HID host function. The reported address 0x40024000 location is at backup RAM, where I defined as a variable array, seems nothing to do with USB HID class.

Here is the link message:

compiling usbh_hid_mouse.c...

compiling usbh_usr_lcd.c...

linking...

.\OBJ\st_firmware.axf: Error: L6985E: Unable to automatically place AT section stm32variable.o(.ARM.__AT_0x40024000) with required base address 0x40024000. Please manually place in the scatter file using the --no_autoat option. 

Not enough information to list image symbols.

Finished: 1 information, 0 warning and 1 error messages.

''.\OBJ\ut80_st_firmware.axf'' - 1 Error(s), 11 Warning(s).  

The link error happens when I try to change class callback function depending on MSC or HID device after USB emulation.

void USBH_Process(USB_OTG_CORE_HANDLE *pdev , USBH_HOST *phost)

{

....

switch (phost->gState){

  

case HOST_IDLE :

....

break;

   

case HOST_DEV_ATTACHED :

....   

break;

    

case HOST_ENUMERATION:     

/* Check for enumeration status */ 

if ( USBH_HandleEnum(pdev , phost) == USBH_OK){

/* The function shall return USBH_OK when full enumeration is complete */

 

/* user callback for end of device basic enumeration */

phost->usr_cb->EnumerationDone();

if(UsbStatus.bi.port_status == USB_DEVICE_STICK){

USBH_SetClass(phost, &USBH_MSC_cb);

}

else{

USBH_SetClass(phost, &HID_cb);

// If remark this line, It builds OK.

}

 

phost->gState  = HOST_USR_INPUT;    

}

break;

....

....

where:

void USBH_SetClass(USBH_HOST *phost,  USBH_Class_cb_TypeDef *class_cb)

{

phost->class_cb = class_cb;

}

And the location for 0x40024000 is defined as: 

float backup[1024] __attribute__((at(0x40024000 )));

The clas callback function is:

typedef struct _USBH_Class_cb

{

  USBH_Status  (*Init)\

    (USB_OTG_CORE_HANDLE *pdev , void *phost);

  void         (*DeInit)\

    (USB_OTG_CORE_HANDLE *pdev , void *phost);

  USBH_Status  (*Requests)\

    (USB_OTG_CORE_HANDLE *pdev , void *phost);  

  USBH_Status  (*Machine)\

    (USB_OTG_CORE_HANDLE *pdev , void *phost);     

  

} USBH_Class_cb_TypeDef;

USBH_Class_cb_TypeDef  USBH_MSC_cb = 

{

  USBH_MSC_InterfaceInit,

  USBH_MSC_InterfaceDeInit,

  USBH_MSC_ClassRequest,

  USBH_MSC_Handle,

};

USBH_Class_cb_TypeDef  HID_cb = 

{

  USBH_HID_InterfaceInit,

  USBH_HID_InterfaceDeInit,

  USBH_HID_ClassRequest,

  USBH_HID_Handle

};

#stm32
0 REPLIES 0