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.

Simulink Data TypeAUTOSAR Platform Type
booleanboolean
singlefloat32
doublefloat64
int8sint8
int16sint16
int32sint32
uint8uint8
uint16uint16
uint32uint32

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 Topics