MATLAB Examples

Getting Started with Embedded Coder Support Package for ARM Cortex-A Processors

This example shows you how to use Embedded Coder Support Package for ARM Cortex-A Processors to run a Simulink® models on an ARM Cortex-A9 emulator.

Contents

Introduction

Embedded Coder Support Package for ARM Cortex-A Processors enables you to create and run Simulink models on a QEMU emulator. You can verify the generated code on an emulated ARM Cortex-A9 processor without actual hardware. You can also collect execution time measurements for an algorithm implemented in Simulink to aid refining and optimizing your algorithm.

Prerequisites

If you are new to Simulink, we recommend completing the Interactive Simulink Tutorial. If you are new to Embedded Coder, visit the Embedded Coder product page for an overview and tutorials.

Task 1 - Configure model for code generation on ARM Cortex-A9 (QEMU)

In this task, you will configure the model to generate executable and run it on the ARM Cortex-A9 (QEMU) target.

1. First of all, start QEMU emulator for ARM Cortex-A by executing the following command in MATLAB® command prompt:

pid = codertarget.arm_cortex_a.runQemu()

2. Open the ARM Cortex-A Getting Started model. To configure the model for ARM Cortex-A9 (QEMU) target follow the steps shown in the figure below:

Task 2 - Build, load and run executable on ARM Cortex-A9 (QEMU)

1. Generate code for the model by clicking on the Deploy to Hardware button as shown in the figure below:

The MathWorks software compiles and links the generated code on the host computer. Then, the software loads and runs the binary executable on the ARM Cortex-A9 (QEMU) target.

A command window pops-up showing that the executable has started running on the ARM Cortex-A9 (QEMU).

2. Close the command window. Use the following MATLAB command to terminate the emulator session:

codertarget.arm_cortex_a.stopQemu(pid)

3. To interact with the code running on the QEMU emulator see Code Verification and Validation with PIL and External Mode example.

Summary

This example introduced the workflow for configuring and running a Simulink model on the QEMU ARM Cortex-A9 emulator.