PIL Execution at the Command Line Using MATLAB Coder
This example shows how to set up a PIL execution to verify generated code from a MATLAB® function using MATLAB Coder™ at the command line.
You can use processor-in-the-loop (PIL) executions to verify generated code that you deploy to hardware board by using a MATLAB Coder procedure. You can profile algorithm performance and speed of your generated code on the hardware board. To verify generated code, you must have MATLAB Coder and an Embedded Coder® license.
This PIL execution is also available with these hardware support packages.
Embedded Coder Support Package for BeagleBone® Black Hardware
Embedded Coder Support Package for ARM® Cortex®-A Processors
Embedded Coder Support Package for STMicroelectronics® Discovery Boards
In the Command Window, select the hardware for PIL execution.
hw = coder.hardware('ARM Cortex-M3 (QEMU)')
hw = Hardware with properties: Name: 'ARM Cortex-M3 (QEMU)' CPUClockRate: 1000
Add the hardware to the MATLAB Coder configuration object.
cfg = coder.config('lib','ecoder',true); cfg.VerificationMode = 'PIL'; cfg.Hardware = hw;
The memory of the hardware board is limited, and a default
value of 20000
is beyond the stack size available
in the hardware. We recommend you to set the StackUsageMax
value
to 512
. However, specify an appropriate stack usage
based on your algorithm.
cfg.StackUsageMax = 512;
Generate PIL code for a function, averaging_filter
.
codegen -config cfg averaging_filter -args {zeros(1,16)}
For more information on the averaging_filter
function, see the example
Generate Code for an Averaging Filter.
To install the Embedded Coder Support Package for ARM Cortex-M Processors, see Embedded Coder Supported Hardware.