Forum Discussion
Altera_Forum
Honored Contributor
19 years agoHow to write 32bits constant into r2
Hi all, I'm using inline asm and hope to write a 32bits constant which is defined in *.c file into register r2. I have tried the following instruction, but compiler report error: ...
Altera_Forum
Honored Contributor
19 years agoyou need an extra '%' :
<span style="color:red">--- asm("movhi r2, %hiadj(%0)" :: "i" (0x1000000));
--- asm("addi r2, r2, %lo(%0)" :: "i" (0x1000000));
+++ asm("movhi r2, %%hiadj(%0)" :: "i" (0x1000000));
+++ asm("addi r2, r2, %%lo(%0)" :: "i" (0x1000000));
</span> Regards, --Scott