we can define the location of variables. But I have pre compiled function. I've looked at it's source:
void arm_lms_norm_f32(arm_lms_norm_instance_f32 * S,const float32_t * pSrc,float32_t * pRef,float32_t * pOut,float32_t * pErr,uint32_t blockSize)
float32_t *pState = S->pState; /* State pointer */
float32_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
float32_t *pStateCurnt; /* Points to the current sample of the state */
float32_t *px, *pb; /* Temporary pointers for state and coefficient buffers */
float32_t mu = S->mu; /* Adaptive factor */
uint32_t numTaps = S->numTaps; /* Number of filter coefficients in the filter */
uint32_t tapCnt, blkCnt; /* Loop counters */
float32_t energy;
...
As you can see we have variables with auto type (no matter static or auto) that I want is to place function variables to my desired memory section, how can I do that? Ia there any way?
I can use attribute to manage location of input variables, but not the variables inside function.
Function arguments and local non-static variables are on the stack - by definition, not "forced"; you cannot change this. More or less temporarily they may be (and are) placed by the compiler in processor's registers. No attribute may influence this behavior.
The section attribute may change the placement of code and static data only, where "static" means something different from static keyword in C language and includes all the items declared outside the functions, at file scope.
You can do it for static variables declared inside of a function but it requires slightly bigger effort. .DTCMRAM is not a section name. You should modify the linker script, create a section which will be put into DTCMRAM. You should also modify the startup module to initialize your new data section.
Local non-static variables are on the stack. There is one stack used by all the functions within a thread. It's a good idea to put stack in DTCM and you may do it easily by fiddling with .ld file. Static variables normally go to .data or .bss section. If you don't use DMA with these varaibles, they could also go to DTCM. You may easily put all the variables to DTCM by editing the .ld file but if you want to do it selectively (having some in DTCM and others in ordinary RAM), you need to apply section atributes, modify .ld file and modify the startup module to zero and/or initialize the extra sections you have added.
It might be a good idea to move all "normal" data to DTCM and to use normal RAM only for DMA buffers and big data structures by using section attributes only with them. Then maybe there will be no need to modify startup as you may probably initialize these big items explicitly in your code or maybe they don't need to be initialized at all.
Function arguments and local non-static variables are on the stack - by definition, not "forced"; you cannot change this. More or less temporarily they may be (and are) placed by the compiler in processor's registers. No attribute may influence this behavior.
The section attribute may change the placement of code and static data only, where "static" means something different from static keyword in C language and includes all the items declared outside the functions, at file scope.