Verify FIR Filter on ARM Cortex-M Processor
This example shows how to use the code replacement library (CRL) for ARM® Cortex-M processors with DSP blocks. The model uses the FIR filter block to filter two sine waves of different frequencies.
Task 1: Simulate
1. Open the ex_fircmsis_tut example model.
2. Change your current folder in MATLAB® to a writable folder.
3. On the model tool strip, click Run to start the simulation.
4. Click Stop to end simulation.
Task 2: Setup Model for Code Replacement
1. Under Simulation tab, click Model Configuration Parameters to open the dialog box.
2. Select the Code Generation category.
3. Set the System target file to ert.tlc ,and select Generate code only.
4. Select Interface under the Code Generation category.
5. Set Code replacement library to ARM Cortex-M .
Task 3: Generate Code
1. Right-click the FIR subsystem. Select C/C++ Code > Build This Subsystem from the drop down menu. When the Build code for Subsystem dialog box opens, click Build to start generating code.
2. When the build finishes processing, a code generation report comes up.
3. Click on the FIR.c file. Observe the CMSIS function arm_fir_init_f32
in the FIR_initialize
function. Also, observe the CMSIS function arm_fir_f32
in the FIR_step model
step function.
Task 4: Use Processor in the Loop (PIL)
The following examples show you how to use processor in the loop (PIL) with ARM Cortex-M processors:
Code Optimization Using CMSIS DSP Library (Requires STMicroelectronics STM32F4-Discovery Support Package)