4. Migrating Assembly Language Source Code¶
Applications developed with the armcl compiler tools may include some source code written in assembly language. Within the scope of this migration guide, this will be referred to as legacy TI-syntax Arm assembly language. Legacy TI-syntax Arm assembly language is any assembly source that is currently accepted by the armcl compiler tools to produce a valid Arm object file. Such assembly source is likely to be rejected when you attempt to assemble it with the tiarmclang compiler tools.
In contrast, we’ll refer to the assembly language syntax accepted by the tiarmclang compiler tools as GNU-syntax Arm assembly source code.
So how does one use legacy TI-syntax Arm assembly source in a project to be built with the tiarmclang compiler tools? There are two choices to be considered:
Maintenance planned - If maintenance may be needed during the project life-cycle or if the existing assembly code is likely to be shared or reused by other projects built with the tiarmclang compiler tools, then we recommend that you translate existing legacy TI-syntax code into GNU-syntax Arm assembly source code. Translating most often occurs in either pure assembly source code files or in C/C++ source files that use embedded asm() statements. Translating Legacy TI-Syntax Arm Assembly to GNU-Syntax Arm Assembly provides more details about how to make your assembly source files tiarmclang-friendly for a project that is likely to be maintained over a long period of time.
Maintenance unlikely - If maintenance is unlikely during the life of the migrated project, then you can assemble the legacy TI-syntax assembly source using the standalone Arm assembler (armasm). This assembler is shipped as a separate executable with the tiarmclang compiler tools. The object files can then be fed into the link step for the application that is being built. You can also invoke the standalone TI-syntax Arm assembler from tiarmclang using the “-x ti-asm” option to identify TI-syntax assembly source files on the tiarmclang command line. The Invoking the TI-Syntax ARM Assembler from tiarmclang section provides more information about how to do this.
- 4.1. Translating Legacy TI-Syntax Arm Assembly to GNU-Syntax Arm Assembly
- 4.1.1. Assembly Source Anatomy
- 4.1.2. Converting TI-Syntax Arm Instructions to GNU-Syntax Arm Instructions
- 4.1.3. Converting TI-Syntax Assembly Directives to GNU-Syntax Assembly Directives
- 4.1.4. Converting TI-syntax Assembly Macros into GNU-syntax Assembly Macros
- 4.1.5. Predefined Assembler Symbols
- 4.2. Converting TI-Syntax ARM asm() Statements Embedded in C/C++ Source
- 4.3. Invoking the TI-Syntax ARM Assembler from tiarmclang