Assembly language interworking

The --apcs=/interwork command-line option enables the ARM assembler to assemble code that can be called from another processor 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, and returns from, 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 processor 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.

Because all ARM processors that support Thumb start in ARM state, you must use the BX instruction to branch and exchange to Thumb state, and then use the following assembler directives to instruct the assembler to switch assembly mode.

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

Show/hideSee also

Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0471G