1.3.9. Passing Options to Other Tools from tiarmclang

This section of the tiarmclang Compiler User Manual describes how the tiarmclang’s -W<x>, and -X<y> options can be used to pass options from tiarmclang to other tools in the compiler toolchain.

1.3.9.1. Passing Linker Options: -Wl, and -Xlinker

While the -Wl, (W + lowercase L + comma) option allows you to pass multiple linker options from tiarmclang to the linker using a single instance of the -Wl, option, the -Xlinker alternative may be useful when you want to explicitly control each particular linker option in a tiarmclang command line.

1.3.9.1.1. Using the -Wl, Option

The tiarmclang -Wl, option can be used to identify one or more linker command line options to be forwarded from tiarmclang to the linker when the linker is invoked from the tiarmclang command line.

tiarmclang [options] [filenames] -Wl,*<opt-list>*

  • -Wl, - is the tiarmclang option that prefixes a list of linker options

  • <opt-list> - is a comma-separated list of one or more linker options

In the following example, the -Wl, option passes both the --rom_model linker option and the lnkme.cmd linker command file directly to the linker:

tiarmclang -mcpu=cortex-m0 hello.c -o a.out -Wl,--rom_model,lnkme.cmd

1.3.9.1.2. Using -Xlinker Options

Alternatively, you can use the tiarmclang -Xlinker option to identify a single linker command line option to be forwarded from tiarmclang to the linker when the linker is invoked from the tiarmclang command line.

tiarmclang [options] [filenames] -Xlinker <option>

  • -Xlinker - is the tiarmclang option that prefixes a single linker option

  • <option> - is the linker option to be passed to the linker

The example command for the -Wl, option could also be written using the -Xlinker option as follows:

tiarmclang -mcpu=cortex-m0 hello.c -o a.out -Xlinker --rom_model -Xlinker lnkme.cmd

You can find more information about linker options in the Linker Options section.

1.3.9.2. Passing Preprocessor Options: -Wp, and -Xpreprocessor

See Preprocessor Options for a list of options that can be used to control the preprocessor.

-Wp,<arg1>,<arg2>...

Pass the comma separated arguments in <argN> to the preprocessor.

-Xpreprocessor <option>

Pass <option> to the preprocessor.

1.3.9.3. Passing TI-Syntax Arm Assembler Options: -Wti-a, and -Xti-assembler

1.3.9.3.1. Using the -Wti-a, Option

The tiarmclang -Wti-a, option can be used to identify one or more legacy TI-syntax Arm assembler command line options that are to be forwarded from tiarmclang to the TI-syntax Arm assembler when it is invoked from the tiarmclang command line.

tiarmclang -x ti-asm <ti_asm_file> [options] [filenames] -Wti-a, <opt-list>

  • -Wti-a, - is the tiarmclang option that prefixes a list of legacy TI-syntax Ar assembler options

  • <opt-list> - is a comma-separated list of one or more TI-syntax Arm assembler options

1.3.9.3.2. Using -Xti-assembler Options

Alternatively, you can use the tiarmclang -Xti-assembler option to identify a legacy TI-syntax Arm assembler command line option that is to be forwarded from tiarmclang to the TI-syntax assembler when it is invoked from the tiarmclang command line.

tiarmclang -x ti-asm <ti)asm_file> [options] [filenames] -Xti-assembler <option>

  • -Xti-assembler - is the tiarmclang option that prefixes a single legacy TI-syntax Arm assembler option

  • <option> - is the option to be passed to the TI-syntax Arm assembler

1.3.9.3.3. Examples

While the -Wti-a, option allows you to pass multiple options from tiarmclang to the legacy TI-syntax Arm assembler in a single instance, the -Xti-assembler alternative may be useful in some instances where you want to explicitly control each particular TI-syntax Arm assembler option in a tiarmclang command line.

In the following example, the -Wti-a, option is used to pass both a -d and a --include_file option directly to the legacy TI-syntax Arm assembler:

tiarmclang -mcpu=cortex-m0 -c -x ti-asm ti_src.asm -Wti-a,-d=__ti__=1,--include_file=ti.inc

The above command could also be written using the -Xti-assembler option as follows:

tiarmclang -mcpu=cortex-m0 -c -x ti-asm ti_src.asm -Xti-assembler -d=__ti__=1 -Xti-assembler --include_file=ti.inc

You can find more information about TI-syntax Arm assembler options in the TI-Syntax Arm Assembler section or in the Arm Assembly Language Tools User’s Guide.