I’ve added support to the uLisp ARM assembler for additional Thumb-2 instructions, including the it (if-then-else) conditional execution instruction, instructions using the imm12 immediate format, and signed and unsigned division.
Introduction
The original ARM instruction set consisted of a small number of 32-bit instructions.
ARM subsequently released an alternative instruction set called Thumb (later referred to as Thumb-1) in which most of the instructions are 16 bit, resulting in more compact code, and this is the instruction set supported by the original uLisp ARM assembler.
A subsequent release called Thumb-2 extended the Thumb architecture by adding:
- A substantial number of 32-bit Thumb instructions covering most of the functionality of the original ARM instruction set, but without the condition field.
- Several 16-bit Thumb instructions. One of these, the it (if-then-else) instruction, provides an efficient alternative mechanism for conditional execution.
- An imm12 immediate format, allowing many commonly used 32-bit constant formats to be represented as the operand in 32-bit instructions.
I’ve implemented support for what I think will be the most useful Thumb-2 instructions for assembler programming in uLisp. For an explanation of the it instruction and imm12 format, a list of the additional instructions, and examples of how you might want to use them, see:
ARM assembler Thumb-2 extensions
Loading the Thumb-2 extensions
To add the Thumb-2 extensions load the standard assembler file first, followed by the extensions file, because some of the extensions add extended versions of the instructions in the main file.
Get the standard assembler file here: ARM assembler in uLisp.
Get the extensions here: ARM Thumb-2 extensions.
Note that these extensions require a board with an M4, M33, or later ARM processor. They won’t work on boards with an M0 or M0+ ARM processor.