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.
Tool/software: TI C/C++ Compiler
Hello, I am working on IIR Filter implementation where I am initializing filter coefficients and memory (form-2 w) memory as follows.
typedef struct { const _iq b_coeff[NUM_OF_COEFF]; const _iq a_coeff[NUM_OF_COEFF]; _iq w[NUM_OF_COEFF]; }IIR_FILTER;
Since, there are constants and static variables in structure. Usually compiler allocates Constants in FLASH (.cinit) and static in RAM (.ebss).
So, My question is how will the compiler allocate this since its a structure.
The const keyword inside the structure typedef has no effect. What matters is how you define complete instances with the type IIR_FILTER.
For example ...
const IIR_FILTER const_instance = { /* constants here */ };
If you use the const keyword, and explicitly initialize at least one of the members, then it is in the section .econst. Otherwise, it is in the section .ebss. Linker command files for C28x devices typically allocate .econst to FLASH and .ebss to RAM.
Thanks and regards,
-George