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
8
votes
4 answers

iPhone compile for thumb

I've heard it might be a good idea to turn off "compile for thumb" in an iPhone target's settings to increase performance. I'm having some trouble finding this setting though. Since I couldn't find it in my current project, I decided to make a new…
quano
  • 18,812
  • 25
  • 97
  • 108
7
votes
1 answer

Is this a bug in GCC or is my code wrong?

I have this C code: int test(signed char anim_col) { if (anim_col >= 31) { return 1; } else if (anim_col <= -15) { return -2; } return 0; } That compiles to the following thumb code with -Os -mthumb using Android NDK…
richq
  • 55,548
  • 20
  • 150
  • 144
6
votes
3 answers

What do the abbriviations (Rn, Rd, ...) in the instruction set of ARM mean?

recently i checked the Instruction Set for an ARM Cortex-M3 processor. For example: ADD , , What do those abbriviations mean exactly? I guess they mean different kinds of addresses, like directely addressed, relatively addressed or…
Bil_Bomba
  • 183
  • 1
  • 8
6
votes
1 answer

Compile thumb1 only

How do I tell gcc to compile into Thumb1-only instructions? Everyone knows helloworld.c: #include main() { printf("Hello world"); } And this is my command line: user@debian-armel:~$gcc -mcpu=cortex-m3 -mthumb helloworld.c &&…
Alexander
  • 19,906
  • 19
  • 75
  • 162
5
votes
3 answers

difference between ldr and ldr.w

I recently had to debug a MachO binary and I came across the following instruction :- ldr.w r4, [r1, r0, lsl #2] I understand that ldr r4, [r1, r0, lsl #2] shifts r0 to the left two times, adds it to r1 and dereferences the result. How is ldr.w…
user277465
5
votes
3 answers

Why MOV instruction is replaced by ADD instruction

I have the following instruction: mov r1, r7 in my assembly code but after looking into disassembly, I've found that actual generated code was adds r1, r7, #0 I checked with ARMv6-M Architecture Reference Manual and I found out that there's MOVS…
vbezhenar
  • 11,148
  • 9
  • 49
  • 63
5
votes
1 answer

Why does a Cortex-M4 include ARM to Thumb glue in the linker script

We are working on some code for ARM Cortex M4 on a STM32 chip. My understanding is that Cortex-M4 has some 32-bit instructions but these are not 32-bit ARM instructions they are just a few special instructions. I thought the glue was for…
Marc
  • 1,159
  • 17
  • 31
5
votes
2 answers

GNU ARM assembler changes mov into adds?

community! I have the following one-line source file, called first.S mov R1, R2 I generate an object file as follows: $ arm-none-eabi-as -mcpu=cortex-m3 -march=armv7 -mthumb -c -o first.o first.S Then, I disassemble it. $ arm-none-eabi-objdump -d…
Alexandru N. Onea
  • 423
  • 2
  • 6
  • 18
5
votes
2 answers

ARM PC value after Reset

I am new to MCU and trying to figure out how arm (Cortex M3-M4) based MCU boots. Because booting is specific to any SOC, I took an example hardware board of STM for case study. Board: STMicroelectronics – STM32L476 32-bit. In this board when…
user2774767
  • 63
  • 1
  • 6
5
votes
3 answers

ARM Thumb mode: Code Size not decreasing

Guys, I have a project which I have compiled for the ARM Cortex-A8 processor. I'm making use of GCC to do this. Currently the size of my executable is 220.1 KB. Now I modify my makefile and I add the flag -mthumb, the makefile line looks somewhat…
HaggarTheHorrible
  • 7,083
  • 20
  • 70
  • 81
5
votes
1 answer

Function address in ARM assembly have one byte offset?

For example, I have the following assembly code got by objdump. The address of f() is 080001d4. But printf("%x", f) outputs 080001d5. And f() can be done by (*((int (*)())080001d5))() but (*((int (*)())080001d4))(). Why there is one byte offset in…
chaosink
  • 1,329
  • 13
  • 27
5
votes
1 answer

how can I tell if I am in ARM mode or Thumb mode in gdb?

when debugging ARMv7 binary with GDB, aside from looking the instruction length, is there a way to figure out which mode the CPU is currently in? (ARM, Thumb)
daehee
  • 5,047
  • 7
  • 44
  • 70
5
votes
3 answers

What's the meaning of W suffix for thumb-2 instruction?

There is a w suffix for thumb-2 instruction as below, how does it change the semantic of the instruction without it? The search result is very noisy and I didn't get the answer. addw r0, r1, #0
Thomson
  • 20,586
  • 28
  • 90
  • 134
5
votes
0 answers

What is the difference between -mno-thumb and GCC_THUMB_SUPPORT = NO

It seems there are two ways to turn off Thumb support in Xcode 4.5: Specifying the -mno-thumb flag in Build Settings/Other C Flags Setting GCC_THUMB_SUPPORT to NO in Build Settings/User-Defined Is there a difference between these two methods?
codeperson
  • 8,050
  • 5
  • 32
  • 51
4
votes
4 answers

Using thumb to move transformed control produces weird behavior

I've encountered a weird behavior when trying to use a thumb to move a control around on a canvas. When I add a control to a canvas and use Thumb DragDelta event to move it around everything looks good. But when I apply a rotate transform to the…
chiefanov
  • 1,044
  • 1
  • 10
  • 15
1
2
3
16 17