a fix to IAR's incapability to force struct's member on specified alignment

This commit is contained in:
hathach 2014-03-12 14:28:43 +07:00
parent 9ba209cda0
commit b6e4c0d348
3 changed files with 303 additions and 293 deletions

View File

@ -67,11 +67,11 @@
#define TUSB_CFG_DEVICE_FULLSPEED 1 // TODO refractor, remove
//------------- CLASS -------------//
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
#define TUSB_CFG_DEVICE_HID_MOUSE 0
#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
#define TUSB_CFG_DEVICE_HID_MOUSE 1
#define TUSB_CFG_DEVICE_HID_GENERIC 0
#define TUSB_CFG_DEVICE_MSC 1
#define TUSB_CFG_DEVICE_CDC 0
#define TUSB_CFG_DEVICE_MSC 0
#define TUSB_CFG_DEVICE_CDC 1
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
@ -108,7 +108,7 @@
#error Please define USB RAM section
#endif
#elif __ICCARM__ // compiled with IAR
#elif defined __ICCARM__ // compiled with IAR
#if (TUSB_CFG_MCU == MCU_LPC43XX)
#define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")

View File

@ -53,7 +53,17 @@
//--------------------------------------------------------------------+
typedef struct {
ATTR_USB_MIN_ALIGNMENT msc_cmd_block_wrapper_t cbw;
#if defined (__ICCARM__) && (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX)
uint8_t padding1[64-sizeof(msc_cmd_block_wrapper_t)]; // IAR cannot align struct's member
#endif
ATTR_USB_MIN_ALIGNMENT msc_cmd_status_wrapper_t csw;
#if defined (__ICCARM__) && (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX)
uint8_t padding2[64-sizeof(msc_cmd_status_wrapper_t)]; // IAR cannot align struct's member
#endif
ATTR_USB_MIN_ALIGNMENT uint8_t max_lun; // can STALL for one LUN
uint8_t interface_number;