Main Content

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 TypeAUTOSAR 3.x Platform TypeAUTOSAR 4.x Platform Type
booleanBooleanboolean
singleFloatfloat32
doubleDoublefloat64
int8SInt8sint8
int16SInt16sint16
int32SInt32sint32
int64SInt64sint64
uint8UInt8uint8
uint16UInt16uint16
uint32UInt32uint32
uint64UInt64uint64

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;
}

Related Examples

More About