With a support entitlement you can also get direct access to our team of highly-qualified Arm experts 24-hours a day
Open a support case
How do I declare a variable in ARM inline Assembly?
And how do I move the value from register to variable and vice versa?
Looking for something like this,
variable: Word #22222222
mov r0, variable
mov variable, r0
What compiler and hardware platform are you using?
In general whatever the compiler one would normally declare any statics using C rather than in an asm. In gcc one would have to say the static is an input or output of the asm as appropriate.
Which complier version are you using?If your using Arm Compiler 5, you can use "Use MOV Rn, expression" which generates a load from a literal pool as stated in arminfo.emea.arm.com/.../chr1359124248868.html.
MOV Rn, expression
if you're using inline assembler in a C or C++ program, you should just define the variable in the C part of the code: static uint32_t variable = 0x22222222;For a separate module using the gnu assembler, data and program space get relocated at link time as appropriate for the chip, so you have to explicitly tell the assembler which "section" to put things in using ".data", ".text", or ".section" directives. It would look something like:
variable: .long 0x22222222 // global variable
ldr r1, =variable ;; get addr of variable from pc-relative constant
ldr r2, [r1] ;; get the actual value of variable
str r2, [r1] ;; store it back.