In the arm instruction set, LDR is usually used as the loading command, but it can also be used as a pseudo command.
The form of the LDR pseudo command is "ldr rn, = expr ". The following is an example to describe its usage.
Count equ 0x40003100
......
LDR R1, = count
MoV r0, #0
STR r0, [R1]
Count is a defined variable with the address 0x40003100. This definition method is very common in assembly languages. If you have used a single-chip microcomputer, you should be familiar with this usage.
LDR R1, = count is to put the address of the variable count, that is, 0x40003100 into R1.
MoV r0, #0 is to put the immediate number 0 into R0. In the last sentence, STR r0, [R1] is a typical storage command that places the value in R0 to the storage unit with the value in R1 as the address. Actually, 0 is put in the storage unit with the address 0x40003100. The three commands are used to assign values to the variable count. It seems uncomfortable to assign values to a variable using three commands. This may be related to the arm's use of RISC.
The following is an example.
; Assign the Count value to R0
LDR R1, = count
LDR r0, [R1]
LDR R1, = count: how to assign the Count address to R1? If you are interested, see the compiled result. This command is actually compiled into a LDR command and a DCD pseudocommand.