MATLAB Examples

Getting Started with Embedded Coder Support Package for Xilinx Zynq Platform

This example shows you how to generate code from a Simulink® model and run the executable on the Zynq hardware.



Embedded Coder™ Support Package for Xilinx® Zynq™ Platform allows you to generate code from Simulink models and run the executable on Zynq hardware. You can also collect execution time measurements for an algorithm implemented in Simulink to aid refining and optimizing your algorithm.


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.

Required Software

This example requires one of the following Xilinx Software:

  • Xilinx Software Development Kit (version 2016.4)

Required Hardware

This example requires one of the following boards:

  • Xilinx Zynq ZC702 evaluation kit
  • Xilinx Zynq ZC706 evaluation kit
  • ZedBoard

Task 1 - Configure model for code generation on Zynq hardware

In this task, you will configure the model to generate executable and run it on Zynq hardware.

1. Open the Zynq Getting Started model. To configure the model for Zynq hardware of your choice follow the steps shown in the figure below:

Task 2 - Build, load and run executable on Zynq hardware

1. Generate code for the model by clicking on the Build Model button:

The MathWorks software compiles and links the generated code on the host computer. Then, the software loads and runs the binary executable on the Zynq hardware.

A command window pops-up showing that the executable has started running on the Zynq hardware.

2. Close the command window. Use the following MATLAB commands to terminate the executable running on the hardware:

hz = zynq();
stop(hz, 'zynq_gettingstarted');

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


This example showed how to configure a Simulink model to generate code on Zynq hardware.