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.

Compiler: How to allocate some variables at a specific memory location?

Other Parts Discussed in Thread: TMS320F28379D

Tool/software: TI C/C++ Compiler

Hallo everyone,
I'm working with the TMS320F28379D processor.
I would need to allocate C variables in addresses of the memory assigned by me: the variables must have a specific order.
What I see is that the compiler of the code composer moves the variables without keeping the order of the variables I have chosen.
How it is possible to declare variables by associating them with a specific memory location or at least make sure that the compiler
preserves the order of the variables as I chose?
Thanks in advance to those who want to help me.

  • I presume these are global variables, and not variables which are local to a function.  There are two methods to consider.

    One method is to use #pragma LOCATION.  Please search the C28x compiler manual for the sub-chapter titled The LOCATION Pragma.

    The other method is to define the variables in assembly code, then refer to them from C.  For details on this method, please see this forum post.

    Thanks and regards,

    -George