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.

Compiler/TMS320F28377D: struct size too large

Part Number: TMS320F28377D

Tool/software: TI C/C++ Compiler

I think I have stumbled onto a bug in the C2000 compiler.  A following struct should be 3 MAUs in size, but instead it is 4 MAUs.

typedef struct {
    float test1;
    bool  test2;
} float_bool_t;

This can be seen by putting sizeof(float_bool_t) in the CCS Expression window as follows:

Note that a struct with float, bool, bool is also 4 MAUs:

typedef struct {
    float test1;
    bool  test2;
    bool  test3;
} float_bool_bool_t;

I have attached a example project demonstrating the problem using CCS 7.4.0.00015 and TI v18.1.0.LTS.

boot_float_struct.zip

-Joseph

  • It's not a bug. The compiler is required to round up the size of a structure to a multiple of the alignment of the most-strictly-aligned member, which in this case is "float," which has alignment 2 MAU. This is done so that arrays of structs behave properly.