Hi,
with the following sample code...
typedef __packed struct { uint8_t field_1; uint8_t field_2; uint8_t field_3; uint8_t field_4; } T_Sub; typedef __packed struct { T_Sub Sub; uint8_t field_1; uint8_t field_2; uint8_t field_3; uint8_t field_4; } T_Data; typedef __packed union { T_Data content; uint8_t buffer[sizeof(T_Data)]; } T_Union; const T_Union C_Union = { {1,2,3,4}, 1, 2, 3, 4, 5}; // The following (no union, just strcut) has the same problem /* typedef __packed struct { T_Data content; } T_Struct; const T_Struct C_Struct = { {1,2,3,4}, 1, 2, 3, 4, 5}; */
I get:
error: #146: too many initializer values
I'm using uVision4. The same code works on other compilers. I'm obviously missing something big but I can't figure what...