%% Insert Pragmas for Functions and Data in Generated Code
% This example shows how to insert pragmas in generated code to control the placement of data and functions in memory. 
% To configure memory placement for subsystem functions, use the memory sections that you define in a package. 
% This example illustrates how to use memory sections defined in a package to insert pragmas for functions and data in the generated code.
%% Explore Example Model
% Open the example model.

% Copyright 2015 The MathWorks, Inc.

open_system('rtwdemo_memsec')
%%
% # To view the memory sections in the ECoderDemos package, click the *Memory Section Definitions* button 
%     in the model and then select the *Memory Sections* tab.
% # To configure the memory sections for functions and data, click the *Configure Memory Sections For This Model* button. 
%     In the Code Mappings editor, select the appropriate row, and then specify memory sections in the Property Inspector.
% # The model-level settings are the default settings for atomic subsystems. Open the subsystem parameter drop-down lists to see the memory section 
%     settings for each of the atomic subsystems in the model. You can override the default model-level setting by configuring the subsystem block 
%     parameters.
% # To generate code, click the *Generate Code Using Embedded
% Coder* button.  A code generation report opens
%     automatically.  Inspect the data and function definitions in the |.c| files and observe
%     how the generated pragmas correspond to the specified memory sections.