Main Content

Verify FIR Filter on ARM Cortex-A Processor

This example shows how to use the Code Replacement Library (CRL) for ARM® processor with DSP blocks. The model uses the FIR filter block to filter two sine waves of different frequencies.

Open Model

open_system('ex_fir_ne10_tut');

Task 1: Simulate

1. Open the FIR NE10 CRL tutorial 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. At the command line, set the parameter 'CodeReplacementLibrary' to GCC ARM Cortex-A. Before R2024b: Open the Configuration Parameters dialog box. On the Code Generation > Interface pane, set Code replacement library to GCC ARM Cortex-A.

set_param('ex_fir_ne10_tut',CodeReplacementLibrary="GCC ARM Cortex-A")

Task 3: Generate code

1. Right-click the FIR subsystem.From the drop-down menu that opens, choose C/C++ Code > BuildThis Subsystem. When the Build code for Subsystem dialog box opens, click Build to start generating code.

2. When build finishes processing, a code generation report comes up.

3. Click on the FIR.c file. Notice the NE10 library function; ne10_fir_init_float in the initialize function (FIR_initialize). Also, notice the NE10 function; ne10_fir_float_neon in the model step function (FIR_step).

Task 4: Use Processor in the Loop (PIL)

To perform the previous steps using PIL, you need to have the Embedded Coder Support Package for ARM Cortex-A Processors, and the DST Support Package for ARM Cortex-A Processors. The following examples show you how to use PIL with ARM Cortex-A:

  • Code Verification and Validation with PIL and External Mode example.

  • Code Optimization Using NE10 DSP Library example. (Requires BeagleBone Black Hardware Support Package)

Close Model

bdclose('all')