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.

Alignment

How can I align static variables? I am using library functions which require aligned buffers for correct operations.

I do not want todefine the buffers as global variables. Is there a way to align buffers to DWORD boundary? What is the defualt alignment for static variables?

  • ziv said:

    How can I align static variables? I am using library functions which require aligned buffers for correct operations.

    I do not want todefine the buffers as global variables. Is there a way to align buffers to DWORD boundary? What is the defualt alignment for static variables?

    Data alignment can be performed by using a #pragma DATA_ALIGN(...) statement.  This is documented in the TMS320C6000 Optimizing Compiler v6.1 User's Guide (SPRU187) in Section 6.8.

  • You cannot use this pragma for variables defined as static.

  • Some alignment answers will depend on the processor target for which the code is being compiled. Which processor will you be using? I can guess C6000-family which does give most of the clue, but please be specific.

    Also, please see the C6000 Optimizing Compiler User's Guide, spru187, section 7.5.8.1 for information on automatic alignment. Depending on the processor, it is possible that your problem has already been solved.

    If you still need some ideas for forced alignment, please post the extra detail as well as examples of the buffer declarations that you want to have aligned.