Replacement Types

OpenECU models that are configured to use Embedded Coder for code generation use Data Type Replacement to replace built-in data type names with OpenECU specific replacement data type names in the generated code. If the model uses a Simulink data dictionary and the model is being migrated to embedded coder from another autocoder, then the following error may be emitted during the build process:

Replacement type (FREAL, F32, S32, S16, S8, U32, U16, U8, U8, INT, UINT) must be defined as a Simulink.AliasType or a Simulink.NumericType object, and the object must resolve to a primitive type.

There are two options for resolving this error

  1. Convert a text based data dictionary to a Simulink data dictionary after the model has been configured to use embedded coder. The Simulink.AliasType variables will automatically be created in the Simulink data dictionary.

  2. Manually add the following Simulink.AliasType variables to the data dictionary using the model explorer:

BOOL = Simulink.AliasType;
BOOL.Description = 'Simulink type alias for a boolean.';
BOOL.DataScope = 'Auto';
BOOL.HeaderFile = 'psy.h';
BOOL.BaseType = 'boolean';

F32 = Simulink.AliasType;
F32.Description = 'Simulink type alias for a 32-bit floating point.';
F32.DataScope = 'Auto';
F32.HeaderFile = 'psy.h';
F32.BaseType = 'single';

FREAL = Simulink.AliasType;
FREAL.Description = ['Simulink type alias for a 64-bit floating point. ' ...
                     'May be represented as a 32-bit floating point on ' ...
                     'the target ECU.'];
FREAL.DataScope = 'Auto';
FREAL.HeaderFile = 'psy.h';
FREAL.BaseType = 'double';

INT = Simulink.AliasType;
INT.Description = ['Simulink type alias for a signed integer (natural w' ...
                   'idth of target ECU).'];
INT.DataScope = 'Auto';
INT.HeaderFile = 'psy.h';
INT.BaseType = 'int32';

S16 = Simulink.AliasType;
S16.Description = 'Simulink type alias for a 16-bit signed integer.';
S16.DataScope = 'Auto';
S16.HeaderFile = 'psy.h';
S16.BaseType = 'int16';

S32 = Simulink.AliasType;
S32.Description = 'Simulink type alias for a 32-bit signed integer.';
S32.DataScope = 'Auto';
S32.HeaderFile = 'psy.h';
S32.BaseType = 'int32';

S8 = Simulink.AliasType;
S8.Description = 'Simulink type alias for a 8-bit signed integer.';
S8.DataScope = 'Auto';
S8.HeaderFile = 'psy.h';
S8.BaseType = 'int8';

U16 = Simulink.AliasType;
U16.Description = 'Simulink type alias for a 16-bit unsigned integer.';
U16.DataScope = 'Auto';
U16.HeaderFile = 'psy.h';
U16.BaseType = 'uint16';

U32 = Simulink.AliasType;
U32.Description = 'Simulink type alias for a 32-bit unsigned integer.';
U32.DataScope = 'Auto';
U32.HeaderFile = 'psy.h';
U32.BaseType = 'uint32';

U8 = Simulink.AliasType;
U8.Description = 'Simulink type alias for a 8-bit unsigned integer.';
U8.DataScope = 'Auto';
U8.HeaderFile = 'psy.h';
U8.BaseType = 'uint8';

UINT = Simulink.AliasType;
UINT.Description = ['Simulink type alias for an unsigned integer (natur' ...
                    'al width of target ECU).'];
UINT.DataScope = 'Auto';
UINT.HeaderFile = 'psy.h';
UINT.BaseType = 'uint32';

      Copyright © 2016 Pi Innovo, All rights reserved