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.

Problem while porting an IAR Project to CCE V3.1

Hi, I want to migrate an IAR Project to MSP 430 CCE V3.1.
For my IAR project I have defined some own data types which I often use in my application. This is one of my own data types:

// data type definitions
#ifndef __MY_DATATYPES__
 #define __MY_DATATYPES__
/* ============================================================================
// union to convert integer to two unsigned char or vice versa
// VALUE          : holds integer value
// LOWBYTE        : lowbyte of integer value
// HIGHBYTE       : highbyte of integer value
// ==========================================================================*/
  union SPLITINTTOBYTE
  {
    unsigned int VALUE;
    struct SPLIT
    {
      unsigned char LOWBYTE;
      unsigned char HIGHBYTE;
    }; // CCE V3.1 is outputting a warning ' expected an identifier' here; not on IAR
  };
#endif

When I want to use this data type it looks like:

unsigned char uclocal = 0;              // local variable
union SPLITINTTOBYTE ulocal;            // local union variable to split
                                        // integer to High- and Low-Byte

Now, I'd like to assign the value of LOWBYTE (the lowbyte of the integer variable 'VALUE') to my variable uclocal by using the instruction:

uclocal = ulocal.LOWBYTE;    

but this is resulting in an error message ' union "SPLITINTTOBYTE" has no field "LOWBYTE" '.

What am I doing wrong since this works as expected with the IAR toolchain but it will not work with CCE V3.1.

Thank you all in advance for 'showing me the light' by answering this question.

  • Hi

     

    Try this

    /* ============================================================================
    // union to convert integer to two unsigned char or vice versa
    // VALUE          : holds integer value
    // LOWBYTE        : lowbyte of integer value
    // HIGHBYTE       : highbyte of integer value
    // ==========================================================================*/
      union SPLITINTTOBYTE
      {
        unsigned int VALUE;
        struct
        {
          unsigned char LOWBYTE;
          unsigned char HIGHBYTE;
        }SPLIT;
      }SPLITINTTOBYTE;


    unsigned char uclocal = 0;                     // local variable
    union SPLITINTTOBYTE ulocal;            // local union variable to split
                                                                          // integer to High- and Low-Byte                                                          
                                                                                 
    void main(void)
    {
    uclocal = ulocal.SPLIT.HIGHBYTE; 
    ulocal.VALUE =0x1234;  
    }

     

     

    Best regards

    AES

**Attention** This is a public forum