This example shows how to use Embedded Coder® Support Package for ARM Cortex-A® Processors to run a Simulink® model on an ARM Cortex-A9 (QEMU) emulator.
The Embedded Coder Support Package for ARM Cortex-A Processors enables you to create and run Simulink models on a QEMU emulator. For more information, see the QEMU website. You can verify the generated code on an emulated ARM Cortex-A9 processor without actual hardware. To aid in refining and optimizing your algorithm, you can collect execution time measurements for an algorithm implemented in Simulink.
This section shows how to configure a Simulink model to build, deploy, and run as an executable on the ARM Cortex-A9 (QEMU) target.
1. Start the QEMU emulator for ARM Cortex-A processor by executing this command at the MATLAB® command prompt.
pid = codertarget.arm_cortex_a.runQemu()
2. Open the arm_cortex_a_gettingstarted model. This model uses a simplified ring oscillator to generate a square wave with the frequency specified as an input.
3. On the Apps tab in the Simulink Toolstrip, under Setup to Run on Hardware, click Run on Hardware Board.
4. In the Run on Hardware Board dialog box, set Hardware Baord to
ARM Cortex-A9 (QEMU). Click Finish.
The Embedded Coder software, using the GCC toolchain, can build a binary executable by compiling and linking the generated code on your host computer. Then, you can deploy and run the executable on the emulated processor in the QEMU. To run your model as a binary executable on the running QEMU emulator, on the Hardware tab, click Build, Deploy & Start.
After the model launches on the hardware, a command window opens and shows that the executable is running on the QEMU emulator.
To stop the model running on the QEMU, close the command window, and then stop the QEMU emulator by entering this code at the MATLAB command prompt.
You can interact with the code running on the QEMU emulator using external mode or PIL. For more information on external mode and PIL with the ARM Cortex-A, see Code Verification and Validation with PIL and External Mode.