Main Content

Get Started with Embedded Coder Support Package for Xilinx Zynq Platform

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

Introduction

The Embedded Coder® Support Package for Xilinx Zynq Platform enables you to generate code from Simulink models. You can compile and load the generated code as an executable on a Xilinx Zynq platform. Then, you can run the executable can run on a Xilinx Zynq platform.

Requirements

Configure Model for Code Generation

  1. Open the Zynq Getting Started model.

  2. On the Apps tab in the Simulink Toolstrip, under Setup to Run on Hardware, click Run on Hardware Board.

  3. In the Run on Hardware Board dialog box, set Hardware Board to your Xilinx Zynq platform, such as Xilinx Zynq ZC702 evaluation kit, and click Finish.

In the Simulink Toolstrip, the new Hardware tab enables you to run and interact with the connected hardware board.

Build, Deploy, and Start Executable

The Embedded Coder software, using the Xilinx Software Development Kit, 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 a Xilinx Zynq platform. On the Hardware tab, click Build, Deploy & Start to run your model as a binary executable on the connected Xilinx Zynq platform.

After the model launches on the hardware, a command window opens and shows that the executable is running on the Xilinx Zynq platform.

To stop the model running on the hardware, use the zynq function and stop functions by entering this code at the MATLAB® command window.

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

Other Things to Try

You can interact with the code running on the Xilinx Zynq platform using external mode or PIL. For more information on external mode and PIL with the Xilinx Zynq platform, see Parameter Tuning with External Mode Simulation and Processor-in-the-Loop Verification of Simulink Models.