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.

TMS320F28335: unrecognized #pragma PACK while compiling!

Part Number: TMS320F28335

Hi all:

    The error happened when I try to solve the byte alignment  problem.

    I want to know the size of a struct such as below:

typedef struct
{
  U16 nNumber;                         /**< Event number */
  U16 nHours;                          /**< Time of operation (hours) */
  U32 pSamples;                        /**< Pointer to samples (U32) */
  U32 pVarList;                        /**< Pointer to list of values of selected variables (U32) */
  T_DATE_TIME tTime;                   /**< Date and time information */
  U16 nErr1[4];                        /**< Error status words */
  U16 nWar1[3];                        /**< Warning status words */
  U16 nInf1[1];                        /**< Information status word */
  U16 nErr2[2];                        /**< Error status words */
  U16 nWar2[1];                        /**< Warning status word */
  U16 nInf2[1];                        /**< Information status word */
  U16 nWar3[2];                        /**< Warning status words */ 
  U16 bEveAttr;				/* bEveAttr is not included within CRC*/
  #if (Q_DF_SW2_VER_DIS==402)
  U16 nCrc;
  #endif
} T_DIS_EVENTS_ARCHIVE;

The size of this struct should be 58 bytes but when I use the "sizeof()" to caculate this struct, the result is 60 bytes (30 words). it has 2 more bytes in real.

In this condition, I want word(16-bit) alignment cause this is DSP28335 platform, the unit is 16-bit.

The code I used is :

#pragma pack(1)

However, during the compiling the code, the error " unrecognized #pragma PACK " occured!

Does anyone know about that?

Best wish

Li