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

How can I manipulate with Register Banks ???

Dear All ,

Regards,

How can I insert and apply R0-R7 in
C programming ???
Because I receive an error when compiling .
EX. R0=5;

Thanks
Majid

Parents
  • If you're willing to settle for absolute register addresses, you could define variables at the first 8 or 32 memory locations. It'll be risky, as for all you know the code generator is simply going to reuse some register just after you write to it.

    As Hans says, as long as you're programming in C, why not just declare variables in C, and let the optimizer worry about register usage? The point of a high-level language is not to have to worry about such details.

    If you're trying to call assembler routines from C, it's generally easier to write the assembly routines to conform to the C parameter passing conventions (described in the compiler manual), rather than try to get the compiler to put parameters where the assembler routine expects them.

    (It might be nice if the Keil compiler were more flexible in this regard, but we have to work with we have.)

Reply
  • If you're willing to settle for absolute register addresses, you could define variables at the first 8 or 32 memory locations. It'll be risky, as for all you know the code generator is simply going to reuse some register just after you write to it.

    As Hans says, as long as you're programming in C, why not just declare variables in C, and let the optimizer worry about register usage? The point of a high-level language is not to have to worry about such details.

    If you're trying to call assembler routines from C, it's generally easier to write the assembly routines to conform to the C parameter passing conventions (described in the compiler manual), rather than try to get the compiler to put parameters where the assembler routine expects them.

    (It might be nice if the Keil compiler were more flexible in this regard, but we have to work with we have.)

Children
No data