Edk virtual platform
Contents
Virtual Platform
The EDK toolset allows one to create a "virtual" model of a base system that is capable of simulating the MicroBlaze processor, the OPB and LMB busses, and a variety of peripherals (UART, LEDs, PushButtons, DIP Switches, etc.). This allows one to prototype and simulate a HW/SW co-designed system without an actual development board. The simulation process is quite fast because the process circumvents the need to synthesize the HW portions of a system. However, there are limitations to the simulation process:
- A simulation can only contain a limited amount of "supported" IP cores.
- A maximum of one MicroBlaze processor.
- No support for PowerPC processors or the PLB.
- Simulation files must be hand-written for custom IP cores.
The features of the virtual platform are described briefly in Embedded Systems Tools Reference Manual that is paired with the EDK and ISE documentation included on the Xilinx website, however there are no examples for how to get a Virtual Platform up-and-running after it has been created. The purpose of this guide is to walk through the steps required to create, setup, connect, and use a virtual platform to prototype HW/SW co-designed systems.
Creating a Virtual Platform from an EDK system
The first step in creating a Virtual Platform, or VP, is to create or use a pre-built EDK system that conforms to the requirements of VP. Using the Base System Builder (BSB) to create a simple MicroBlaze-based system is the easiest way to build such a system (see File:Edk baseSystemBuilder.pdf for an example). After the system has been created, the next step is to have EDK generate the virtual platform executables. This can be done by selecting "Generate Virtual Platform" from the "Simulation" menu within EDK. The VP generation process will generate a new sub-directory that contains the simulation model of the current EDK system.
Connecting to the Virtual Platform
A new directory called "virtualplatform" will be created at the top-level XPS project directory. This directory will contain an executable called vpexec. This executable functions as the virtual platform target that is capable of interacting with XMD just as a traditional physical target platform would. Additionally, XMD provides functions that allow one to connect to the virtual target, download code and execute it on the virtual target, and it also provides a virtual I/O interface that allows one to interact with various models of physical peripherals available on the virtual system.
The most intuitive way to use the VP is to launch the VP execution environment, and then interact with the environment via XMD. This can be done by first going into the new "virtualplatform" sub-directory and launching the virtual platform simulator with the following command:
> ./vpexec -ipcport 1234
The above command launches the virtual platform simulator and tells it to listen for XMD commands on port 1234. The next step is to launch XMD and connect to the virtual platform. This can be done by opening up another terminal session, heading to the top-level XPS directory, and launching XMD with the following command (NOTE - it is VERY VERY important to be at the top-level XPS project directory, otherwise XMD will not be able to successfully connect to the virtual platform):
> xmd
The XMD command prompt should now open, and you should be able to connect to the virtual platform by typing the following command:
<XMD> vpconnect
Now, a few lines of text should say that XMD successfully connected to the virtual platform and that an GDB debug port has been opened. The next step in simulation is to tell XMD to open up all available virtual I/O ports on the virtual target. This can be done by simply typing:
<XMD> vpio
If the virtual system has any I/O facilities such as the UART, or GPIOs to communicate with the LEDs, etc. then several different virtual I/O windows will pop up on the screen. Each of these windows can be used to view and/or interact with the peripherals within the virtual platform. At this point, the virtual platform has been completely setup and executables (.elf files) can be downloaded and executed just as if one was interacting with a real physical target. For instance, if an executable called "test.elf" existed, then I could download and execute this program on the virtual platform using the following set of XMD commands:
<XMD> stop
<XMD> rst
<XMD> dow test.elf
<XMD> run
The End
Hopefully these instructions will allow one to quickly and easily use the Virtual Platform features of EDK to rapidly build cool systems.