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 structures using XDC



Hello,

I posted on the RTSC board about the use of packed structures using XDC a couple of weeks ago:

http://www.eclipse.org/forums/index.php?t=msg&th=208292&start=0&S=34b884fdf82d843a471c87e59c394d45

but have yet to receive a reply.

I am trying to find out if there is anyway can I declare a structure to be packed within an XDC spec file.  If not, is the only work around to declare straight ".h" files for the structures I want to define using this variable? I would prefer a RTSC oriented solution.  I am aware that "packed" is a non-portable extension.

I am using Code Generation Tools 7.2.2, XDC tools 3.20.8.88, and  CCS 4.2.3.00004, with a C6472 target. 

Thanks for your help.

  • You've done your homework on this one, and you already know what the experts in this forum can tell you.  I'll ping some folks and try to get some attention to your question.

    Thanks and regards,

    -George

  • I did get a reply on the Eclipse board which I wanted to post here in case someone was looking for the answer.  I have not tried this yet, but will soon.  I may end up using straight .h file declarations, as this seems a bit on the complicated side.

    It is possible to define a packed data structure.  In fact, this is done by the xdc.runtime.Log module for Log_Event.  It takes some effort, however.  You must:
       1. define the type as an @Encoded type in the .xdc file (to tell
          the tools that you'll take care of definig the structure
          yourself)
       2. create two C headers files named Mod__prologue.h and
          Mod_epilogue.h, which contain the C definition of the
          structure
       3. define some functions in Mod.xs to tell the tools how the
          structure is aligned, its size and a C expression used to
          pack the structure when it is statically initialized.

    We have documentation about encoded type on the RTSCpedia:
       http://rtsc.eclipse.org/docs-tip/Using_Encoded_Types, and
       http://rtsc.eclipse.org/docs-3.16/XDCspec_-_@Encoded

    I hope this helps.

    dave russo