0

While writing a code in ARMSIM, I want to label a particular memory location(say) 0x2000 as PATH and use it in the ARM assembly code in MOV, LDR,STR instructions. Please let me know if this is possible.

7
  • On ARM you use register-indirect addressing for loads and stores. Anyway, if you want to define a compile-time constant, use EQU (or whichever similar directive provided by ARMSIM). Commented Mar 2, 2016 at 14:34
  • The actual syntax is probably .equ PATH, 0x2000. Commented Mar 2, 2016 at 14:36
  • Thank you Michael and Jester. But this PATH label does not allow me use STR or LDR instructions with it. For example, STR R9,PATH and LDR R10,PATH to store some value in R9 at 0x2000 and then retrieve it. Commented Mar 2, 2016 at 15:33
  • Define "does not allow" ... do you get some error? If so, what exactly? Also note what Michael said ... you must load the address into a register first, as arm does not allow offsets in the range 0x2000. Commented Mar 2, 2016 at 15:38
  • ARMSIM displays - "Syntax Error, unexpected ident, expecting '[', or '=' " just below the STR R9, PATH line. Commented Mar 2, 2016 at 15:43

1 Answer 1

0

You can use this type of method also,

var1 DCD 0x00 var2 DCD 0x00 LDR R0,=var1 ; Address of var1 LDR R1,[R0] ; read var1 in to R1 LDR R0,=var2 ; base address of MyAsmVar LDR R2,[R0] ; Address of var2 

Reference: http://www.keil.com/forum/18423/declaring-variables-in-cortex-m3-assembly-language/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.