This example shows how to generate code from a Simulink® model and run the executable on a Xilinx Zynq platform.
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.
Open the Zynq Getting Started model.
On the Apps tab in the Simulink Toolstrip, under Setup to Run on Hardware, click Run on Hardware Board.
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.
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');
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 Parameter Tuning with External Mode Simulation.