Crash Course on "ARM and Thumb"
You might want to get a few books, these three are very, very, very good: http://www.keil.com/books/armbooks.asp and read for some time, but meantime here is a crash course:
There are two (2) states of ARM processors: ARM and Thumb.
There are seven (7) modes: usr, sys, svc, abt, fiq, irq and und.
The modes can be privileged and non-privileged (usr).
Privileged modes can modify CPSR_c (least sig. byte) of CPSR, usr mode cannot do that.
Why? Safety/security reasons. The bits in CPS_c control the interrupts and mode/state switching.
Most (or some) people get sloppy with saying modes and meaning states
and vice versa. But as Alice in Wonderland was instructed by March Hare and Hatter:
"...at least I mean what I say - that's the same thing, you know." "Not the same thing a bit!" said the Hatter. "Why, you might just as well say that 'I see what I eat' is the same thing as 'I eat what I see'!"
I hope this helps you to see my point, it is not for the sake of appearing pedantic.
* __arm or__thumb does not metter to compiler.
That is because IAR had made it [more] transparent to programmer to compile for either ISA (Instruction Set Architecture).
Thumb gives less code then ARM.BINGO!
That is the whole idea behind Thumb. This ISA is 16-bit, whereas ARM is 32-bit. Not all instructions from ARM map in one-to-one fashion to Thumb. ARM instruction can be executed conditionally, Thumb instruction cannot, just piggyback the one-of-16 conditions after the mnemonic. Back to the code size saving, it will not be 2:1 ratio, either. It depends on the the program.
Sunday, November 12, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment