We use code composer 3.3 C compiler with tms470 ARM processor. How do we pack structures to avoid padding?
We tried __attribute__ ((__packed__)), but the code did not compile.
code snippet -
__attribute__ ((__packed__))struct ShadinFuelData_t{ INT8S UnitMeasure; INT8U TotalFuelRemainVal; FP32 TotalFuelRemain; INT8U TotalFuelFlowRateVal; FP32 TotalFuelFlowRate; INT8U Engine1FuelFlowRateVal; FP32 Engine1FuelFlowRate; INT8U Engine2FuelFlowRateVal; FP32 Engine2FuelFlowRate; INT8U TotalFuelUsedVal; FP32 TotalFuelUsed; INT8U Engine1FuelUsedVal; FP32 Engine1FuelUsed; INT8U Engine2FuelUsedVal; FP32 Engine2FuelUsed;};
Errors at teh first two lines -
error: expected a type specifiererror: unnamed prototyped parameters not allowed when body is presenterror: expected a "{"
What version of the TMS470 compiler are you using? The support for packed attribute is in 4.6.1 and higher. Please see this post. Note that is still only supported on ARM processors that implement unaligned access in the hardware, which I believe are Cortex A8 cores. If you are using ARM9, support for packed will appear in the next release of compile tools, v5.0.0 planned for June.
If a post answers your question please mark it with the "Verify Answer" button
Search the wikis for common questions: CGT, BIOS, CCSv3, CCSv4Track a known bug with SDOWP. Enter the bug id in the "Find Record ID" box