Compiler

General limitations

  • Architectural support for TriCore™ v1.3 as integrated into AURIX™ TC1xxx parts has been dropped.

  • Support for the Circular Addressing Mode is not available.

  • The toolchain errata report is not available.

  • Extensions for building multi-core programs are not available. Building multi-core programs is still supported, the features removed were only to make building linker scripts easier and to restrict symbol scope to each core unless exported.

  • Optimization on source level.

    • The GCC toolchain allowed for different ways to use optimization directly in the source file or even different optimization levels in the same source file. These do not apply to our LLVM toolchain.

    • Examples of what no longer works: ` attribute optimize(argument)` which applies to one function and is included in its declaration; #pragma GCC optimize "<level>", a pragma instruction that can span several functions.

  • The LLVM toolchain does not include a separate assembler executable, it has been integrated into the clang compiler driver.

    • The clang integrated assembler accepts arguments with the syntax -xassembler <argument>, or -Wa,<argument>.

    • It is not possible to pass an argument for the assembler to generate listings, this can be done via the llvm-objdump binutil.

Options

-fshort-enums
GNU

This option is set by default.

LLVM

This option is set by default since version 6.1.0. Earlier versions default to a fixed 4-byte enum type. Please refer to the User Guide for more details about archive binary compatibility for current version.

-fshort-double

Supported since version 6.1.0

-march={tc161|tc162|tc18}

Mandatory option, there is no default value. Sets the base instruction set. Roughly equivalent to GCC’s -mtc.

-mcpu=<value>

Not available. Instead, select processor features with -march, -mfloat-abi and -merrata.

-mfloat-abi={hh64|hh32|ss64|ss32|hs64}

Select floating point capabilities. Limited to only those valid with selected -march setting.

-merrata={cpu141}

Since TriCore™ 1.3 is no longer supported, the only supported erratum workaround is 1.41 for TriCore™ 1.8 (TC49xA).

-maligned-data-sections

Not supported. Users can work around it with the option -fdata-sections to manually sort output sections to the memory layout and --sort-section=alignment to apply SORT_BY_ALIGNMENT to all wildcard section patterns in the linker script.

-mcode-pic, -msmall-pid, -mno-small-pid, -Winitialize-pid

Position-independent Data/Code are not available.

--relax

Not supported.

-mversion-string, -mversion-info

Not supported.

-mpragma-data-sections, -mpragma-function-sections

Not supported.

-mabs-const=<size>, -mabs-data=<size>

Not supported.

-finline-is-always-inline, -finline-is-externally-visible

Not supported.

-Q -O<optimization-level> --help=optimizers

Not supported.

C/C++

Nested functions

Function definitions inside the definition of another function are not supported.

Default standard version
GNU

gnu99, gnu9x (The 1999 ISO C standard plus GNU extensions).

LLVM

c11 (C as defined by the 2011 C standard).

#pragma

clang provides a different set of pragmas, including to set the section of an object. See the Pragma Section chapter in the User Guide for more details and examples for setting the section of an object with a pragma.

Code 1. For GNU:
#pragma section "<name>" [<flags>] [<alignment>]
<objects>
#pragma section
Code 2. For LLVM:
#pragma clang section [section_type_list]
<objects>

section_type_list defines a list of section names used for subsequent functions, global variables, or static variables. See the syntax below:

section_type="name"[ section_type="name"]

By specifying an empty string, "", for the name parameter, you revert to default section name.

Valid section types are:

  • bss

  • data

  • rodata

  • text

Attributes

asection

Not supported.

Attributepacked

Not supported.

interrupt/interrupt_handler

The LLVM toolchain implementation renames __attribute__ ((interrupt)) to __attribute__ ((jump_and_link))

Attribute interrupt_handler is unchanged.

longcall

Not supported.

Small Addressing Mode

Using variable attributes to enable small addressing

Code 3. For GNU:
char c attribute ((asection (".sdata.word", "a = 1", "f = aws")));
int c attribute ((asection (".sdata.word", "a = 4", "f = aws")));
Code 4. For LLVM:
__attribute__((smalldata)) int def_uninit; // using A0 as base
__attribute__((smalldata)) int def_init = 42; // using A0 as base
__attribute__((smalldata)) const int def_roinit = 42; // using A1 as base
__attribute__((smalldata ("a0"))) int foo; // using A0 as base
__attribute__((smalldata ("a8"))) extern int bar; // using A8 as base

Using special sections to enable small addressing

Code 5. For GNU:
#pragma section ".sdata.s16bit" 4 aws
char ch16 = 4;
short s16 = 5;
int i16 = 6;
#pragma section
void foo(void) {
    ch16 = 16;
    s16 = 16;
    i16 = 16;
}
Code 6. For LLVM:
#pragma clang section data=".sdata.s16bit"
char ch16 = 4;
short s16 = 5;
int i16 = 6;
#pragma section
void foo(void) {
    ch16 = 16;
    s16 = 16;
    i16 = 16;
}
always_inline
GNU

A function can be forced to be expanded inline by assigning it to the always_inline attribute. If this attribute is set for a function it will always be inlined, regardless of its size and the optimization level.

LLVM

This attribute suggests that the function should be considered for inlining at all optimization levels. However, it does not guarantee that the function will always be inlined.