Automatic AUTOSAR Data Type Generation
When you generate AUTOSAR-compliant C code for an AUTOSAR component model, Embedded Coder® generates AUTOSAR platform data types in the code. AUTOSAR type generation allows you to generate AUTOSAR platform data types for top models, referenced models, and shared utilities without configuring Simulink® data type replacement.
The AUTOSAR standard defines platform data types for use by AUTOSAR software components. In Simulink, you can model AUTOSAR data types used in elements such as data elements, operation arguments, calibration parameters, measurement variables, and inter-runnable variables. To model AUTOSAR data types, use corresponding Simulink built-in data types. For more information, see Model AUTOSAR Data Types.
When you build your AUTOSAR model, C code generation replaces Simulink data types with corresponding AUTOSAR platform data types. You can configure the platform type names in the XML Options of the AUTOSAR Dictionary. For more information, see AUTOSAR Platform Types.
Support for AUTOSAR 3.x platform names will be removed in a future release.
Simulink Data Type | AUTOSAR 3.x Platform Type | AUTOSAR 4.x Platform Type |
---|---|---|
boolean | Boolean | boolean |
single | Float | float32 |
double | Double | float64 |
int8 | SInt8 | sint8 |
int16 | SInt16 | sint16 |
int32 | SInt32 | sint32 |
int64 | SInt64 | sint64 |
uint8 | UInt8 | uint8 |
uint16 | UInt16 | uint16 |
uint32 | UInt32 | uint32 |
uint64 | UInt64 | uint64 |
For example, suppose that you create a simple AUTOSAR model containing Gain and Delay
blocks, and set the Gain block parameter Output data type to
int8
. When you generate code, in place of Simulink data type int8
, the AUTOSAR-compliant C code references
AUTOSAR data type sint8
.
void Runnable_Step(void) { sint8 rtb_Delay; ... simple_DW.Delay_DSTATE[1] = (sint8)-rtb_Delay; }