Clear Filters
Clear Filters

Ext_U and Ext_Y structures created in code when signals are defined as extern (ImportFromFile or ImportedExtern)

2 views (last 30 days)
I have multiple models for which the code is generated separately. They all use the same signals defined in a .m file as follows:
x1 = Simulink.Signal;
x1.CoderInfo.StorageClass = 'Custom';
x1.CoderInfo.CustomStorageClass = 'ImportFromFile';
x1.CoderInfo.CustomAttributes.HeaderFile = 'xx_data.h';
I have also tried
x1 = Simulink.Parameter;
and
x1.CoderInfo.StorageClass = 'ImportedExtern';
The appropriate storage is in the xx_data .h file
The generated .h file contains the structures as follows:
typedef struct {
uint32_T x1;
boolean_T y1;
} ExtU_modelx_T;
typedef struct {
boolean_T z1;
} ExtY_modelx_T;
I don't want the signals defined in the .c/.h file, as they are in the xx_data.h file
which is in the modelx_private_types.h file. (#include <xx_data.h>)
This worked correctly in 2008b, which is previous version of these models.
My codegen file had the following parameters set (from 2008b)
set_param(cs,'BlockReduction','on');
set_param(cs,'InlineParams','on');
set_param(cs,'BooleanDataType','on');
set_param(cs,'ConditionallyExecuteInputs','on');
set_param(cs,'ParameterPooling','on');
set_param(cs,'OptimizeBlockIOStorage','on');
set_param(cs,'BufferReuse','on');
set_param(cs,'CombineOutputUpdateFcns','on');
sset_param(cs,'ExpressionFolding','on');
set_param(cs,'ForceParamTrailComments','on');
set_param(cs,'GenCodeOnly','on');
set_param(cs,'GlobalDataDefinition','Auto'); % InSourceFile, InSeparateSourceFile
set_param(cs,'GlobalDataReference','Auto'); %InSourceFile, InSeparateHeaderFile
set_param(cs,'GRTInterface','off');
set_param(cs,'IgnoreCustomStorageClasses','off');
set_param(cs,'IncDataTypeInIds','off');
set_param(cs,'IncHierarchyInIds','off');
set_param(cs,'IncludeFileDelimiter','UseBracket'); %Auto, UseQuote
set_param(cs,'IncludeHyperlinkInReport','off');
set_param(cs,'IncludeMdlTerminateFcn','off');
set_param(cs,'InitialValueSource','Model'); %DataObject
set_param(cs,'InlineInvariantSignals','on');
set_param(cs,'InlinedParameterPlacement','Hierarchical'); %NonHierarchical
set_param(cs,'InlinedPrmAccess','Literals'); %Macros
set_param(cs,'DefaultParameterBehavior','Inlined'); %Macros
set_param(cs,'InsertBlockDesc','on');
set_param(cs,'LocalBlockOutputs','on');
set_param(cs,'LogVarNameModifier','none');
set_param(cs,'MangleLength','1');
set_param(cs,'MatFileLogging','off');
set_param(cs,'CodeInterfacePackaging','Nonreusable function');
set_param(cs,'MultiInstanceErrorCode','Error'); %None, Warning
sset_param(cs,'OptimizeModelRefInitCode','off');
set_param(cs,'ParamNamingRule','None'); %UpperCase, LowerCase, Custom
set_param(cs,'PrefixModelToSubsysFcnNames','on');
set_param(cs,'ShowEliminatedStatement','off');
set_param(cs,'SignalNamingRule','None');
set_param(cs,'ZeroExternalMemoryAtStartup','off');
set_param(cs,'ZeroInternalMemoryAtStartup','off');

Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!