4.1.2. Converting TI-Syntax Arm Instructions to GNU-Syntax Arm Instructions

By and large, Arm assembly language instructions can be assembled and encoded by both the armcl and the tiarmclang compiler toolchains without modifying the way the instruction is written in an assembly source file.

For example, the following sequence of Arm instructions will assemble successfully with either the integrated tiarmclang Arm assembler or the legacy TI-syntax Arm assembler (armasm):

my_memcpy:
           PUSH    {r4, lr}
           MOVS    r3, #0
_loop:     CMP     r2, r3
           IT      eq
           POPEQ   {r4, pc}
           LDRB    r4, [r1, r3]
           STRB    r4, [r0, r3]
           ADDS    r3, #1
           B       _loop

However, when converting legacy TI-syntax Arm assembly language instructions into GNU-syntax Arm assembly instructions, some minor differences may come into play …

4.1.2.1. Labels

For GNU-syntax Arm assembly language, labels must begin in column 0 and have a colon (‘:’) appended to them when assembled using the tiarmclang integrated assembler.

In legacy TI-syntax Arm assembly language a label must also begin in column 0, but the colon (‘:’) appended to the end of the label name is optional in legacy TI-syntax Arm assembly language.

The value assigned to the label name symbol that is followed by an Arm instruction will be given the value of the address where that instruction is placed at link-time.

4.1.2.2. Mnemonics

For GNU-syntax Arm assembly language, instruction mnemonic fields may begin in column 0, whereas in legacy TI-syntax Arm assembly language, the instruction mnemonic field cannot begin in column 0. You’ll note that since the rule on where the mnemonic field can begin for a legacy TI-syntax Arm instruction is more restrictive, it is safe to assume that an instruction mnemonic from a legacy TI-syntax Arm assembly source file will be portable to GNU-syntax Arm assembly.

4.1.2.3. Register Names

The legacy TI Arm syntax assembler recognizes some alternative names for common Arm registers. Listed below are the legacy TI-syntax alternative names and the common names for the Arm registers that they map to. When converting legacy TI-syntax Arm assembly into GNU-syntax Arm assembly, you may need to convert references to these alternate names to their common names:

  • Legacy TI-syntax: a1 - a4 -> GNU-syntax: r0 - r3

  • Legacy TI-syntax: v1 - v9 -> GNU-syntax: r4 - r12

  • Legacy TI-syntax: ap -> GNU-syntax: r7

  • Legacy TI-syntax: ip -> GNU-syntax: r12

4.1.2.4. Arm Instruction Set

You can find more information about the Arm instruction set in the Arm Developer’s Instruction Set Architecture page.