Questions tagged [thumb]

A reduced instruction set for ARM processors (based on a 16-bit encoding, instead of 32 bits in standard ARM mode), originally intended for embedded systems with a small amount of RAM. Also for question with the later Thumb2 mixed 16 and 32 bit instruction modes. Consider the tags 'slider' and 'thumbnails' for other meanings of 'thumb'.

This tag is for questions concerning the ARM CPU's operating mode called thumb. Questions about thumb assembly language, interworking between thumb and ARM mode as well as operating system issue in dealing with thumb mode are on topic.

The Thumb instruction set (16 bit only) with restricted use of r8-r15 was later extended to include a mix of 16 and 32 bit instructions. This was called Thumb-2. Thumb-2 is a marketing term. Different CPU families and even specific devices have different instructions. Thumb-2 is fairly meaningless in a technical sense (except it means variable length instructions (always two halfwords) are available along with 16 bit thumb instructions). Thumb-2 at wikipedia

On modern ARM CPUs, Thumb-2 is as rich as the traditional 32-bit mode and much more memory efficient.

For questions related to the scrollbar thumbs consider one of,

For questions about thumbnails, use the tag .

See also:

The paper Profile guided selection of ARM and thumb instructions gives some benchmarking of legacy thumb versus 32 bit modes. Different algorithms are faster in one mode versus the other. The paper is somewhat obsolete as Thumb-2 will be more efficient in modern (2014+) CPUs. Although some deeply embedded devices may only support Thumb.

252 questions
1
vote
1 answer

How to minimize or eliminate ARM/Thumb far call patching?

I'm working on a product where both flash space (for firmware storage) and memory (for execution) are at a premium. Therefore I want the resulting ELF to be as small as possible without noticeably sacrificing product performance. The code is…
Andrew Cottrell
  • 3,312
  • 3
  • 26
  • 41
1
vote
2 answers

Does a pipeline stall occur on an ARM to Thumb switch?

In ARM architecture, if an ARM to Thumb mode switch occurs, will a pipeline stall occur? If so, how many cycles are affected? Is this same for Thumb to ARM mode switching ? Does this behavior vary with different ARM processors ?
rohit
  • 198
  • 1
  • 1
  • 7
1
vote
1 answer

ARM/Thumb-2 instruction set and assembly

First of all, I'm new when it comes to ARM assembly. I actually have some pieces of code written for ARM instruction set, but my target is a Cortex-M4 architecture using Thumb-2 instruction set. Do I have to re-write the whole code, change some of…
Zohra-tl
  • 53
  • 9
1
vote
1 answer

ARM Cortex-M4: issues met when calling printf in assembly

I am trying to call printf in ARM M4 assembly and meet some problems. The purpose is to dump content in R1. The code is like the following .data .balign 4 output_string: dcb "content in R1 is 0x%x\n", 0 .... .text .... push {r0,…
Eric Sun
  • 777
  • 6
  • 20
1
vote
1 answer

What does "THUMB" macro do in ARM-linux code?

I am looking at head.S ARM linux code. I know what thumb mode is. But there is one line such as THUMB(it eq) and it is a predefined macro as #define THUMB(x...) x The dotdotdot is actually written. Please tell me what the macro does. ENTRY(stext) …
1
vote
2 answers

Using B instructions in Cortex-M3 (thumb)

I read that in Cortex-M3 which is thumb only, whenever we write to PC, we must make sure the the target address LSB is a '1' to ensure the processor stays in thumb mode. Also, when we use 'BX reg', the reg values must have LSB = 1 to enable thumb…
foob
  • 293
  • 1
  • 4
  • 12
1
vote
1 answer

How does the instruction count increase for thumb as compared to arm instruction set?

I read in a research paper that when thumb instruction is used the code size reduces but sometimes this leads to an increased number of instructions thus making thumb slower to execute. But how does the instruction count increase? Is it something…
User1234321232
  • 517
  • 10
  • 25
1
vote
1 answer

iPhone Thumb & VFP

How do 'compile for Thumb' and VFP code relate to each other? on the iPhone 2G/3G, i know that the Thumb instructionset doesn't include floatingpoint calculations (on the 3GS, Thumb2 aparently has..). So what happens, if one compiles for thumb, but…
genesys
  • 3,557
  • 7
  • 29
  • 25
1
vote
1 answer

Decoding ARM instructions unambiguously

Currently I attempt to study the repartition of the instruction space or the ARMv7 processor, cf. documentation found here. There is a detail puzzling me currently, which is how the processor disambiguates between some pairs of instructions. Let's…
Dennis
  • 13
  • 2
1
vote
3 answers

Is ARM (not Thumb) supported on WinPhone8 at all?

I'm facing a weird issue, somewhat similar to this. I have a Windows Phone 8 native DLL project, mostly C++ but with an ARM assembly source in it. The source is in ARM mode (i. e. not Thumb). C++ is compiled to Thumb. The app crashes when C++ tries…
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
1
vote
1 answer

LPC 1769(cortex m3) Code Red IDE---No source available for g_pfnVectors() at0x0

I am trying to call a SVC from user mode with stack PSP . I observe the following error on debugging a code on LPC 1769(cortex m3)------- No source available for "g_pfnVectors() at 0x0" The IDE which I am using is CODE RED LPC Xpresso with LPC 1769…
gst
  • 1,251
  • 1
  • 14
  • 32
1
vote
2 answers

How is the "update condition flags" S encoded in the 16-bit Thumb-2 assembly instruction set?

So I need to write a very basic disassembler for class and I'm having a hard time figuring out how the S that can be appended to Thumb instructions is encoded. For example, the instruction 0x0011 corresponds with the following assembly code: movs …
tcdowney
  • 317
  • 2
  • 5
1
vote
1 answer

AT91SAM7x: DisASM chaos probably caused by linker

I use Eclipse and Yagarto toolchain (non-eabi, GCC 4.7.1) to program a ARM 7 chip (Atmel's AT91SAM7X256), Goal of this project is to place a bootloader in a defined range of ROM, which is copied to RAM later (see image below, ROM address 0x104000…
Paule
  • 13
  • 3
1
vote
2 answers

How to separate ARM instructions and data during dis-assembly

I am writing/(using binutils) a piece code to do an manual dis-assembly of thumb2(16bit and 32 bit) instructions. I am facing a problem to differentiate between genuine ARM instructions and DATA portions. The biggest problem is instructions are not…
user1468106
  • 33
  • 1
  • 3
1
vote
1 answer

Is it possible to generate separate .exe files for ARM and THUMB?

I have an embedded c++ project for WM6. In some devices I use a printer library that is not compatible with Linker settings "MACHINE:ARM". So I have to build 2 .exe files. One for THUMB machine and another for ARM machine that some lines of code…
Bob
  • 22,810
  • 38
  • 143
  • 225