Specify or append compiler options when building a model.
None (Main library). (See Section 2.3, “Licensed Features”.)
After RTW has generated code for a model, a compiler converts the code into a binary image suitable for the ECU to execute. Which compiler to use is chosen through the RTW Compiler Selection option.
The compiler converts the model code into a binary image using various transformations, some of which can be modified via command line options to the compiler. The pcomp_CompileOptions block selects whether to use the default compiler options supplied with OpenECU, to add additional options to the default options, or to replace the default options altogether.
Alteration of the compiler options may lead to a model which fails to build, or a model which will not run on the target ECU or which may run initially but fail later on. When reporting a failure through technical support, please specify any changed compiler options as this may help resolve the issue more quickly.
The default compiler options for the WindRiver Diab 5.5.1.0 compiler are:
Option | Use |
---|---|
-c | produce an object file only — do not attempt to link (OpenECU compiles each source file separately, then links each together, this is a required option) |
-DREAL_T=float | define RTW's real_T to be of 'float' type — this matches the hardware most closely and provides good performance, switching to 'double' will cause library incompatibility and slow down the model significantly |
-g3 | generate debug information as much as possible given the optimisations selected |
-O | turn on the compiler optimiser to reduce the binary image size and increase the run time efficiency |
-ew1551 | suppress errors about volatile qualification mismatch between RTW functions and calibrations |
-Xaddr-sconst=0x11 |
ask the compiler to address all small data objects using absolute
addressing (i.e., not relative addressing via r2 or r13) because
the address range of the calibration data is too large for relative
addressing — defensive measure only; not strictly necessary because the
-Xsmall-const option makes sure no data object is classed as small.
|
-Xbss-common-off | ask the compiler to ensure that there is only one declaration of a variable (without initialisation) — ensure there are no separate objects for the same variable in different modules |
-Xdouble-avoid | ask the compiler to generate 32-bit floating point constants rather than 64-bit floating point constants to reduce size and increase run time efficiency |
-Xenum-is-int | ensure that C and C++ objects link using the same data type for enumerations — although not strictly necessary (and OpenECU does not yet support C++ code), it may be an issue for customer linked code |
-Xforce-prototypes | lint like option to ensure all functions have been declared with a prototype — i.e., ensure we don't fall into the trap of implicit function declarations which don't match the actual function declaration |
-Xieee754-pedantic | request that the compiler match, as closely as possible, the IEEE754 floating-point specification |
-Xkeep-assembly-file | ask the compiler to keep the binary image representation — useful for diagnosing compiler problems |
-Xkeywords=0x08 | allow the use of the non-standard packed keyword to achieve better use of memory in some data structures |
-Xkill-reorder=0x08 | avoid a bug in some versions of the Diab C compiler which incorrectly applies peep-hole optimisation to instructions which should not be transposed in the binary image |
-Xmin-align=1 | allow the compiler to place some packed data on address boundaries which are not natural for some data types |
-Xname-const=.cal_sec | ask the compiler to place all calibration variables in the same memory section for simple linking |
-Xpass-source | ask the compiler to output C source intermixed with the assembly instructions — useful for diagnosing compiler problems |
-Xsmall-const=0 |
ask the compiler to avoid placing data objects in the small const
data area (see also, -Xaddr-sconst )
|
-Xstrict-eabi |
ensure the compiler does not generate stswi and
lswi instructions
|
-Xstsw-slow | ensure correct calling procedure for architecture across different object code — although not strictly required at the moment, this defines the object interface for other object code that may be linked to the final model e.g., custom code |
-t... |
set to -tPPCE200Z3VEF for the M220 — selects the processor for
the target ECU
|
The default compiler options for the WindRiver Diab 5.8.0.0 compiler are the same as Diab 5.5.1.0.
The default compiler options for the WindRiver Diab 5.8.0.0 compiler are the same as Diab 5.5.1.0.
The build mechanism also adds the following WindRiver Diab compiler options. These options cannot be changed.
Option | Use |
---|---|
-t... |
set to -tPPCE200Z3VEF for the M220, M221, M250, M460 and M461 or
set to -tPPCE200Z7VEF for the M670
— selects the processor for the target ECU
|
Option | Use |
---|---|
-c | produce an object file only — do not attempt to link (OpenECU compiles each source file separately, then links each together, this is a required option) |
-DREAL_T=float | define RTW's real_T to be of 'float' type — this matches the hardware most closely and provides good performance, switching to 'double' will cause library incompatibility and slow down the model significantly |
-fkeep-static-consts | emit variables declared static const when optimization isn't turned on, even if the variables aren't referenced |
-funsigned-char |
matching the default signed-ness of char for the Diab compiler
and the platform library files
|
-fno-common | controls the placement of uninitialized global variables — specifies that the compiler should place uninitialized global variables in the data section of the object file, rather than generating them as common blocks |
-g3 | generate debug information as much as possible given the optimisations selected |
-G 8 | put global and static objects less than or equal to num bytes into the small data or BSS sections instead of the normal data or BSS sections. The default value of num is 8. The -msdata option must be set to one of 'sdata' or 'use' for this option to have any effect. All modules should be compiled with the same -G num value. Compiling with different values of num may or may not work — if it doesn't the linker gives an error message -- incorrect code is not generated. |
-mcpu=e500mc | selects the type of RX CPU to be targeted |
-meabi | align the stack to an 8-byte boundary |
-memb | set the PPC EMB bit in the ELF flags header to indicate that 'eabi' extended relocations are used |
-mno-relocatable | generate code that does not allow a static executable to be relocated to a different address at run time. A simple embedded PowerPC system loader should relocate the entire contents of .got2 and 4-byte locations listed in the .fixup section, a table of 32-bit addresses generated by this option |
-mno-relocatable-lib | generates a .fixup section to allow static executables to be relocated at run time |
-mregnames | generate 'in', 'loc', and 'out' register names for the stacked registers |
-msdata | put small initialized const global and static data in the '.sdata2' section, which is pointed to by register r2. Put small initialized non-const global and static data in the '.sdata' section, which is pointed to by register r13. Put small uninitialized global and static data in the '.sbss' section, which is adjacent to the '.sdata' section |
-O | turn on the compiler optimiser to reduce the binary image size and increase the run time efficiency |
-pass-exit-codes | return with the numerically highest error produced by any phase returning an error indication. The C front end returns 4 if an internal compiler error is encountered |
-x c | use the C language when compiling |
-Wno-attributes | do not warn if an unexpected __attribute__ is used, such as unrecognized attributes, function attributes applied to variables, etc. This will not stop errors for incorrect use of supported attributes |
-Wa,-aln | ask the compiler to keep the binary image representation — useful for diagnosing compiler problems |
The build mechanism also adds the following compiler options. These options cannot be changed.
Option | Use |
---|---|
-D... | various RTW required macro definitions |
-DCFG_... | defines the ECU the model is targeted at |
-I... | various include paths for source files (model based, RTW based, compiler based and OpenECU based) |
Its outside the scope of this User Guide to explain all the different compiler options in detail and their resulting affect on the ECU binary image. Please refer to appropriate compiler User Guide for more information.
Alteration of the compiler options may remove options which work around known bugs in the compiler. For a list of known bugs which affect OpenECU, see Section 1.5.9.2, “Known defects”, Section 1.5.10.2, “Known defects” and Section 1.5.11.2, “Known defects”, Section 1.5.12.2, “Known defects”.
Various settings must be confirmed before the compiler is accessible to OpenECU. See the MATLAB command oe_check_compiler for more details.
Whether to use the default compiler options, whether to add compiler options to the default options, or whether to replace the default options altogether.
Value type: | List | ||
Calibratable: | No |
The options to add to the default compiler options, or to replace the default options, as selected by parameter Mode.
Value type: | String | ||
Calibratable: | No |