S3embedded Tutorial XPS SDK Flow
S3embedded Tutorial XPS SDK Flow
This tutorial is an introduction to Embedded System development with the MicroBlaze soft processor and low cost Spartan-3 FPGAs. In this tutorial you will design a custom Embedded system and develop your application software. First, you will get started with the Base System Builder (BSB) wizard in Xilinx Platform Studio (XPS). You will create a custom Embedded Processing system (a custom Microcontroller) targeted at the Spartan 1800A FPGA board. Then you will use the Xilinx Software Development Kit (SDK an Eclipse-based IDE) to compile and debug some embedded software that runs on this system.
Local Memory
Custom Coprocessors
JTAG
MMU
Cache
MicroBlaze
FPU
PLBv46
Debug
Trace
Ethernet MAC
UART
PCI Express
Generic Peripheral Controller GPIO
CAN/MOST
Custom I/O Peripherals USB 2.0
Spartan FPGA
MicroBlaze Tutorial
www.xilinx.com
Objectives
After completing this tutorial, you will be able to: Create an Embedded system with the MicroBlaze processor on Spartan-3 FPGA using Base System Builder (BSB) wizard Generate and Download the FPGA design bitstream on the board using Xilinx Platform Studio (XPS) Create a simple software application using Eclipse-based Platform Studio Software Development Kit (SDK) Debug the software application using the Eclipse IDE (SDK)
Requirements
Embedded Development HW/SW Kit Spartan-3A DSP S3D1800A MicroBlaze Processor Edition Hardware Requirements Xilinx MicroBlaze Development Kit (Spartan-3 1800A edition) o Spartan-3 1800A DSP FPGA board o Xilinx Platform Cable USB o RS232 cable Software Requirements ISE Design Suite 10.1 (including EDK 10.1) HyperTerminal or Tera Term terminal program connecting the PC and the FPGA board at 115,200 baud
MicroBlaze Tutorial
www.xilinx.com
Navanee S
1.
2. You will create a new project: Select Base System Builder wizard and Click OK
3. Select the design directory for new project: Click the Browse button and browse to the following location: C:\Workshop\MB_Workshop\mb_basic\ The file name should be: system Click Save Click OK
4. Next the Wizard will give options on how to create the system: Select I would like to create a new design Click Next 5. Select the target development board: Select Board vendor:Xilinx Select Board name: Spartan-3A DSP 1800A Starter Board Click Next
MicroBlaze Tutorial www.xilinx.com 3 Navanee S
6. Select the processor. (Here you have no other option only the Virtex-5 FXT FPGA has a PowerPC processor): Click Next 7. Configure the processor options. You can modify options like local on-chip memory size, caches, FPU, etc. For now, you will leave the defaults and modify the system later. Click Next
MicroBlaze Tutorial
www.xilinx.com
Navanee S
8. Configure the I/O interfaces of your embedded system. Here you can select the right set of Peripherals you need for your target system or microcontroller and also customize each peripheral: Select the drop down for Baudrate and choose 115200 Click Next
MicroBlaze Tutorial
www.xilinx.com
Navanee S
9. Continue configuring the I/O interfaces. For now, you will unselect the Ethernet MAC and SPI Flash peripherals as we will not be using it in this tutorial. This will make the design smaller and also save some time when we create the FPGA netlist/bitstream for this tutorial: Unselect Ethernet MAC peripheral Click Next
10. Add some internal on-chip peripherals: Click Add Peripheral Select XPS Timer Click Ok
11. Customize the Timer by enabling Interrupts: Click Use Interrupt for the timer peripheral Click Ok
MicroBlaze Tutorial
www.xilinx.com
Navanee S
12. Next the wizard will help you create some sample programs that will do some diagnostics on your custom embedded system. You can leave the defaults and modify the software later: Click Next Click Next Click Next 13. Now you have finished creating a basic system. The wizard will let you review your selections and generate the system: Click Generate Click Finish
MicroBlaze Tutorial
www.xilinx.com
Navanee S
NOTE: This step will take almost 30 minutes. Do not close the window !
This will create the FPGA design files, synthesize the netlist and also place and route the design creating the bitstream. The FPGA on the board will also be configured with this new bitstream containing your custom embedded system. Your custom hardware is now ready. Next will write and program some software.
MicroBlaze Tutorial
www.xilinx.com
Navanee S
2. In SDK, start creating a new software application using the Application Wizard: Select Create a New SDK C Application Project Click Next
Use the rest of the project defaults Click Next Click Finish
4. In the Editor view, edit the default program main.c and save it: Insert the following line after main() { print(Hello World); NOTE: It is print() and not printf(). Select the menu File-> Save
Saving the program will also compile it and result in hello.elf as you see in the console view. Now you are ready to download and debug the program on the board.
MicroBlaze Tutorial
www.xilinx.com
10
Navanee S
The output of your Hello world program can be seen in this console. 2. From SDK, start debugging the program as follows: Select the Menu item Run->Debug As->Debug on Hardware
SDK will now change to the Debug Perspective. SDK will also connect to the FPGA board via the USB cable, connect to the MicroBlaze processor and download the program to memory. Now you are ready to debug the program using the Eclipse Debug perspective.
MicroBlaze Tutorial www.xilinx.com 11 Navanee S
3. In the Debug perspective, click on the resume button (looks like Play button): Click the Resume button NOTE: You can alternatively select Run->Resume
You should now see the output of the program on the Serial console (TeraTerm program) as follows:
MicroBlaze Tutorial
www.xilinx.com
12
Navanee S
You can now use the Eclipse IDE to modify your program and debug it further. Here are some steps to try out on your own: 1. In the SDK IDE source code perspective, a. Use the Application Wizard to import Test_App_Memory and Test_App_Peripheral programs. 2. While debugging, a. View Registers, Memory b. Single Step through the program using Step, Next c. Toggle between assembly and source views 3. In the SDK IDE source code perspective, a. Modify the linker script and change the location where the program is running from
MicroBlaze Tutorial
www.xilinx.com
13
Navanee S