2.3. Specifying the Compilation Target

The following command-line options specify the device being used and other characteristics about the hardware environment that the compiler should assume during compilation. These options determine which instruction set is used by the compiler and whether or not the compiler can assume the availability of floating-point hardware.

armcl Option (and alias)

tiarmclang Option

--silicon_version=<processor ID> (-mv<processor ID>)

-mcpu=<processor variant> -march=<architecture ID>

The armcl compiler allows you to indicate which architecture and processor variant combination to assume during compilation using the -mv option. The armcl compiler assumes a default of -mv4, but you can also choose -mv5, -mv5e, -mv6M0, -mv7M3, -mv7M4, -mv7R4, or -mv7R5.

The tiarmclang compiler provides two analogous options:

  • Use -mcpu to direct the compiler to target a particular processor variant. The tiarmclang compiler requires that a valid -mcpu or -march option be specified (or it will assume cortex-m4 if neither an -mcpu or -march option is provided). You may select one of the following: cortex-m0, cortex-m3, cortex-m4, cortex-r4, or cortex-r5. Each of the available arguments to the -mcpu option imply a specific -march option argument.

  • Use -march to direct the compiler to target a particular architecture. The tiarmclang compiler assumes armv7e-m (which corresponds to the cortex-m4 processor variant) if no -mcpu or -march option is specified. You may select one of the following: armv6-m, armv7-m, armv7e-m, and armv7-r.

Please note that the tiarmclang compiler does not provide support for armv4, armv5e, armv6, armv7-a. Likewise, it does not support any of the -march variants that are not mentioned above.

armcl Option

tiarmclang Option

--code_state=<16|32>

-mthumb -marm

The armcl compiler uses the --code_state option to select between THUMB (16) and ARM (32) mode. For targets such as Cortex-r4 and Cortex-r5that support both the ARM and T32 (THUMB) instruction sets, the default is the Arm instruction set.

Use tiarmclang’s -mthumb option to select the T32 instruction set. If a cortex-m3 or cortex-m4 argument is specified for the -mcpu option or an armv7-m or armv7e-m argument is specified for the -march option, then the tiarmclang compiler will assume that the -mthumb option is on.

armcl Option

tiarmclang Option

--float_support=<float hardware ID>

-mfloat-abi=<soft|hard> -mfpu=<float hardware ID>

The armcl compiler uses the --float_support option to indicate whether floating-point hardware is available and if it is available, which floating-point hardware it is.

The tiarmclang compiler separates these concerns into two command-line options:

  • Use the -mfloat-abi option to indicate whether floating-point hardware is available or not. You can specify one of two different arguments to the -mfloat-abi option:

    hard - asserts that floating-point hardware is available and will be identified by a corresponding -mfpu option. In addition, the compiler will use floating-point hardware registers to pass floating-point type arguments, and return floating-point type return values.

    soft - indicates that floating-point hardware is not available. This is the often the default argument in the case where no -mfloat-abi option is specified on the tiarmclang command-line.

  • Use the -mfpu option to specify which floating-point hardware is available for use by the compiler. This option is only valid when ‘-mfloat-abi=hard’ is also specified on the command-line. However, some processor variants, when specified with the -mcpu option will imply -mfloat-abi=hard and select the appropriate floating-point hardware to accompany the core processor specified. For example, -mcpu=cortex-m4 will imply -mfloat-abi=hard and -mfpu=fpv4-sp-d16 unless -mfloat-abi and/or -mfpu are explicitly specified on the tiarmclang command-line.

    Only a few of the processor cores supported by tiarmclang may be coupled with floating-point hardware:

    • cortex-m0: not compatible with any -mfpu

    • cortex-m3: not compatible with any -mfpu

    • cortex-m4: compatible with -mfpu=fpv4-sp-d16

    • cortex-r4: compatible with -mfpu=vfpv3-d16

    • cortex-r5: compatible with -mfpu=vfpv3-d16

For additional information about options that can be used to manage compiler behavior with respect to floating-point support, please see Managing Floating Point Support.

armcl Option (and alias)

tiarmclang Option

--endian=little (-me) --endian=big (default)

-mlittle-endian (default) -mbig-endian

By default, tiarmclang generates little-endian code. This is the opposite of armcl, which defaults to big-endian code.