Oct 28, 2020 #1 D 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 */ );
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 */ );
Oct 28, 2020 #2 danadakk Advanced Member level 6 Joined Mar 26, 2018 Messages 3,107 Helped 414 Reputation 848 Reaction score 727 Trophy points 113 Activity points 13,452 How to access C variable for inline assembly manipulation? Given this code: #include <stdio.h> int main(int argc, char **argv) { int x = 1; printf("Hello x = %d\n", x); } I'd like to access and manipulate the variable x in inline assembly. stackoverflow.com Using Inline Assembly in C/C++ This article describes using inline assembly code in your C/C++ program... was it ever difficult for you, it will never be any more! www.codeproject.com Regards, Dana.
How to access C variable for inline assembly manipulation? Given this code: #include <stdio.h> int main(int argc, char **argv) { int x = 1; printf("Hello x = %d\n", x); } I'd like to access and manipulate the variable x in inline assembly. stackoverflow.com Using Inline Assembly in C/C++ This article describes using inline assembly code in your C/C++ program... was it ever difficult for you, it will never be any more! www.codeproject.com Regards, Dana.