Getting Started with VxWorks 7 on Xilinx Zynq Platform
This example shows you how to configure the VxWorks® 7 operating system, generate code from a Simulink® model and run the executable on the Zynq hardware.
Embedded Coder™ Support Package for Xilinx® Zynq™-7000 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.
You must follow the targetupdater that configures the Wind River® Workbench and VxWorks 7 software. The update process also creates the VxWorks source build and VxWorks image projects that will be used during the compilation of generated code. This process will guide through the configuration of the network and network applications to run VxWorks 7 operating system on Zynq hardware.
For more information about VxWorks source build and VxWorks image project refer to https://knowledge.windriver.com/.
This example requires the following Wind River® Software:
- Wind River VxWorks 7
This example requires the following board:
- Xilinx Zynq ZC702 evaluation kit
Task 1 - Configure the target hardware and host PC communication
In this task, you will configure the model to generate executable and run it on Zynq hardware.
1. Follow the steps in the VxWorks configuration guide to setup the communication between Zynq hardware and host PC.
Task 2 - Configure model for code generation
Following figure shows the example model that will blink the DS12 and DS23 LEDs on the ZC702 hardware.
The LEDs positions on ZC702 hardware are shown in the figure below:
1. Open the Getting Started with VxWorks on Zynq hardware model. In order to configure the model to generate code for VxWorks 7 operating system on Zynq hardware follow the steps shown in the figures below:
2. Generate code for the model by clicking on the Build Model button:
Note: The generated code will be compiled and linked on the host computer and then saved to the TFTP directory that was configured in Task 1. The executable will be automatically run on the hardware. When the code starts running on the Zynq hardware, observe that the DS12 and DS23 LEDs on the board start blinking at different rates. DS12 LED is ON for 0.25 second and OFF for 0.25 second. DS23 LED is ON for 0.5 second and OFF for 0.5 second.
Task 3 - Stop Simulink model running on the Zynq hardware
The VxWorks 7 executable is generated for each Simulink model you run on the Zynq hardware. The generated executable is a .VXE file that has the same name as the Simulink model and is stored in your TFTP directory of your host PC.
1. To run/stop a Simulink model, you use the runModel and stopModel methods of the zynq VxWorks Kernel Shell communication object. First, create a communication object to the Zynq hardware:
zvxworks = zynq('vxworks')
This command generates a Zynq VxWorks Kernel Shell object that is your gateway to communicating with your Zynq hardware from MATLAB prompt. Execute the following on the MATLAB prompt to see if the getting started model is running:
The isModelRunning method of zynq returns true if the model is running on the Zynq hardware.
2. Execute the following on the MATLAB prompt to stop the Simulink model you ran in Task 2:
You should see DS12 and DS23 LEDs stop blinking at this point. You can also use the isModelRunning method to test if the model has stopped.
3. To run a previously built Simulink model on your board, you use runModel method. In order to run the Getting Started with VxWorks on Zynq hardware model, execute the following on the MATLAB prompt:
For more help on other methods of zynq object, type <matlab:help('zynq')
This example showed how to configure a Simulink model to generate code on Zynq hardware.