Designing with Embedded Processors and Microcontrollers
Using Platform Studio SDK
Introduction
The Xilinx Platform Studio Software Development Kit (SDK) is an Integrated
Development Environment for creating software platform designs. The SDK is an eclipse- based IDE that makes it easier to write high-quality C/C++ code for Xilinx embedded processors. System Generator provides access to the SDK by automatically generating an
SDK workspace and providing a "hello world" program template that contains example code which allows you to write productive code in a short period of time.
Invoking the SDK
System Generator automatically generates an SDK workspace if an EDK Processor block is present during a Hardware Co-simulation compilation. Additionally, the Hardware Cosimulation token will have an additional tab in the block's GUI called Software. In this tab, there is a SDK panel that provides access to the SDK.
Pressing the Edit software button will launch the SDK. The SDK workspace can also be found under the netlist directory of the design. The ELF file field tells the Hardware Cosimulation block what executable binary to use during simulation, and the "Compile and update bitstream" takes the binary file specified in "ELF file" and merges it into the bitstream.
Please refer to documentation in the SDK regarding the creation of a software platform and a managed C or C++ project within the SDK.
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009 www.xilinx.com
175
Chapter 2: Hardware/Software Co-Design
Creating a Hello World Application in SDK
When SDK is launched with a workspace created from System Generator, it is possible to create a C application project that has example code that shows how memories in System
Generator can be read from and written to.
In the C/C++ Project navigation pane, right click on a Software Platform and select
New > Managed Make C Application Project
.
176
In the list of Sample Applications, select the sg_plbiface example and click Finish. This creates a software project with a main() routine that prints "Hello World". The file also contains example functions that show how to access the memories in the System Generator design.
www.xilinx.com
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009
Designing with Embedded Processors and Microcontrollers
Getting help on the Software Drivers Generated by System Generator
In the SDK menu, select Hardware Design > View Design Report. This will launch a web page that contains the resources available to this software platform. In the left hand navigation panel, select Peripherals > sg_plbiface_0..
This will scroll the report into the section pertaining to the System Generator peripheral. In the IP Specs table, click on the
DRIVER
link and that will launch the documentation generated by System Generator for the peripheral.
How to Migrate a Software Project from XPS to Standalone SDK
Adding and managing software applications in XPS is deprecated starting in release 11.1 and will become obsolete starting in release 12.1. You can still continue using an existing
XPS project until 12.1, but it is highly recommend that you migrate the software portion to the Standalone SDK flow to take advantage of the flexibility and advanced features in adding and managing software. You can follow the step-by-step instructions described below on how to migrate from an existing XPS flow to an SDK design flow. The same generic steps can also be used on other Sysgen/EDK designs to accomplish the same migration paths between XPS and Standalone SDK.
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009 www.xilinx.com
177
Chapter 2: Hardware/Software Co-Design
How to Migrate to the Standalone SDK Flow
In the following description, a design called VFBC will be used.
1.
Open the System Generator model with the hardware co-sim block (vfbc_hwcs.mdl).
Double-click on the Hardware Co-Sim block and click on the Edit software button to launch SDK.
Note:
Notice that you do not have to enter the ELF file yet at this point.
178
www.xilinx.com
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009
Designing with Embedded Processors and Microcontrollers
2.
Click OK to start creating the software project.
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009 www.xilinx.com
179
Chapter 2: Hardware/Software Co-Design
3.
Right-click on the system.xml file and select New > Project
4.
Select the Software Platform Wizard
180
www.xilinx.com
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009
Designing with Embedded Processors and Microcontrollers
5.
Enter the project name and click Finish
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009 www.xilinx.com
181
Chapter 2: Hardware/Software Co-Design
6.
Right-click on SysGen_VFBC > New > Manage Make C Application Project
182
www.xilinx.com
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009
Designing with Embedded Processors and Microcontrollers
7.
Enter the Software Platform Project name, select Empty Application with no template and click Finish.
Your SDK design cockpit should look similar to the figure below:.
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009 www.xilinx.com
183
Chapter 2: Hardware/Software Co-Design
8.
The last step is to either create a new C-code source file or add an existing one to the project. In this case, you can just add the existing one from C:\VFBC\C-code\vfbc.c.
The easiest way to add a C-code source file to the VFBC {SysGen_VFBC} application project is to simply Copy & Paste or Drag & Drop the file into the project. Once the file is added, the project will be built and compiled automatically.
How to Iterate the Design between System Generator and SDK
By default, the ELF file is named after the application project name – VFBC.elf in this case. It’s also located under the folder of the application project location.
Design iteration using the SDK is similar to that performed in XPS but with more advanced features and functionality. Once the C-code is modified and saved, the software application is rebuilt and recompiled automatically. This, in turn, generates a new ELF file that isthen be used by System Generator to recompile and update the bitstream to the target platform.
SW Iteration
1.
SDK -- Modify C-code and make sure the software project is recompiled successfully
2.
Sysgen – Click Compile and Update bitstream button
3.
Sysgen – Simulate the design
HW Iteration
1.
SDK – Add new peripherals or modify existing ones
2.
Sysgen – Re-import an XPS project into the Sysgen design
3.
Sysgen – Re-generate a HWCS block
4.
SDK – Modify C-code accordingly
5.
Sysgen – Re-simulate the design
Note:
Making HW changes requires a new design implementation through Place & Route.
184
www.xilinx.com
System Generator for DSP User Guide
UG640 (v11.4) December 2, 2009