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.

TMS570LS3137-EP: static function's parameters are in CPU registers

Part Number: TMS570LS3137-EP


We are using TMS70ls3137 in our project and we are using CCS 10.1.1 for the development. While debugging the code we have observed that the static function's parameters are stored in CPU registers instead of stack. As per our testing strategy we wanted the local variables and functions parameters to be stored in stack, hence we are facing issue. is it possible to force the compiler to store the parameters in stack instead of Registers. 

I have attached snapshot for your reference, see the address field in expression window,

  • Hi Subash,

    The C function arguments are stored in MCU registers and also the stack space. The static variables are allocated memory in data section (.data), not stack section. 

    Before your code jumps to the first instruction of your function, the arguments are allocated to R0/R1/R3. When the code steps to the first instruction of your function, and expression window shows the memory address in the stack section.

  • As per our testing strategy we wanted the local variables and functions parameters to be stored in stack, hence we are facing issue. is it possible to force the compiler to store the parameters in stack instead of Registers. 

    What compiler optimisation level is used in your project?

    Based upon a simple test, using the TI ARM v20.2.5.LTS setting the Optimization Level to off should cause the compiler to store local variables and function parameters to be stored on the stack:

    Whereas at optimization level "0 - Register Optimization" or higher the compiler can store local variables and function parameters in registers.