This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Named register variables

Hello! In one of my applications i need to copy value of a register in a C variable. Because I work with a LM3S811 I cannot use inline assembler (because it is not permitted when generating Thumb code), and the only solution (I guess) is to use " Named register variables". The problem is that in any situation returned value is the value of register r0.

int reg6(void)
{ register int reg __asm("r6");
return reg;
}

For example this function return the value of register r0.
Somebody can tell my why? There is another solution?

0