8.26 --compatible=name

Generates code that is compatible with multiple target architectures or processors.

Syntax

--compatible=name

Where:

name

is the name of a target processor or architecture, or NONE. Processor and architecture names are not case-sensitive.

If multiple instances of this option are present on the command line, the last one specified overrides the previous instances.

Specify --compatible=NONE at the end of the command line to turn off all other instances of the option.

Usage

Using this option avoids having to recompile the same source code for different targets. You could apply this use to a possible target upgrade where a different architecture or processor is to be used in the future, without having to separately recompile for that target.

See the following table. The valid combinations are:

  • --cpu=CPU_from_group1 --compatible=CPU_from_group2.

  • --cpu=CPU_from_group2 --compatible=CPU_from_group1.

Table 8-2 Compatible processor or architecture combinations

Group 1 ARM7TDMI, 4T
Group 2 Cortex-M0, Cortex-M1, Cortex-M3, Cortex-M4, 7-M, 6-M, 6S-M, SC300, SC000

No other combinations are permitted.

The effect is to compile code that is compatible with both --cpu and --compatible. This means that only 16-bit Thumb instructions are used. (This is the intersection of the capabilities of group 1 and group 2.)

Note

Although the generated code is compatible with multiple targets, this code might be less efficient than compiling for a single target processor or architecture.

Examples

This example gives code that is compatible with both the ARM7TDMI processor and the Cortex-M4 processor.

armcc --cpu=arm7tdmi --compatible=cortex-m4 myprog.c
Related reference
8.38 --cpu=list
8.39 --cpu=name compiler option
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.