Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

ldr rd,=value.....how does it work?

2006-05-18 by nonuckingfumber

I am using the GNU toolchain and I want to do some ARM assembler code
for an FIQ handler that must be lean and mean.

I must say that the ARM documentation for the assembler seems to be
pretty thin and cryptic (hint, does anybody know a good guide to ARM7
assembler ;-)

Anyway, more or less I have got the grasp of it, including the fact
that it only does single word instructions and it is therefore
impossible to load a 32bit constant. I have seen that there are ways
to load parts of a word, and thus form a 32bit constant with several
instructions.

But my problem is getting a C pointer into a register. For example I
have a global C pointer thus:

int *foo;

so I would expect the adress of foo to be a constant _foo to the
assembler. Now I would like to load the contents of the adress _foo
into a register.

Looking around at the few code snippetts I was able to find, I noticed
the use of instructions like:

ldr rd,=0x12345678

I cannot find any form of this apparant 32 bit immediate adressing
mode in the assembly tables. How does it work? Are there limitations?

Better still, what is the best way to achieve my goal (getting the
contents of a global C pointer variable into a register). It must be a
very common requirement!

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.