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.

Packed attribute working on TMS470 4.7.1 but not in 4.9.1

Other Parts Discussed in Thread: OMAP3530

I am using the Cortex A8 core on the OMAP3530. I am using the -gcc option and the packed struct attribute in my code. The code compiles without any problems in version 4.7.1 of the TMS compiler but it complains in 4.9.1. Could someone please point out why this was removed in a later version.

  • The packed attribute is still supported in compiler 4.9.x. Could you please post the full set of compile options used, as well as the complete error message output by the compiler? If possible, could you also attach the source file that generates the error so we can reproduce it? A preprocessed version of the source file would be best as it would pull in all the necessary includes.

  • Hello Aarti...Thx for the prompt reply.

    Following is the command used to compile this file

    'Building file: C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages/binarymessage.cpp'

    'Invoking: Compiler'

    "C:/Documents and Settings/ajjosep9.CCANET/CC4/ccsv4/tools/compiler/TMS470 Code Generation Tools 4.9.1/bin/cl470" -mv7A8 --code_state=32 --float_support=VFPv3 --abi=eabi -me -O4 --opt_for_speed=5 -g --include_path="C:/Documents and Settings/ajjosep9.CCANET/CC4/ccsv4/tools/compiler/TMS470 Code Generation Tools 4.9.1/include" --include_path="C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss" --fp_mode=strict --cpp_default --gcc --diag_warning=225 --enum_type=int --neon --preproc_with_compile --preproc_dependency="binarymessage.pp" "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages/binarymessage.cpp"

    "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages\binarymessage.hpp", line 77: error: invalid attribute for "BinaryMessage::CompositeNavMessageHeaderStruct"

    "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages\binarymessage.hpp", line 101: error: invalid attribute for "BinaryMessage::CompositeNavMessagePerObsStruct"

    "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages\binarymessage.hpp", line 144: error: invalid attribute for "BinaryMessage::CompositeNavMessageHeaderStruct_v1"

    "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages\binarymessage.hpp", line 183: error: invalid attribute for "BinaryMessage::CompositeNavMessagePerObsStruct_v1"

    "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages\binarymessage.hpp", line 227: error: invalid attribute for "BinaryMessage::CompositeNavMessageHeaderStruct_v2"

    "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages\binarymessage.hpp", line 268: error: invalid attribute for "BinaryMessage::CompositeNavMessagePerObsStruct_v2"

    6 errors detected in the compilation of "C:/Documents and Settings/ajjosep9.CCANET/cc4projects/gnss/outputmessages/binarymessage.cpp".

    >> Compilation failure

    gmake: *** [binarymessage.obj] Error 1

    Build complete for project gnssengineomap3525arm

    Following is the header file where the compiler complains

     

    #define PACKSTRUCT __attribute__ ((__packed__))

     

    class

    BinaryMessage

    {

    public:

    static const Uint32 CRC_SIZE = 4; //In bytes;

    static const Uint16 CompositeNavMessageId = 0xF001;

    static const Uint16 AcqInfoMessageId = 0xF002;

    struct HeaderStruct

    {

    Uint8 Preamble[4];

    Uint16 HeaderLength;

    //Includes Preamble and Checksum

    Uint16 MessageId;

    Uint32 MessageLen;

    // Excludes Header, but includes 32-bit CRC at the end

    Uint8 MsgVersion;

    Uint8 Reserved[2];

    Uint8 CheckSum;

    }PACKSTRUCT;

    typedef struct HeaderStruct Header;

    //CompositeNavMessage version 0

    struct CompositeNavMessageHeaderStruct

    {

    Uint32 GpsWeek;

    Uint32 GpsMs;

    Uint32 NumObs;

    ReceiverTypes::NavStateEnum NavState;

    ReceiverTypes::TripletStruct EcefPos;

    ReceiverTypes::TripletStruct LlhPos;

    double RxClockBias;

    ReceiverTypes::TripletStruct SmoothedEcefPos;

    ReceiverTypes::TripletStruct SmoothedLlhPos;

    double SmoothedRxClockBias;

    float HeightMsl;

    float SmoothedHeightMsl;

    ReceiverTypes::TripletStruct EcefVel;

    Uint16 AgcData[NUM_AD_BINS];

    }PACKSTRUCT;

    typedef struct CompositeNavMessageHeaderStruct CompositeNavMessageHeader;

    struct CompositeNavMessagePerObsStruct

    {

    ReceiverTypes::SvId sv;

    ReceiverTypes::SatChan svChan;

    ReceiverTypes::TripletStruct satPos;

    ReceiverTypes::TripletStruct satVel;

    double satClockCorr;

    double psr;

    double ddr;

    double smoothPsr;

    double adr;

    float lockTime;

    float cnoDbHz;

    float azimuth;

    float elevation;

    float ionoCorr;

    float tropoCorr;

    float dllError;

    float pllError;

    ReceiverTypes::ChannelStateEnum state;

    Uint32 reserved;

    }PACKSTRUCT;

    typedef struct CompositeNavMessagePerObsStruct CompositeNavMessagePerObs;

     

     

     

    //version 1

    struct CompositeNavMessageHeaderStruct_v1

    {

    Uint32 GpsWeek;

    Uint32 GpsMs;

    Uint32 NumObs;

    ReceiverTypes::NavStateEnum NavState;

    ReceiverTypes::TripletStruct EcefPos;

    ReceiverTypes::TripletStruct LlhPos;

    double RxClockBias;

    ReceiverTypes::TripletStruct SmoothedEcefPos;

    ReceiverTypes::TripletStruct SmoothedLlhPos;

    double SmoothedRxClockBias;

    float HeightMsl;

    float SmoothedHeightMsl;

    ReceiverTypes::TripletStruct EcefVel;

    Uint16 AgcData[NUM_AD_BINS];

    double gpsHpl;

    double gpsVpl;

    double raimTestStat;

    ReceiverTypes::RaimStatus raimStatus;

    Uint32 maxFiqTimeUs;

    Uint32 maxFiqPeriodUs;

    Uint32 fiqHitCount;

    float aveFiqTime;

    Uint32 maxFpgaHandlerTimeUs;

    Uint32 maxSignalChannelTimeUs;

    Uint32 maxSatelliteChannelTimeUs;

    Uint32 maxChanMeasProcTimeUs;

    Uint32 maxNavProcTimeUs;

    float pdop;

    float hdop;

    float vdop;

    Uint32 buildId;

    FpgaConfigStruct fpgaConfig;

    //Uint32 reserved[2];

    }PACKSTRUCT;

    typedef struct CompositeNavMessageHeaderStruct_v1 CompositeNavMessageHeader_v1;

    struct CompositeNavMessagePerObsStruct_v1

    {

    ReceiverTypes::SvId sv;

    ReceiverTypes::SatChan svChan;

    ReceiverTypes::TripletStruct satPos;

    ReceiverTypes::TripletStruct satVel;

    double satClockCorr;

    double psr;

    double ddr;

    double smoothPsr;

    double adr;

    double rangeResidual;

    float lockTime;

    float cnoDbHz;

    float azimuth;

    float elevation;

    float unAugmentedIonoCorrection;

    float unAugmentedTropoCorrection;

    float dllError;

    float pllError;

    ReceiverTypes::ChannelStateEnum state;

    Uint32 reserved;

    float unAugmentedIonoVariance;

    float unAugmentedTropoVariance;

    float unAugmentedAirborneVariance;

    float unAugmentedClockEphemVariance;

    float sbasIonoCorrection;

    float sbasIonoVariance;

    float fastCorrValue;

    float fastCorrDegradation;

    float rangeRateCorrValue;

    float rangeRateCorrDegradation;

    float longTermCorrClockTimeError;

    float longTermCorrPosErrorX;

    float longTermCorrPosErrorY;

    float longTermCorrPosErrorZ;

    }PACKSTRUCT;

    typedef struct CompositeNavMessagePerObsStruct_v1 CompositeNavMessagePerObs_v1;

     

    struct CompositeNavMessageHeaderStruct_v2

    {

    Uint32 GpsWeek;

    Uint32 GpsMs;

    Uint32 NumObs;

    ReceiverTypes::NavStateEnum NavState;

    ReceiverTypes::TripletStruct EcefPos;

    ReceiverTypes::TripletStruct LlhPos;

    double RxClockBias;

    ReceiverTypes::TripletStruct SmoothedEcefPos;

    ReceiverTypes::TripletStruct SmoothedLlhPos;

    double SmoothedRxClockBias;

    float HeightMsl;

    float SmoothedHeightMsl;

    ReceiverTypes::TripletStruct EcefVel;

    Uint16 AgcData[NUM_AD_BINS];

    double gpsHpl;

    double gpsVpl;

    double raimTestStat;

    ReceiverTypes::RaimStatus raimStatus;

    Uint32 maxFiqTimeUs;

    Uint32 maxFiqPeriodUs;

    Uint32 fiqHitCount;

    float aveFiqTime;

    Uint32 maxFpgaHandlerTimeUs;

    Uint32 maxSignalChannelTimeUs;

    Uint32 maxSatelliteChannelTimeUs;

    Uint32 maxChanMeasProcTimeUs;

    Uint32 maxNavProcTimeUs;

    float pdop;

    float hdop;

    float vdop;

    Uint32 buildId;

    FpgaConfigStruct fpgaConfig;

    double sbasHpl;

    double sbasVpl;

    double hul;

    double vul;

    double hfom;

    double vfom;

    }PACKSTRUCT;

    typedef struct CompositeNavMessageHeaderStruct_v2 CompositeNavMessageHeader_v2;

    struct CompositeNavMessagePerObsStruct_v2

    {

    ReceiverTypes::SvId sv;

    ReceiverTypes::SatChan svChan;

    ReceiverTypes::TripletStruct satPos;

    ReceiverTypes::TripletStruct satVel;

    double satClockCorr;

    double psr;

    double ddr;

    double smoothPsr;

    double adr;

    double rangeResidual;

    float lockTime;

    float cnoDbHz;

    float azimuth;

    float elevation;

    float unAugmentedIonoCorrection;

    float unAugmentedTropoCorrection;

    float dllError;

    float pllError;

    ReceiverTypes::ChannelStateEnum state;

    Uint32 reserved;

    float unAugmentedIonoVariance;

    float unAugmentedTropoVariance;

    float unAugmentedAirborneVariance;

    float unAugmentedClockEphemVariance;

    float sbasIonoCorrection;

    float sbasIonoVariance;

    float fastCorrValue;

    float fastCorrDegradation;

    float rangeRateCorrValue;

    float rangeRateCorrDegradation;

    float longTermCorrClockTimeError;

    float longTermCorrPosErrorX;

    float longTermCorrPosErrorY;

    float longTermCorrPosErrorZ;

    float totalDegradation;

    float rsvd;

    }PACKSTRUCT;

    typedef struct CompositeNavMessagePerObsStruct_v2 CompositeNavMessagePerObs_v2;

    //AcqInfo Message

    struct AcqInfoMessageStruct

    {

    ReceiverTypes::SvId sv;

    ReceiverTypes::AcqInfoEnum acqInfoState;

    }PACKSTRUCT;

    typedef struct AcqInfoMessageStruct AcqInfoMessage;

    //All conversion routines

    // return the number of bytes used by this message

    // If the input buffer is less than the required number of bytes

    // then the function just returns with zero bytes

    // Conversion routines

    static Uint32 GenerateCompositeNavMessage(Uint8* buf,

    Uint32 bufSize,

    NavDataOutMsg* msg);

     

    static Uint32 GenerateAcqInfoMessage(Uint8* buf,

    Uint32 bufSize,

    AcqInfoMsg* msg);

     

    private:

    static void FillPreamble(Header* header);

    static void FillHeader(Header* header,

    Uint16 messageId,

    Uint32 messageLen,

    Uint8 version);

    static Uint32 GenerateCompositeNavMessage_v0(Uint8* buf,

    Uint32 bufSize,

    NavDataOutMsg* msg);

    static Uint32 GenerateCompositeNavMessage_v1(Uint8* buf,

    Uint32 bufSize,

    NavDataOutMsg* msg);

     

    static Uint32 GenerateCompositeNavMessage_v2(Uint8* buf,

    Uint32 bufSize,

    NavDataOutMsg* msg);

    };

     

  • Angelo,

    Please see this related thread which explains the reason for the error. Currently only up to 32-bit data sizes are supported with the packed attribute and your structures have some 64-bit types. This will be supported in the next compiler release scheduled for later this year. My guess is that CGT 4.6.x simply ignored the attribute and did not catch the error.