AnsweredAssumed Answered

STM32F4 Discovery __ALIGN_BEGIN USB_OTG_CORE_HANDLE Problem

Question asked by l..michael on Feb 10, 2013
Latest reply on Apr 12, 2013 by cal.phil
Hi,

I am working with  CooCox IDE an this USB project https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/DispForm.aspx?ID=1311 pulled from the STe2eCommunity. I had to add #include "stm32f4xx_conf.h" to several files and replace the startup_stm32f4xx.s (from the original Attolic-IDE code) by the startup_stm32f4xx.c from CooCox. Now the project is built successfully with following warnings: (not complete but) only regarding usbd_desc.c and usbd_req.h an all about differing  signedness of arguments for USBD_GetString.

 [cc] C:\CooCox\CoIDE\workspace\usb_2\K2_QUELLE\stm32f4-discovery-usb-cdc-example\stm32f4-discovery-usb-cdc-example\src\usbd_desc.c: In function 'USBD_USR_ProductStrDescriptor':
       [cc] C:\CooCox\CoIDE\workspace\usb_2\K2_QUELLE\stm32f4-discovery-usb-cdc-example\stm32f4-discovery-usb-cdc-example\src\usbd_desc.c:219:5: warning: pointer targets in passing argument 1 of 'USBD_GetString' differ in signedness [-Wpointer-sign]
       [cc] In file included from C:\CooCox\CoIDE\workspace\usb_2\K2_QUELLE\stm32f4-discovery-usb-cdc-example\stm32f4-discovery-usb-cdc-example\src\usbd_desc.c:25:0:
       [cc] C:\CooCox\CoIDE\workspace\usb_2\K2_QUELLE\stm32f4-discovery-usb-cdc-example\stm32f4-discovery-usb-cdc-example\Libraries\STM32_USB_Device_Library\Core\inc/usbd_req.h:86:6: note: expected 'uint8_t *' but argument is of type 'char *'
       [cc] C:\CooCox\CoIDE\workspace\usb_2\K2_QUELLE\stm32f4-discovery-usb-cdc-example\stm32f4-discovery-usb-cdc-example\src\usbd_desc.c:223:5: warning: pointer targets in passing argument 1 of 'USBD_GetString' differ in signedness [-Wpointer-sign]
       [cc] In file included from C:\CooCox\CoIDE\workspace\usb_2\K2_QUELLE\stm32f4-discovery-usb-cdc-example\stm32f4-discovery-usb-cdc-example\src\usbd_desc.c:25:0:

Nevertheless the project is bulit and the green LED starts blinking (as supposed) but the USB device is not recognized by Windows. Passing through the code I get underlined the following expressions:

__ALIGN_BEGIN USB_OTG_CORE_HANDLE  (found in main.c marked as syntax error)

and following this the USB descriptors in usbd_descr.c are also marked as syntax errors


/* USB Standard Device Descriptor */
__ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END =
  {
    0x12,                       /*bLength */
    USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/
    0x00,                       /*bcdUSB */
    0x02,
    0x00,                       /*bDeviceClass*/
    0x00,                       /*bDeviceSubClass*/
    0x00,                       /*bDeviceProtocol*/
    USB_OTG_MAX_EP0_SIZE,      /*bMaxPacketSize*/
    LOBYTE(USBD_VID),           /*idVendor*/
    HIBYTE(USBD_VID),           /*idVendor*/
    LOBYTE(USBD_PID),           /*idVendor*/
    HIBYTE(USBD_PID),           /*idVendor*/
    0x00,                       /*bcdDevice rel. 2.00*/
    0x02,
    USBD_IDX_MFC_STR,           /*Index of manufacturer  string*/
    USBD_IDX_PRODUCT_STR,       /*Index of product string*/
    USBD_IDX_SERIAL_STR,        /*Index of serial number string*/
    USBD_CFG_MAX_NUM            /*bNumConfigurations*/
  } ; /* USB_DeviceDescriptor */

Same goes for the other two USB descriptors following.

Any ideas if this is the problem and how to fix it?


Thanks for your help

Outcomes