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.

5.0.0B1 OMAPL138/ARM Beta compiler challenges

Other Parts Discussed in Thread: OMAPL138

I’ve done my best to integrate the 5.0.0B1 beta compiler package into CCS 5.1.1.00031 to overcome the PACKED attribute problem when dealing with USB-related structures. I’m still working through some related compiler problems. Here’s the CCS Console listing generated when compiling usb_host_msc.c:
 'Building file: ../usb_host_msc.c'
'Invoking: ARM Compiler'
"C:\Program Files\Texas Instruments\TI ARM Code Generation Tools 5.0.0B1/bin/armcl" -mv5e --abi=eabi -me -g
--include_path="C:/Program Files/Texas Instruments/TI ARM Code Generation Tools 5.0.0B1/include"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/grlib/include"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/include"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/include/armv5"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/include/armv5/omapl138"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/include/hw"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/ipclite/include"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/nandlib/include"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/third_party/fatfs/src"
--include_path="C:/ti/OMAPL138_StarterWare_1_10_03_03/usblib/include"
--gen_acp_raw --diag_warning=225 --display_error_number --preproc_with_compile
--preproc_dependency="usb_host_msc.pp" --verbose  "../usb_host_msc.c"
TI ARM C/C++ Compiler                   v5.0.0B1
Tools Copyright (c) 1996-2012 Texas Instruments Incorporated
"C:/ti/OMAPL138_StarterWare_1_10_03_03/usblib/include/usbmsc.h", line 148: error #80: expected a type specifier
"C:/ti/OMAPL138_StarterWare_1_10_03_03/usblib/include/usbmsc.h", line 148: error #66: expected a ";"
2 errors detected in the compilation of "../usb_host_msc.c".

 

>> Compilation failure
gmake: *** [usb_host_msc.obj] Error 1

  

What follows is an excerpt from the raw listing file usb_host_msc.rl related to those errors:
N//*****************************************************************************
N//
N// The following packed structure is used to access the Command Block Wrapper
N// (CBW) data structure that is used when communicating with USB Mass Storage
N// Class devices.
N//
N//*****************************************************************************
Ntypedef struct
N{
N    //
N    // Signature that helps identify this data packet as a CBW.  The signature
N    // field shall contain the value 0x43425355 (little endian), indicating a
N    // CBW.
N    //
N    unsigned int dCBWSignature;
N
N    //
N    // The Command Block Tag sent by the host controller.  The device shall
N    // echo the contents of this field back to the host in the dCSWTag field
N    // of the associated CSW.  The dCSWTag positively associates a CSW with the
N    // corresponding CBW.
N    //
N    unsigned int dCBWTag;
N
N    //
N    // The number of bytes of data that the host expects to transfer on the
N    // Bulk-In or Bulk-Out endpoint (as indicated by the Direction bit) during
N    // the execution of this command.  If this field is zero, the device and
N    // the host will not transfer data between the CBW and the associated CSW,
N    // and the device will ignore the value of the Direction bit in
N    // bmCBWFlags.
N    //
N    unsigned int dCBWDataTransferLength;
N
N    //
N    // The device will ignore these bits if the dCBWDataTransferLength value
N    // is set to 0.
N    //
N    // The bits of this field are defined as follows:
N    // Bit 7 Direction
N    //   0 = Data-Out from host to the device,
N    //   1 = Data-In from the device to the host.
N    // Bit 6 Obsolete - The host shall set this bit to zero.
N    // Bits 5..0 Reserved - the host shall set these bits to zero.
N    //
N    unsigned char bmCBWFlags;
N
N    //
N    // The device Logical Unit Number (LUN) to which the command block is being
N    // sent.  For devices that support multiple LUNs, the host shall place into
N    // this field the LUN to which this command block is addressed.  Otherwise,
N    // the host shall set this field to zero.
N    //
N    unsigned char bCBWLUN;
N
N    //
N    // The valid length of the CBWCB in bytes.  This defines the valid length
N    // of the command block.  The only legal values are 1 through 16.  All
N    // other values are reserved.
N    //
N    unsigned char bCBWCBLength;
N
N    //
N    // This array holds the command block to be executed by the device.  The
N    // MSC device will interpret the first bCBWCBLength bytes in this field as
N    // a command block as defined by the command set identified by
N    // bInterfaceSubClass.  If the command set supported by the device uses
N    // command blocks of fewer than 16 bytes in length, the significant bytes
N    // shall be transferred first, beginning with the byte at offset 15.  The
N    // device will ignore the content of the CBWCB field past the byte at
N    // offset (15 + bCBWCBLength - 1).
N    //
N    unsigned char CBWCB[16];
E "C:/ti/OMAPL138_StarterWare_1_10_03_03/usblib/include/usbmsc.h" 148 3 expected a type specifier
E "C:/ti/OMAPL138_StarterWare_1_10_03_03/usblib/include/usbmsc.h" 148 10 expected a ";"
N} PACKED tMSCCBW;
X} __attribute__((packed)) tMSCCBW;
N
N
I see in the .rl that the “__attribute__((packed))“ string is being generated to replace PACKED, so that makes me feel comfortable that the appropriate compiler-sensitive branch is being taken in usblib.h. What else do I need to do to get the beta compiler to correctly accept “__attribute__((packed))” to handle the PACKED attribute without error?

 

Thanks,
Steve Schwab                  
Mustang Technology Group, LP
  • Hi Steve,

    Sorry for the late response as this thread as slipped through the cracks. I will move this thread to the compiler forum where the compiler experts can help you best.

    Thanks

    ki

  • Steve Schwab said:
    What else do I need to do to get the beta compiler to correctly accept “__attribute__((packed))” to handle the PACKED attribute without error?

    Add the compiler build option --gcc.  Right-click the project name and choose Build Options | Build | TMS470 Compiler | Language Options, then click the box titled Enable Support for GCC Extensions (--gcc).  The TI ARM compiler supports several extensions to the C language that were introduced by the GCC compiler.  Among them is the packed attribute.  These extensions are not supported by default; you have to use --gcc to enable them.  For more detail see this wiki page.

    Thanks and regards,

    -George