How i can read Stack pointer inside source file?
Do i need to write assembly code for reading stack pointer?
Regards,
Manoraj Selvaraj
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.
How i can read Stack pointer inside source file?
Do i need to write assembly code for reading stack pointer?
Regards,
Manoraj Selvaraj
Hi Manoraj,
Actually R13 of the core register will act as a stack pointer.
But the problem is TI CGT compiler will not support to directly copy the core register values to variables. And i also didn't found any code related to this in the past.
So, i did one method myself to do this. Here it is:
Here what i am doing is, i just declared one register variable, and i am indirectly copying R13 register value to that register variable. Once i moved value to that register variable then i can copy it again to any required variable.
You might confused here that, how would i know the register corresponds to the register variable, actually i didn't know that initially. I just did a debug one time and i saw the register for the variable Stack_Pointer_Temp in debug window and i stopped debug and i added the instruction below later
__asm__ volatile(" MOV R0, R13 \n");
So, it might or might not be same register in your case, you also should need to do a dummy debug to find out the register assigned to the "Stack_Pointer_Temp".
I am attaching my code for your reference:
Stack_Pointer_Value_Copying_to_Variable_LC4357.zip
--
Thanks & regards,
Jagadish.