inline assembly in ARM Cortex to load address of a C variable to register

Status
Not open for further replies.

doubtsman

Newbie
Joined
Oct 28, 2020
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
14
Hi,

I am trying to load address of a C variable to register R3 using inline assembly using arm-none-eabi-gcc toolchain for cortex m4 microcontroller.

I am able to load the value of the variable but not sure how to load the address of variable. Any tips ?


C:
volatile uint32_t val = 100;


asm("ldr    r3, %[value]"
    :
    : [value]"m"   (val) /* How to copy address of val to r3 ?*/
    : /* No clobbers */
   );
 




Regards, Dana.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…