Support Concurrent Execution of Multiple Tasks - MATLAB & Simulink (original) (raw)
If a custom embedded target must support concurrent execution of multiple tasks on a multicore platform, the target must declare support for concurrent execution by setting the target configuration option ConcurrentExecutionCompliant
. Otherwise, you will not be able to configure a multicore target model for concurrent execution.
If ConcurrentExecutionCompliant
is not already configured for your custom target, you can set the option in the following ways:
- Include the following code directly in your system target file (
_`mytarget`_.tlc
):
rtwgensettings.SelectCallback = 'slConfigUISetVal(hDlg,hSrc,...
''ConcurrentExecutionCompliant'',''on'');';
rtwgensettings.ActivateCallback = 'slConfigUISetVal(hDlg,hSrc,...
''ConcurrentExecutionCompliant'',''on'');'; - Implement a callback function that sets the
ConcurrentExecutionCompliant
option, and then install the callback function in theSelectCallback
field of thertwgensettings
structure in your system target file. The callback function is triggered whenever the user selects the target in the System Target File Browser. For example, the following system target file code installs aSelectCallback
function namedcustom_select_callback_handler
:
rtwgensettings.SelectCallback = 'custom_select_callback_handler(hDlg,hSrc)';
The arguments to theSelectCallback
function (hDlg
,hSrc
) are handles to private data used by the callback API functions. These handles are restricted to use in system target file callback functions. They should be passed in without alteration.
Your callback function should set theConcurrentExecutionCompliant
option as follows:
slConfigUISetVal(hDlg,hSrc,'ConcurrentExecutionCompliant','on');
slConfigUISetEnabled(hDlg,hSrc,'ConcurrentExecutionCompliant',false);
hSrc.getConfigSet.refreshDialog;
For more information about the system target file callback API, see the slConfigUIGetVal, slConfigUISetEnabled, and slConfigUISetVal function reference pages.
When the ConcurrentExecutionCompliant
target configuration option is set to 'on'
, you can select the custom target and configure your multicore target model for concurrent execution.
For an example that shows how to configure custom target optional features, see Customize System Target Files.