Hi NXP,
AS I am working in MPC5777C controller, so I need to store a GPR1 value in to a C variable. I am doing this using Inline assembly functions....but I didn't get how to do so.
So can you please guide me that how can I store any GPR value into a C variable using Inline Assembly code only...coz I need to do so in a C project.
Hoping for your quick response.
Thanks & Regards,
Parth Rastogi
Hi, question is what you like to achieve.
If you want to have certain variable located in the GPR register, then you can simply register storage class.
Otherwise following code are being used for load of variable to the r31 register (where address points to the variable):
asm (lis r30, (address)@h);
asm (ori r30, r30, (address)@l);
asm (lwz r31, 0x0(r30));
Similar sequence for store operation:
asm (lis r30, (address)@h);
asm (ori r30, r30, (address)@l);
asm (stw r31, 0(r30));
Can u explain if suppose I am having one C variable "Var"
I want to store the value stored in R1 register into this local C variable "Var", how can I achieve this using Inline Assembly Code.
I just want to use GPR R1 and simply store its value to local C variable "Var" so that I can use this value in my C code further.