This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/OMAP-L138: error while adding usb files to bootloader

Part Number: OMAP-L138

Tool/software: TI C/C++ Compiler

i have a usb code which works fine in arm, now i want to integrate it in bootloader , unfortunately when i copied the library and some other header files related to usb to bootloader project it is showing lots of error. any help would be appriciated

Regards

Antony

  • //*****************************************************************************
    //
    //! This structure describes a generic descriptor header.  These fields are to
    //! be found at the beginning of all valid USB descriptors.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor (including this length byte) expressed
        //! in bytes.
        //
        unsigned char bLength;
    
        //
        //! The type identifier of the descriptor whose information follows.  For
        //! standard descriptors, this field could contain, for example,
        //! USB_DTYPE_DEVICE to identify a device descriptor or USB_DTYPE_ENDPOINT
        //! to identify an endpoint descriptor.
        //
        unsigned char bDescriptorType;
    }
    USBLIB_PACKED tDescriptorHeader;
    
    //*****************************************************************************
    //
    //! This structure describes the USB device descriptor as defined in USB
    //! 2.0 specification section 9.6.1.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  All device descriptors are
        //! 18 bytes long.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For a device descriptor, this will be
        //! USB_DTYPE_DEVICE (1).
        //
        unsigned char bDescriptorType;
    
        //
        //! The USB Specification Release Number in BCD format.  For USB 2.0, this
        //! will be 0x0200.
        //
        unsigned short bcdUSB;
    
        //
        //! The device class code.
        //
        unsigned char bDeviceClass;
    
        //
        //! The device subclass code.  This value qualifies the value found in the
        //! bDeviceClass field.
        //
        unsigned char bDeviceSubClass;
    
        //
        //! The device protocol code.  This value is qualified by the values of
        //! bDeviceClass and bDeviceSubClass.
        //
        unsigned char bDeviceProtocol;
    
        //
        //! The maximum packet size for endpoint zero.  Valid values are 8, 16, 32
        //! and 64.
        //
        unsigned char bMaxPacketSize0;
    
        //
        //! The device Vendor ID (VID) as assigned by the USB-IF.
        //
        unsigned short idVendor;
    
        //
        //! The device Product ID (PID) as assigned by the manufacturer.
        //
        unsigned short idProduct;
    
        //
        //! The device release number in BCD format.
        //
        unsigned short bcdDevice;
    
        //
        //! The index of a string descriptor describing the manufacturer.
        //
        unsigned char iManufacturer;
    
        //
        //! The index of a string descriptor describing the product.
        //
        unsigned char iProduct;
    
        //
        //! The index of a string descriptor describing the device's serial
        //! number.
        //
        unsigned char iSerialNumber;
    
        //
        //! The number of possible configurations offered by the device.  This
        //! field indicates the number of distinct configuration descriptors that
        //! the device offers.
        //
        unsigned char bNumConfigurations;
    }
    USBLIB_PACKED tDeviceDescriptor;
    
    //*****************************************************************************
    //
    // USB Device Class codes used in the tDeviceDescriptor.bDeviceClass field.
    // Definitions for the bDeviceSubClass and bDeviceProtocol fields are device
    // specific and can be found in the appropriate device class header files.
    //
    //*****************************************************************************
    #define USB_CLASS_DEVICE        0x00
    #define USB_CLASS_AUDIO         0x01
    #define USB_CLASS_CDC           0x02
    #define USB_CLASS_HID           0x03
    #define USB_CLASS_PHYSICAL      0x05
    #define USB_CLASS_IMAGE         0x06
    #define USB_CLASS_PRINTER       0x07
    #define USB_CLASS_MASS_STORAGE  0x08
    #define USB_CLASS_HUB           0x09
    #define USB_CLASS_CDC_DATA      0x0a
    #define USB_CLASS_SMART_CARD    0x0b
    #define USB_CLASS_SECURITY      0x0d
    #define USB_CLASS_VIDEO         0x0e
    #define USB_CLASS_HEALTHCARE    0x0f
    #define USB_CLASS_DIAG_DEVICE   0xdc
    #define USB_CLASS_WIRELESS      0xe0
    #define USB_CLASS_MISC          0xef
    #define USB_CLASS_APP_SPECIFIC  0xfe
    #define USB_CLASS_VEND_SPECIFIC 0xff
    #define USB_CLASS_EVENTS        0xffffffff
    
    //*****************************************************************************
    //
    // Generic values for undefined subclass and protocol.
    //
    //*****************************************************************************
    #define USB_SUBCLASS_UNDEFINED  0x00
    #define USB_PROTOCOL_UNDEFINED  0x00
    
    //*****************************************************************************
    //
    // The following are the miscellaneous subclass values.
    //
    //*****************************************************************************
    #define USB_MISC_SUBCLASS_SYNC      0x01
    #define USB_MISC_SUBCLASS_COMMON    0x02
    
    //*****************************************************************************
    //
    // These following are miscellaneous protocol values.
    //
    //*****************************************************************************
    #define USB_MISC_PROTOCOL_IAD   0x01
    
    //*****************************************************************************
    //
    //! This structure describes the USB device qualifier descriptor as defined in
    //! the USB 2.0 specification, section 9.6.2.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  All device qualifier
        //! descriptors are 10 bytes long.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For a device descriptor, this will be
        //! USB_DTYPE_DEVICE_QUAL (6).
        //
        unsigned char bDescriptorType;
    
        //
        //! The USB Specification Release Number in BCD format.  For USB 2.0, this
        //! will be 0x0200.
        //
        unsigned short bcdUSB;
    
        //
        //! The device class code.
        //
        unsigned char bDeviceClass;
    
        //
        //! The device subclass code.  This value qualifies the value found in the
        //! bDeviceClass field.
        //
        unsigned char bDeviceSubClass;
    
        //
        //! The device protocol code.  This value is qualified by the values of
        //! bDeviceClass and bDeviceSubClass.
        //
        unsigned char bDeviceProtocol;
    
        //
        //! The maximum packet size for endpoint zero when operating at a speed
        //! other than high speed.
        //
        unsigned char bMaxPacketSize0;
    
        //
        //! The number of other-speed configurations supported.
        //
        unsigned char bNumConfigurations;
    
        //
        //! Reserved for future use.  Must be set to zero.
        //
        unsigned char bReserved;
    }
    USBLIB_PACKED tDeviceQualifierDescriptor;
    
    //*****************************************************************************
    //
    //! This structure describes the USB configuration descriptor as defined in
    //! USB 2.0 specification section 9.6.3.  This structure also applies to the
    //! USB other speed configuration descriptor defined in section 9.6.4.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  All configuration descriptors
        //! are 9 bytes long.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For a configuration descriptor, this will
        //! be USB_DTYPE_CONFIGURATION (2).
        //
        unsigned char bDescriptorType;
    
        //
        //! The total length of data returned for this configuration.  This
        //! includes the combined length of all descriptors (configuration,
        //! interface, endpoint and class- or vendor-specific) returned for this
        //! configuration.
        //
        unsigned short wTotalLength;
    
        //
        //! The number of interface supported by this configuration.
        //
        unsigned char bNumInterfaces;
    
        //
        //! The value used as an argument to the SetConfiguration standard request
        //! to select this configuration.
        //
        unsigned char bConfigurationValue;
    
        //
        //! The index of a string descriptor describing this configuration.
        //
        unsigned char iConfiguration;
    
        //
        //! Attributes of this configuration.
        //
        unsigned char bmAttributes;
    
        //
        //! The maximum power consumption of the USB device from the bus in this
        //! configuration when the device is fully operational.  This is expressed
        //! in units of 2mA so, for example, 100 represents 200mA.
        //
        unsigned char bMaxPower;
    }
    USBLIB_PACKED tConfigDescriptor;
    
    //*****************************************************************************
    //
    // Flags used in constructing the value assigned to the field
    // tConfigDescriptor.bmAttributes.  Note that bit 7 is reserved and must be set
    // to 1.
    //
    //*****************************************************************************
    #define USB_CONF_ATTR_PWR_M     0xC0
    
    #define USB_CONF_ATTR_SELF_PWR  0xC0
    #define USB_CONF_ATTR_BUS_PWR   0x80
    #define USB_CONF_ATTR_RWAKE     0xA0
    
    //*****************************************************************************
    //
    //! This structure describes the USB interface descriptor as defined in USB
    //! 2.0 specification section 9.6.5.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  All interface descriptors
        //! are 9 bytes long.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For an interface descriptor, this will
        //! be USB_DTYPE_INTERFACE (4).
        //
        unsigned char bDescriptorType;
    
        //
        //! The number of this interface.  This is a zero based index into the
        //! array of concurrent interfaces supported by this configuration.
        //
        unsigned char bInterfaceNumber;
    
        //
        //! The value used to select this alternate setting for the interface
        //! defined in bInterfaceNumber.
        //
        unsigned char bAlternateSetting;
    
        //
        //! The number of endpoints used by this interface (excluding endpoint
        //! zero).
        //
        unsigned char bNumEndpoints;
    
        //
        //! The interface class code as assigned by the USB-IF.
        //
        unsigned char bInterfaceClass;
    
        //
        //! The interface subclass code as assigned by the USB-IF.
        //
        unsigned char bInterfaceSubClass;
    
        //
        //! The interface protocol code as assigned by the USB-IF.
        //
        unsigned char bInterfaceProtocol;
    
        //
        //! The index of a string descriptor describing this interface.
        //
        unsigned char iInterface;
    }
    USBLIB_PACKED tInterfaceDescriptor;
    
    //*****************************************************************************
    //
    //! This structure describes the USB endpoint descriptor as defined in USB
    //! 2.0 specification section 9.6.6.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  All endpoint descriptors
        //! are 7 bytes long.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For an endpoint descriptor, this will
        //! be USB_DTYPE_ENDPOINT (5).
        //
        unsigned char bDescriptorType;
    
        //
        //! The address of the endpoint.  This field contains the endpoint number
        //! ORed with flag USB_EP_DESC_OUT or USB_EP_DESC_IN to indicate the
        //! endpoint direction.
        //
        unsigned char bEndpointAddress;
    
        //
        //! The endpoint transfer type, USB_EP_ATTR_CONTROL, USB_EP_ATTR_ISOC,
        //! USB_EP_ATTR_BULK or USB_EP_ATTR_INT and, if isochronous, additional
        //! flags indicating usage type and synchronization method.
        //
        unsigned char bmAttributes;
    
        //
        //! The maximum packet size this endpoint is capable of sending or
        //! receiving when this configuration is selected.  For high speed
        //! isochronous or interrupt endpoints, bits 11 and 12 are used to
        //! pass additional information.
        //
        unsigned short wMaxPacketSize;
    
        //
        //! The polling interval for data transfers expressed in frames or
        //! micro frames depending upon the operating speed.
        //
        unsigned char bInterval;
    }
    USBLIB_PACKED tEndpointDescriptor;
    
    //*****************************************************************************
    //
    // Flags used in constructing the value assigned to the field
    // tEndpointDescriptor.bEndpointAddress.
    //
    //*****************************************************************************
    #define USB_EP_DESC_OUT                 0x00
    #define USB_EP_DESC_IN                  0x80
    #define USB_EP_DESC_NUM_M               0x0f
    
    //*****************************************************************************
    //
    // Mask used to extract the maximum packet size (in bytes) from the
    // wMaxPacketSize field of the endpoint descriptor.
    //
    //*****************************************************************************
    #define USB_EP_MAX_PACKET_COUNT_M       0x07FF
    
    //*****************************************************************************
    //
    // Endpoint attributes used in tEndpointDescriptor.bmAttributes.
    //
    //*****************************************************************************
    #define USB_EP_ATTR_CONTROL             0x00
    #define USB_EP_ATTR_ISOC                0x01
    #define USB_EP_ATTR_BULK                0x02
    #define USB_EP_ATTR_INT                 0x03
    #define USB_EP_ATTR_TYPE_M              0x03
    
    #define USB_EP_ATTR_ISOC_M              0x0c
    #define USB_EP_ATTR_ISOC_NOSYNC         0x00
    #define USB_EP_ATTR_ISOC_ASYNC          0x04
    #define USB_EP_ATTR_ISOC_ADAPT          0x08
    #define USB_EP_ATTR_ISOC_SYNC           0x0c
    #define USB_EP_ATTR_USAGE_M             0x30
    #define USB_EP_ATTR_USAGE_DATA          0x00
    #define USB_EP_ATTR_USAGE_FEEDBACK      0x10
    #define USB_EP_ATTR_USAGE_IMPFEEDBACK   0x20
    
    //*****************************************************************************
    //
    //! This structure describes the USB string descriptor for index 0 as defined
    //! in USB 2.0 specification section 9.6.7.  Note that the number of language
    //! IDs is variable and can be determined by examining bLength.  The number of
    //! language IDs present in the descriptor is given by ((bLength - 2) / 2).
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  This value will vary
        //! depending upon the number of language codes provided in the descriptor.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For a string descriptor, this will be
        //! USB_DTYPE_STRING (3).
        //
        unsigned char bDescriptorType;
    
        //
        //! The language code (LANGID) for the first supported language.  Note that
        //! this descriptor may support multiple languages, in which case, the
        //! number of elements in the wLANGID array will increase and bLength will
        //! be updated accordingly.
        //
        unsigned short wLANGID[1];
    }
    USBLIB_PACKED tString0Descriptor;
    
    //*****************************************************************************
    //
    //! This structure describes the USB string descriptor for all string indexes
    //! other than 0 as defined in USB 2.0 specification section 9.6.7.
    //
    //*****************************************************************************
    typedef struct
    {
        //
        //! The length of this descriptor in bytes.  This value will be 2 greater
        //! than the number of bytes comprising the UNICODE string that the
        //! descriptor contains.
        //
        unsigned char bLength;
    
        //
        //! The type of the descriptor.  For a string descriptor, this will be
        //! USB_DTYPE_STRING (3).
        //
        unsigned char bDescriptorType;
    
        //
        //! The first byte of the UNICODE string.  This string is not NULL
        //! terminated.  Its length (in bytes) can be computed by subtracting 2
        //! from the value in the bLength field.
        //
        unsigned char bString;
    }
    USBLIB_PACKED tStringDescriptor;

  • The team is notified. They will post their feedback directly here.

    BR
    Tsvetolin Shulev
  • hi tsvetolin,
    thanks

    Regards
    Antony
  • Anthony,

    You seem to either be developing your own code or using USBLIB from starterware for your development. Can you confirm.

    • If this you are not using starterware, please indicate which software package are you using ?
    • What boot mode are you trying to boot from?
    • Please describe in detail what procedure you used to try to boot load your application.

    If you are using Starterware, I recommend that you look at the flashing and bootloading procedure to load and run your application as described here:

    Regards,

    Rahul

  • Hi rahul
    Actually the problem was in the build settings, the language option was not selected, i changed it to "Relaxed parsing (non-strict ANSI) (--relaxed_ansi, -pr) ". finally all the errors flew away :)
    Thanks for your time and effort...

    Thanks & Regards
    Antony