Jan Thogersen wrote: > How come it takes 3 instruction to load the correct address into r2. > First it moves #0xE0000000 to r2, then adds #0x00004000 and finally adds > #0x00000018 to end up with #0xE0004018 which is the address of T0MR0. > But why don't it just move #0xE0004018 into the r2 in the first instruction? It's because of the way ARM instructions are encoded. Each instruction is exactly 32 bits long, so there's no way to load a 32 bit constant. <http://www.heyrick.co.uk/assembler/qfinder.html> The ARM move instruction actually works out to something like: Move 8 bit value into Rn shifted by up to 31 bits. <http://www.heyrick.co.uk/assembler/mov.html#mov> Here's a quick reference card in PDF format: <http://www.arm.com/pdfs/QRC0001H_rvct_v2.1_arm.pdf> Hope this helps. Ralph
Message
Re: [lpc2000] Strange GCC compiler assembler output
2006-05-03 by Ralph Hempel
Attachments
- No local attachments were found for this message.