Standard S32DS C/C++ Compiler

This Standard S32DS C/C++ Compiler page displays the build configuration settings that apply to the set up the Standard S32DS C/C++ Compiler tool .

Table 1. Application and Library Project Properties: Standard S32DS C/C++ Compiler
Setting Description
Command The command pattern for the ${COMMAND} variable. This variable is used in the Command line pattern field (below). Default patterns:
  • C compiler: ${cross_prefix}${cross_c}${cross_suffix}
  • C++ compiler: ${cross_prefix}${cross_cpp}${cross_suffix}

The patterns use the build variables specified on the Cross Settings page.

All options This read-only field aggregates all flags specified across all pages inside the compiler settings. The compiler will be called with these flags during the build process.
Command line pattern The command line pattern to call the compiler.

Default:

${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}

Dialect

The Dialect page specifies the programming language standard and options to which the Standard S32DS C/C++ Compiler will conform.

Table 2. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Dialect
Setting Description
Language standard The language standard to which the code should conform. The compiler accepts all programs that follow the specified standard plus GNU extensions that do not contradict it. Options:
  • C language: ISO C90/ANSI C89 (-std=c90), ISO C99 (-std=c99), ISO C11 (-std=c11)
  • C++ language: ISO C++98 (-std=c++98), ISO C++11 (-std=c++0x), ISO C++1y (-std=c++1y)

Default: no option selected (the factory GCC standard applies).

For more information, consult the GCC documentation at gcc.gnu.org.

Other dialect flags Additional dialect options. You can specify any language options supported by GCC. Consult the GCC documentation.

Preprocessor

The Preprocessor page specifies the settings required by the GCC compiler for preprocessing source files.

Table 3. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Preprocessor
Setting Description
Do not search system directories (-nostdinc) This option instructs the compiler to not search the system locations for header files. Only the locations specified on the Includes page will be searched.
Preprocess only (-E) This option instructs the compiler to preprocess source files without doing the compilation step.
Note: Selecting this option causes the linker to throw an error at build time. The linker expects an object file which is not created by the compiler.
Defined symbols (-D) The prioritized list of symbols defined as macros.

This option is similar to the #define directive but applies to all assembly-language modules in a build target.

Undefined symbols (-U) The prioritized list of canceled symbols, both built-in and defined with the -D option.
Do not search system C++ directories (‑nostdinc++) This option instructs the C++ compiler to not search the system locations for header files.

This option is only available for C++ projects.

Includes

The Includes page specifies header files to be used during compilation and the file paths to be searched for header files.

Table 4. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Includes
Setting Description
Include paths (-I) The prioritized list of directories to be searched for header files. These directories are searched before the standard system include directories.

Default paths: "${ProjDirPath}/include"

Include files (-include) The prioritized list of header files to be included.

Optimization

The Optimization page specifies optimizations run by the Standard S32DS C/C++ Compiler tool during the compilation of a program. Turning on optimization flags makes the C/C++ compiler attempt to improve the performance and code size at the expense of the compilation time and the ability to debug the program.

Table 5. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Optimization
Setting Description
Optimization level The level of optimization assigned for the compiler. Options:
  • None (-O0): Disables optimization. This option instructs the compiler to generate unoptimized, linear assembly-language code. This reduces the compilation time.
  • Optimize (-O1): The compiler performs all target-independent (non-parallelized) optimizations such as function inlining, omits all target-specific optimizations, and generates linear assembly-language code. Optimizing takes somewhat more time, and a lot more memory for a large function.
  • Optimize more (-O2): The compiler performs all optimizations, target-independent and target-specific, and outputs optimized, non-linear, parallelized assembly-language code. This option increases both the compilation time and the performance of the generated code.
  • Optimize most (-O3): The compiler performs all -O2 optimizations, after which the low-level optimizer performs global-algorithm register allocation. At this optimization level, the compiler generates code that is usually faster than the code generated from -O2 optimizations.
  • Optimize size (-Os): The compiler performs further optimizations designed to reduce the code size. At this optimization level, the compiler performs all -O2 optimizations that do not typically increase the code size. The resulting binary file has a smaller executable code size, as opposed to a faster execution speed.
Other optimization flags Additional optimization flags supported by GCC and not otherwise available on this page. Consult the GCC documentation at gcc.gnu.org.
'char' is signed (--fsigned-char) This option instructs the compiler to treat char strings as signed char strings.
'bitfield' is unsigned (-funsigned-bitfields) This option instructs the compiler to treat bit fields as unsigned.
Function sections (-ffunction-sections) This option instructs the compiler to place each function into a separate section in the binary artifact. Each function section will be given the name of the specific function placed in the section.
Note: This option makes the assembler and linker create larger object and executable files and work slower.
Data sections (-fdata-sections) This option instructs the compiler to place each data item into its own section in the output file. The name of the data item determines the section's name in the output file.
Note: This option makes the assembler and linker create larger object and executable files and work slower.
No common uninitialized (-fno-common) This option instructs the compiler to place uninitialized global variables in the data section of the object file rather than generating them as common blocks.

This has the effect that if the same variable is declared (without extern) in two different compilations, you get a multiple-definition error when you link them. In this case, you must compile with -fcommon instead. Compiling with -fno-common is useful on targets for which it provides better performance, or if you wish to verify that the program will work on other systems that always treat uninitialized variable declarations this way.

Do not inline functions (-fno-inline-functions) This option instructs the compiler to not consider any functions for inlining, even if they are not declared inline.
Assume freestanding environment (-ffreestanding) This option instructs the compiler to assert that compilation targets a freestanding environment.

This implies the use of the Disable builtin option (below). A freestanding environment is one in which the standard library may not exist, and the program startup may not necessarily be at main.

Disable builtin (-fno-builtin) This option instructs the compiler to not recognize built-in functions that do not begin with the __builtin_ as prefix.
Single precision constants (-fsingle-precision-constant) This option instructs the compiler to treat floating-point constants as single-precision instead of implicitly converting them to double-precision constants.
Link-time optimizer (-flto) This option instructs the compiler to run the standard link-time optimizer. When invoked with source code, it generates GIMPLE (one of GCC's internal representations) and writes it to special ELF sections in the object file. When the object files are linked together, all the function bodies are read from these ELF sections and instantiated as if they had been part of the same translation unit.
Disable loop invariant move (-fno-move-loop-invariants) This option instructs the compiler to disable the loop invariant motion pass in the RTL loop optimizer.

This option is available at optimization level “-O1”.

Debugging

The Debugging page specifies the debugging parameters to be used by the Standard S32DS C/C++ Compiler tool. The specified parameters affect the debugging information that will be available in the resulting build target: ELF executable file or A library file.

Table 6. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Debugging
Setting Description
Debug Level The debugging level assigned to the compiler. Options:
  • None: Disables output of debugging information to the build artifact.
  • Minimal (-g1): Enables the generation of minimum debugging information. This includes descriptions of functions and external variables and line number tables, but no information about local variables.
  • Default (-g): Enables the generation of DWARF 1.x conforming debugging information.
  • Maximum (-g3): Enables the generation of extra debugging information (such as all macro definitions) for the compiler to provide maximum debugging support.
Other debugging flags Additional debugging flags supported by GCC and not otherwise available on this page. Consult the GCC documentation at gcc.gnu.org.
Generate gcov information (-ftest-coverage -fprofile-arcs) This option tells the compiler to generate additional information (basically a flow graph of the program) and to include additional code in the object files for generating the extra profiling information. These additional files are placed in the directory where the object file is located.

The gcov code-coverage utility can use these additional files to test coverage of the program.

Debug format The debug information format to be used by the compiler when writing debug info to the produced ELF file. Options: Toolchain default, gdb, stabs, stabs+, dwarf-2, dwarf-3, dwarf-4.

Default: Toolchain default.

Warnings

The Warnings page specifies options used by the compiler to display warning messages during the compilation. These options specify what types of warning messages will be output in the console during the compilation.

Table 7. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Warnings
Setting Description
Check syntax only (-fsyntax-only) This option instructs the compiler to only check the code for syntax errors.
Pedantic (-pedantic) This option instructs the compiler to issue warnings when a program is rejected because of forbidden extensions or non-conformance to ISO C and ISO C++ standards.

Not all non-ISO constructs get warnings. To learn more, consult the GCC documentation at gcc.gnu.org.

Pedantic warnings as errors (-pedantic-errors) This option instructs the compiler to issue errors rather than warnings in cases described in the Pedantic option (above).
Inhibit all warnings (-w) This option instructs the compiler to inhibit all warning messages.
All warnings (-Wall) This options enables a group of GCC warning options on the compiler. This includes all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros. This also enables some language-specific warnings. To learn more, consult the GCC documentation at gcc.gnu.org.
Extra warnings (-Wextra) This option instructs the compiler to enable some extra GCC warning options that are not enabled by All warnings (above). For details, consult the GCC documentation at gcc.gnu.org.
Warnings as errors (-Werror) This option instructs the compiler to turn all warnings into hard errors.

The source code which triggers warnings will be rejected. The specifier for a warning is appended.

Implicit conversions warnings (-Wconversion) This option instructs the compiler to issue warnings for implicit conversions that may alter a value.

This includes conversions between real and integer, between signed and unsigned, and conversions to smaller types. No warning will be issued for explicit casts like abs ((int)x) and ui=(unsigned)-1, or if the value is not changed by the conversion.

Warn on uninitialized variables (-Wuninitialized) This option instructs the compiler to issue a warning if an automatic variable is used without first being initialized or if a variable may be clobbered by a setjmp call.
Warn on various unused elements (-Wunused) This option instructs the compiler to issue warnings if constructs are unused.
Warn if padding is included (-Wpadded) This option instructs the compiler to issue a warning if padding is included in a structure, either to align an element of the structure or to align the whole structure.
Warn if floats are compared as equal (-Wfloat-equal) This option instructs the compiler to issue warnings if floating-point values are used in equality comparisons.
Warn if shadowed variable (-Wshadow) This option instructs the compiler to issue a warning whenever a local variable or type declaration shadows another variable, parameter, type, or class member (in C++), or whenever a built-in function is shadowed.
Note: In C++, the compiler warns if a local variable shadows an explicit typedef, but not struct, or class, or enum.
Warn if pointer arithmetic (-Wpointer-arith) This option instructs the compiler to issue a warning about anything that depends on the size of a function type or of void.

GNU C assigns these types a size of 1, for convenience in calculations with void * pointers and pointers to functions.

Warn if suspicious logical ops (-Wlogical-op) This option instructs the compiler to issue warnings about suspicious uses of logical operators in expressions.

This includes using logical operators in contexts where a bit-wise operator is likely to be expected.

Warn if struct is returned (-Wagreggate-return) This option instructs the compiler to issue a warning if any functions that return structures or unions are defined or called.
Warn on undeclared global function (-Wmissing-declaration) This option instructs the compiler to issue a warning if a global function is defined without a previous declaration.

Use this option to detect global functions that are not declared in header files.

Other warning flags Additional command line options. Specify any options that control warning output in GCC and not otherwise available on this page. Consult the GCC documentation at gcc.gnu.org.

Miscellaneous

The Miscellaneous page specifies auxiliary compiler options not otherwise available on other pages of the Standard S32DS C/C++ Compiler settings.

Table 8. Application and Library Project Properties: Standard S32DS C/C++ Compiler > Miscellaneous
Setting Description
Other flags Additional command line options. Specify compiler options supported by GCC and not otherwise available on this page. Consult the GCC documentation at gcc.gnu.org.

Default flags: -c -fmessage-length=0.

Verbose (-v)

This option enables verbose output during the compilation and instructs the compiler to display detailed information about the exact sequence of commands used to compile the program.
Note: S32 Design Studio supports output of error messages only. Warning messages and other informational messages will not be output to the console.

Support ANSI programs (-ansi)

This option configures the compiler to operate in strict ANSI mode. This option is only available for the Standard S32DS C Compiler.

This option turns off certain features of GCC that are incompatible with ISO C90 (when compiling C code), or of standard C++ (when compiling C++ code), such as the asm and typeof keywords, and predefined macros such as unix and vax that identify the type of system you are using. It also enables the undesirable and rarely used ISO trigraph feature. For the C compiler, it disables recognition of C++ style “//” comments as well as the inline keyword.

The macro __STRICT_ANSI__ is predefined when this option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ISO standard does not call for.

Functions that are normally built in but do not have semantics defined by ISO C (such as alloca and ffs) are not built-in functions when this option is used.

Position Independent Code (-fPIC)

This option instructs the compiler to generate position-independent code (PIC), if supported by the target processor.

Save temporary files (--save-temps)

This option instructs the compiler to save the result of preprocessing in a temporary I file and the result of assembling in a S file. The compiler places the files in the Debug folder of the project and names them based on the source file.

Generate assembler listing (-Wa, -adhlns="$@.lst")

This option enables the compiler to output assembly listing to an LST file.
Assume aligned memory references only (-mstrict-align) This option enables the compiler to access addresses not aligned to 16 or 32 bits.
Note: This setting applies to projects created for Cortex-A53.