AnsweredAssumed Answered

structure packing on ADSP-TS201

Question asked by kjd@ngc on Feb 3, 2012
Latest reply on Feb 20, 2012 by CraigG



I have inherited some DSP code (written in C) and am adding additional functionality.  The platform is ADSP-TS201.  One simple function I need to perform is to accept a message from another processor in the system, extract a data structure, and send that data structure to an FPGA via a DMA write.  My issue is that this data structure is comprised of a variety of ints, short ints, chars, arrays of short ints, etc.  After writing the code I learned that this DSP will instantiate this struct by allocating 32 bits for each element, effectively adding internal padding to much of the data.  How can I force the DSP to "pack" a structure so that a 16-bit element is allocated 16 bits in memory?  I read about a "byte addressing mode" for the DSP but there was a vague caveat about "performance degradation", and I would prefer not to alter the way the DSP performs every memory allocation.