Team,
i am trying to make an example code for packed enumeration data type using MSP430 CGT v4.1.x. However it seems the compiler doesn't like it. Either i try to do this:
enum __attribute__((packed)) my_enum_1
{
ENUM_1_ZERO,
ENUM_1_ONE,
ENUM_1_TWO,
ENUM_1_THREE,
};
or this:
typedef enum __attribute__((packed))
{
ENUM_1_ZERO,
ENUM_1_ONE,
ENUM_1_TWO,
ENUM_1_THREE,
} my_enum_1;
the compiler will give error "#111 expected either a definition or a tag name".
However it will compile without error if i do this:
enum my_enum_1
{
ENUM_1_ZERO,
ENUM_1_ONE,
ENUM_1_TWO,
ENUM_1_THREE,
} __attribute__((packed));
or
typedef enum
{
ENUM_1_ZERO,
ENUM_1_ONE,
ENUM_1_TWO,
ENUM_1_THREE,
} __attribute__((packed)) my_enum_1;
but the map file still shows that my_enum_1 occupies two bytes of data instead of one byte which i would expect.
Any idea what i am doing wrong here? Thanks for the help.