Skip to main content
Muzahir Hussain
Associate III
November 27, 2017
Question

How to access local C variables in Inline-Assembly?

  • November 27, 2017
  • 1 reply
  • 921 views
Posted on November 27, 2017 at 21:46

How do I access local C variables in Keil using ARM inline Assembly?

#arm #keil #assembly
This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
November 27, 2017
Posted on November 27, 2017 at 22:30

Don't have tools to hand, but wouldn't these work?

unsigned int foo = 1234;

  LDR R0, =&foo

  LDR R0,[R0]

 MOV R4, param1

If not, try reading the docs.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
November 28, 2017
Posted on November 28, 2017 at 02:37

unsigned int bar(unsigned int r0)

{

  unsigned int r1;

  unsigned int r4 = 1234;

    

    __asm

    {

        mov r1, r0

        add r1, r4

    }

    

  return(r1);

}
Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..