I am trying to run the example USB Stack code from the Baremetal SDK on the iMX6SL. I had hoped to use the CDC stack in an application but I cannot get the example code to run:
.../sdk/common/usb_stack/Device/app/cdc/virtual_com.c
I cannot get this code to run, does the usb_stack work with the iMX6SL? If not, is there any example code for the iMX6SL? I see the the sdk/drivers/usb/src/ files, but that code is not setup to handle an interrupt driven flow and it also is very specific the the HID class of devices. I has hoping to quickly get a CDC class going.
There is a packed structure that is defined in usb_devapi.h:
typedef struct _USB_EP_STRUCT
{
uint_8 ep_num; /* endpoint number */
uint_8 type; /* type of endpoint */
uint_8 direction; /* direction of endpoint */
USB_PACKET_SIZE size __attribute__ ((packed)) ; /* buffer size of endpoint */
} __attribute__ ((packed)) USB_EP_STRUCT, *USB_EP_STRUCT_PTR;
That is causing bad code to be generated. Using ARM gcc 4.8.3 creates code in several places that tries to access the 'size' attribute (which is a 16-bit halfword) and causes a misaligned data abort on the iMX6SL
For example, in the reset handler:
usb_class.c: void USB_Reset_Service (...)
and
usb_driver.c: uint_8 _usb_device_init_endpoint (...)
│0x80086c48 <_usb_device_init_endpoint+88> ldrb r3, [r11, #-25]
│0x80086c4c <_usb_device_init_endpoint+92> strb r3, [r11, #-20]
>│0x80086c50 <_usb_device_init_endpoint+96> ldrh r3, [r11, #-28] ;
│0x80086c54 <_usb_device_init_endpoint+100> strh r3, [r11, #-17] ; <------------- This is a half-word instruction on a byte aligned data address: 0x82272697
Note:
I have tried to call the following, but I still get the error.
//! @brief Disable aborts on unaligned accesses.
void disable_strict_align_check(void);