Keil Logo


Information in this article applies to:

  • ARM Development Tools any Version


I would like to understand why most (if not all) examples that are provided by Keil are for Thumb mode?

One key feature of ARM devices is execution speed. The Flash ROM size is typically not that important since you can get devices with more on-chip Flash ROM.

Is perhaps Thumb mode better than ARM mode in both size and performance?


There are several contrary statements in various ARM users manuals. Here are just two examples from Philips LPC2000 datasheets:

  • Thumb code is able to provide up to 65% of the code size of ARM, and 160% of the performance of an equivalent ARM processor connected to a 16-bit memory system.
  • For critical code size applications, the alternative 16-bit Thumb Mode reduces code by more than 30% with minimal performance penalty.

You need to keep in mind: fetching instructions is slower than executing instructions.

For the same program, more Thumb mode instructions are required than in ARM mode, but less code size is required since all Thumb instructions are just 16-bit (32-bit in ARM mode). Since less code size is required, more instructions can be fetched from code memory.

When Philips LPC2000 devices execute code from on-chip Flash at maximum clock (= 60MHz) the Flash sub-system delivers 128 bits (4 ARM or 8 Thumb instructions) at a rate of 20MHz. ARM code that executes sequentially requires no stalls (= waitstates for code fetching). But in real programs branches occur (conditional or sub-routine calls). For Thumb code more instructions can be fetched at the same time which requires less stalls. We do not have speed comparisons for Thumb vs. ARM, however Philips told us to focus on Thumb mode.

In reality there is minimal speed penalty in Thumb mode (compared to 35% size reduction). High-speed interrupts may be coded in ARM mode and the program may be stored in RAM using the CARM compiler attribute __ram. In this way, time-critical program parts use highest ARM execution speed whereas the majority of the code uses Thumb mode which gives the best code efficiency with minimal speed penalty.

Last Reviewed: Sunday, July 10, 2005

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.