4.3 Assembly language interworking

There are several assembly language instructions that can cause a change between ARM and Thumb state.

The --apcs=/interwork command-line option enables the ARM assembler to assemble code that can be called from another instruction set state:

armasm --thumb --apcs=/interwork
armasm --arm --apcs=/interwork

In an assembly language source file, you can have several areas. These correspond to ARM Executable and Linkable Format (ELF) sections. Each area can contain ARM instructions, Thumb instructions, or both.

You can use the linker to fix up calls to routines that use a different instruction set from the caller. To do this, use BL to call the routine.

If you prefer, you can write your code to make the instruction set changes explicitly. In some circumstances you can write smaller or faster code by doing this. You can use BX, BLX, LDR, LDM, and POP instructions to perform the instruction set state changes.

The ARM assembler can assemble both Thumb code and ARM code. By default, it assembles ARM code unless it is invoked with the --thumb option.

The ARM and THUMB directives instruct the assembler to assemble instructions from the appropriate instruction set.

Non-ConfidentialPDF file icon PDF versionARM DUI0471M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.