views:

1539

answers:

2

Hello,

I'm now going to learn ARM Assembly, to develop for my Windows Mobile 5 iPAQ, but I have some questions:

  • What Are The Main Differences Between ARM Assembly and x86 Assembly?
    • Is Any Differences In The Interrupts(New Types)?
      • Which Are They And What Is The Meaning Of They?
    • Best Assembler To Compile And Where To Get It?
  • Where I Can Find Some Good Resources?

Thanks.

+20  A: 

Main differences:

  • ARM is a RISC style architecture - instructions have a regular size (32-bit for standard ARM and 16-bits for Thumb mode, though Thumb has some instructions that chew up 2 instruction 'slots')

  • up through at least ARM v5 architecture (I'm not sure what v6 does), the interrupt model on ARM is vastly different than on Intel - instead of pushing registers onto the stack, the ARM swaps to a different set of registers which 'shadow' the normal set. The mode of the processor determines which register file is visible (and not all registers are necessarily shadowed). it's a pretty complex arrangement. Newer ARM Architectures (v7 anyway) have an interrupt model that's closer to Intel's where registers are pushed on to the stack when an interrupt occurs.

Arm instruction have some interesting features that aren't in Intel's:

  • instructions have conditional flags built in - so each instruction can execute as a NOP if the specified condition flags don't match the current status register flag state (this can be used to avoid all those jumps around one or two instructions that you often see in Intel assembly).
  • the ARM has shifting logic that can be embedded as part of the instruction. So when using a register as a source operand, you can shift it as an intrinsic part of the instruction. This helps with indexing arrays, sometimes with arithmetic.

On the other side, the ARM can't do much with memory directly except load from and store to it. Intel assembly can perform more operations directly on memory.

Note that the ARM architecture version doesn't correspond directly to the actual ARM processor versions - for example, if I remember right the ARM7 is a architecture v5 processor. Personally, I find this far more confusing than it should be.

The ARM Architecture references are freely downloadable from http://www.arm.com. I also suggest getting copies of Hitex's guides to various ARM microcontrollers for a good starting point.

There have been several Stackoverflow questions regarding pointers to getting started with ARM. Reviewing them will give you a lot of good places to start:

Michael Burr
ARM7 is ARMv4.ARM9 is ARMv4T or ARMv5E. (E implies TDMI)"ARM<digit>" is the CPU family."ARMv<digit>" is the instruction set version.
Mads Elvheim
+2  A: 

You should also realise that ARM license their IP rather than produce chips. A licensee may configure their ARM core microprocessor in a number of ways. Most importantly w.r.t. your question is that the ARM core itself defines only two interrupts IRQ and FIRQ, most often, there is a vendor specific interrupt controller, so you need to know exactly whose microprocessor is used in your device if you need to know how to handle interrupts. iPAQ models have variously used Intel StongARM and XScale processors. If you want to develop at that level, you should download the user reference manual for the specific part.

All that said, interrupt services and device drivers are provided by the OS so you probably don't need to worry about such low level details. In fact I would question the choice of assembler as your development language. There are few reasons to choose assembler over C or C++, on ARM (the compiler will almost certainly out perform you in terms of code performance). Moreover on Windows Mobile, the most productive application level language is likely to be C#.

Clifford