This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Dear Mr/Ms; I am Truong, working at Vietnam human engineering in Vietnam. Now, I am using D32 Design Studio for programming MPC5777C micro controller (GNU C Compiler 4.9). I've already made a sample inline asm code in .C file ase bellow: void set_spr ( uint32_t spr_num, uint32_t val ) { asm volalatile ("mtspr %0, %1" : :"r"(spr_num), "r"(val) ); } This code does not work correct (It should work but not work). I found out the constraints operands [:"r"(spr_num),] is not correct. I thinks it better if spr_num is be referred as a constant not a register ( ex: mtspr 120, val ). But I don't know how to revise. I also referred on https://gcc.gnu.org/onlinedocs/gcc/Constraints.html#Constraints about PowerPC but I cannot understand clearly.So, could you please help me to explain about that? If you have the instruction about "constraints for asm operands" for MPC5777C micro controller, please provide me. Thank you.


Dear Mr/Ms;

I am Truong, working at Vietnam human engineering in Vietnam.
Now, I am using D32 Design Studio for programming MPC5777C micro
controller (GNU C Compiler 4.9). I've already made a sample inline asm
code in .C file ase bellow:
void set_spr ( uint32_t spr_num, uint32_t val )
{
asm volalatile ("mtspr %0, %1"
:
:"r"(spr_num), "r"(val)
);
}
This code does not work correct (It should work but not work). I found
out the constraints operands [:"r"(spr_num),] is not correct. I thinks
it better if spr_num is be referred as a constant not a register ( ex:
mtspr 120, val ). But I don't know how to revise.
I also referred on
https://gcc.gnu.org/onlinedocs/gcc/Constraints.html#Constraints
about PowerPC but I cannot understand clearly.So, could you please
help me to explain about that?
If you have the instruction about "constraints for asm operands" for
MPC5777C micro controller, please provide me.

Thank you.
--Tran Tu Truong--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]