This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How does THUMB instruction work to customize the code ??

what is the use of THUMB instructions??

  • If you're writing code for Cortex-M, you can only use Thumb (or Thumb2 for Cortex-M3 and later) instructions.

    If you're writing code for ARM7, you can use Thumb instructions to save space, however, you cant mix Thumb and 32-bit ARM instructions on ARM7; you'll need to use the BX instruction to change between Thumb and ARM mode.

    Thumb instructions on ARM7 are very limited. The high 8 registers are not easily accessed.

    Conditional execution is not available, so you will have to either use some tricks or use conditional branches instead.

    The barrel shifter is not available in Thumb either (only in Thumb2).

    If you want to write code in assembly language, I recommend you start with Cortex-M3 or Cortex-M4; they're quite easy to work with. My current favorite board is a small low-cost stm32f103 board, which you can use with breadboards. You only need a programming adapter to get started (for instance ST-Llink) and a software package (I use GCC and OpenOCD, but if you're on Windows, you should probably use the KEIL tools).