Code covered by the BSD License  

Highlights from
Real-Time Workshop Targeting Tips and Scripts

Real-Time Workshop Targeting Tips and Scripts

by

 

25 Feb 2003 (Updated )

Has best practices and scripts to configure embedded code generation for any production target.

ConfigurationOpen(model)
function ConfigurationOpen(model)
% ConfigurationOpen- Configuration file for automatically setting
% configuration values that affect code generation within simulink 
% during initial model load.
%
% See ert_make_rtw_hook for more information.
%
% Copyright 1994-2003 The MathWorks, Inc.

  % Configuration matches that in EntryConfiguration function of ert_make_rtw_hook
  
  % Options related to code efficiency (set for maximum efficiency)
  
  uset_param(model,'InlineParams','on');
  uset_param(model,'BlockReduction','on');
  uset_param(model,'ConditionalExecOptimization','on');
  uset_param(model,'ParameterPooling','on');
  uset_param(model,'OptimizeBlockIOStorage','on');
  uset_param(model,'ExpressionFolding','on');
  uset_param(model,'FoldNonRolledExpr','on');
  uset_param(model,'EnforceIntegerDowncast','off');
  uset_param(model,'InlineInvariantSignals','on');
  uset_param(model,'LocalBlockOutputs','on');
  uset_param(model,'BufferReuse','on');
  uset_param(model,'RollThreshold',5);
  uset_param(model,'ZeroExternalMemoryAtStartup','off');
  uset_param(model,'ZeroInternalMemoryAtStartup','off');
  uset_param(model,'CombineOutputUpdateFcns','on');
  uset_param(model,'InitFltsAndDblsToZero','off');
  uset_param(model,'StateBitSets','on');
  uset_param(model,'DataBitSets','on');
  
  % It is very important to configure to use boolean data types, but
  % may cause a model to fail to update diagram.
  
  uset_param(model,'BooleanDataType','on');
  
  % Target Environment
  
  % Note: Target word lengths should be set inside ert_rtw_info_hook.m, and
  % extracted as follows.  For details on setting up the C implemenation
  % details for RTW, type
  %
  % >> type example_rtw_info_hook
  %
  % This code synchronizes the model word sizes to the target word sizes.

  targetwordlenghts = struct2cell(rtwwordlengths(model));
  wordlengths = [] ; comma = '';
  for idx = 1 : length(targetwordlenghts)
    str = num2str(double(targetwordlenghts{idx}));
    wordlengths = [wordlengths,sprintf('%s%s',comma,str)];
    comma = ',';
  end
  
  uset_param(model,'Solver','FixedStepDiscrete');
  uset_param(model,'SolverMode','Auto');
  uset_param(model,'GenerateSampleERTMain','on');
  uset_param(model,'TargetOS','BareBoardExample');
  uset_param(model,'PurelyIntegerCode','off');
  uset_param(model,'ProdHWDeviceType','Microprocessor');
  uset_param(model,'ProdHWWordLengths', wordlengths);
  uset_param(model,'GenFloatMathFcnCalls','ANSI_C');
  
  % Identifiers
  
  uset_param(model,'PrefixModelToSubsysFcnNames','on');
  uset_param(model,'IncHierarchyInIds','on');
  uset_param(model,'IncDataTypeInIds','on');
  uset_param(model,'MaxIdLength',31);
  uset_param(model,'InlinedPrmAccess','Literals');
  uset_param(model,'IgnoreCustomStorageClasses','off');
  
  % Traceability
  
  uset_param(model,'GenerateComments','on');
  uset_param(model,'InsertBlockDesc','on');
  uset_param(model,'ShowEliminatedStatement','off');
  
  % Interfaces
  
  uset_param(model,'MultiInstanced','off');
  uset_param(model,'MultiInstanceErrorCode','Error');
  uset_param(model,'RootIOStructures','off');
  uset_param(model,'SuppressErrorStatus','off');
  uset_param(model,'IgnoreCustomStorageClasses','off');
  uset_param(model,'ParameterTuning','off');
  uset_param(model,'BlockIOSignals','off');
  uset_param(model,'ExtMode','off');
  uset_param(model,'IncludeMdlTerminateFcn','off');
  uset_param(model,'GenerateASAP2','off');
  
  % Build environment
  
  uset_param(model,'RTWVerbose','off');
  uset_param(model,'GenerateReport','off');
  uset_param(model,'GenerateErtSFunction','off');
  
  % Workspace I/O
  
  uset_param(model,'MatFileLogging','off');
  uset_param(model,'SaveTime','off');
  uset_param(model,'SaveOutput','off');
  uset_param(model,'SaveState','off');
  uset_param(model,'SaveFinalState','off');

Contact us