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
4
votes
1 answer

Mixing ARM and THUMB instructions

I am trying to mix ARM and THUMB instructions in my assembly code. For example, in the following code I try to use both modes: .thumb @ .code 16 .section __TEXT,__text .globl mySymbol1 mySymbol1: .... .arm @ .code 32 .section…
user1165084
  • 97
  • 2
  • 7
3
votes
1 answer

Decoding BLX instruction on ARM/Thumb (IOS)

I've read through much of the ARM documentation but still having trouble decoding a BLX instruction. Here are two examples: __text:0000347C 02 F0 B2 ED BLX _objc_msgSend __text:0000469C 01 F0 A2 EC BLX …
Locksleyu
  • 5,192
  • 8
  • 52
  • 77
3
votes
2 answers

unshifted register required - Assembler throws error on the TST instruction

I am currently rewriting an algorithm from C to arm assembly (ARM Cortex M4 CPU). What does my code do? This algorithm takes an 8-bit number as input and starting from the right tells us what is the first bit that’s 0. Here are a few…
Kuba0040
  • 53
  • 5
3
votes
1 answer

Force LDR instruction to place value in literal pool in THUMB assembly

I'm trying to create a matching GBA disassembly using devkitpro, and I'm having trouble with the THUMB instruction LDR R1, =0x3FF. I want it to place 0x3FF in the literal pool and generate a PC-relative address, which is what the assembled version…
3
votes
1 answer

How can I check if a 3rd party static library for the iPhone SDK is compiled for Thumb?

I'm working with a development platform (monotouch) that does not allow me to link 3rd party libraries that are compiled for Thumb due to a bug in the apple linker. How can I determine if a library was compiled for thumb or not? Thanks!
3
votes
2 answers

Soft reset on a Cortex-M using GDB

I'm working on a set of debugging tools for some in-house Cortex-M4 cores. I'm building embedded (no OS) ELF images using a gcc/binutils toolchain and simulating them using a modified version of QEMU. I'm creating the interrupt vector tables at the…
3
votes
0 answers

How do you clear the branch predictor cache in a cortex-m7?

BPIALL is documented as not implemented, but the branch predictor is documented and easy to see in testing that it is implemented. The BTAC bits in the ACTLR work as described, you can basically disable it with one bit, and you can prevent new…
old_timer
  • 69,149
  • 8
  • 89
  • 168
3
votes
1 answer

decode ARM BL instruction

I'm just getting started with the ARM architecture on my Nucleo STM32F303RE, and I'm trying to understand how the instructions are encoded. I have running a simple LED-blinking program, and the first few disassembled application instructions…
Eric61392
  • 35
  • 2
  • 6
3
votes
1 answer

How can I put thumb conditional instruction into IT block

I'm porting some inherited codes to my current platform. When I compiling it, it reports some error about arm assembler codes. The message shows: | {standard input}:7236: Error: thumb conditional instruction should be in IT block -- `movne r0,r2' |…
Alan
  • 469
  • 10
  • 26
3
votes
1 answer

Usage of the .W suffix in ARM assembler

I'm reading the Instruction set manual, and am wondering about the .W suffix. The manual says: In some cases it might be necessary to specify the .W suffix, for example if the operand is the label of an instruction or literal data, as in the…
MightyPork
  • 18,270
  • 10
  • 79
  • 133
3
votes
1 answer

How to distinguish thumb instruction from arm instruction in an elf file?

As the title shows, I want to disassemble the ELF file, but I suffered a problem that I could not know which instruction is arm instruction and which is thumb instruction. Because the arm instruction is 32-bit, and the thumb instruction is 16-bit,…
user2301210
  • 399
  • 3
  • 12
3
votes
3 answers

Can _start be the thumb function?

Help me please with gnu assembler for arm926ejs cpu. I try to build a simple program(test.S): .global _start _start: mov r0, #2 bx lr and success build it: arm-none-linux-gnueabi-as -mthumb -o test.o test.S arm-none-linux-gnueabi-ld -o…
g3plc
  • 61
  • 6
3
votes
2 answers

ARM-C Inter-working

I am trying out a simple program for ARM-C inter-working. Here is the code: #include #include int Double(int a); extern int Start(void); int main(){ int result=0; printf("in C…
gst
  • 1,251
  • 1
  • 14
  • 32
3
votes
1 answer

THUMB push/pop instructions

I'm trying to create a factorial method using THUMB instructions, and I'm basically there. I just have one question about the PUSH/POP opcodes: if I stored the value of r0 in the stack using push (so push {r0}), can I later use pop {r1} to pull it…
2
votes
1 answer

Work around using custom image as default video thumb?

After uploading a new video in YouTube, three thumbnail images are generated automatically by YouTube. Unfortunately, these three images are often useless. Is there any workaround to use my own custom thumbnail image when using the embed code?
Fawadafr
  • 253
  • 1
  • 5
  • 11