Getting Started with Microblaze Servers
Note:The Nexys Video uses a Gigabit Ethernet module which requires the TEMAC IP that is not contained in the Vivado Webpack. In order to complete this tutorial, you must either purchase a license for the TEMAC IP or get the evaluation license for free from their website by following this guide.
This guide will provide a step by step walk-through of creating a Microblaze based hardware design using the Vivado IP Integrator that will build over the Getting Started with Microblaze guide by making use of the on-board Ethernet port and GPIOs for the Nexys Video FPGA board.
At the end of this tutorial you will have a comprehensive hardware design for Nexys Video that makes use of various Hardware ports on the Nexys Video which are managed by the Microblaze Softcore Processor block.
What you need before proceeding with this guide
- Xilinx Vivado with the SDK package.
- Follow this Wiki guide (Installing Vivado ) on how to install and activate Vivado 2014.4
- TEMAC IP license installed
- Follow this Wiki guide (Installing the 120 Day Evaluation License for the TEMAC IP).
Board Support Files
- Board Support Files. These files will describe GPIO interfaces on your board and make it easier to select your FPGA board and add GPIO IP blocks.
- Follow this Wiki guide (Vivado Board Files for Digilent 7-Series FPGA Boards ) on how to install Board Support Files for Vivado 2014.4.
The Nexys Video board files
- Digilent Nexys Video FPGA Board and Micro USB Cable for UART communication and JTAG programming
Microblaze is a soft IP core from Xilinx that will implement a microprocessor entirely within the Xilinx FPGA general purpose memory and logic fabric. For this tutorial, we are going to add Ethernet functionality and create an echo server.
General Design Flow
- Open Vivado and select Nexys Video board
- Create an new Vivado Project
- Create empty block design workspace inside the new project
- Add required IP blocks using the IP integrator tool and build Hardware Design
- Validate and save block design
- Create HDL system wrapper
- Run design Synthesis and Implementation
- Generate Bit File
- Export Hardware Design including the generated bit stream file to SDK tool
- Launch SDK
Now the Hardware design is exported to the SDK tool. The Vivado to SDK hand-off is done internally through Vivado. We will use SDK to create a Software application that will use the customized board interface data and FPGA hardware configuration by importing the hardware design information from Vivado.
- Create new application project and select default Hello World template
- Program FPGA
- Run configuration by selecting the correct UART COM Port and Baud Rate
Step- by- Step Walk Through
Create a new project
1. Click on Create New Project. Choose the Project Name and Location such that there are no blank spaces. This is an important naming convention to follow for project names, file names and location paths. Underscore in a good substitute for empty spaces.
It is good practice to have a dedicated folder for Vivado Projects, preferably with the smallest possible path length. Example: C:/Vivado_Projects.
Name your Project and select the Project location and click next.
2. Choose Project Type as RTL Project. Leave the - do not specify sources box unchecked and click next.
3. If you have followed the Board Support File Wiki guide then click next and select Boards.
From the filter options make required selections for Vendor, Display Name and Board Revision. Nexys Video should be displayed in the selection list. A mismatch in selecting the correct board name will cause errors.
4. Click Next, followed by Finish and Vivado will create a project for you.
Create a Block Design
5. Create a Block Design by clicking the button circled in blue below.
Add the Microblaze Core
6. Start out by clicking the “Add IP” button circled in blue below. Search for “Microblaze” and double click the IP highlighted below.
7. Click “Run Block Automation” circled in blue, and change the options to match the ones in the picture below. Click “Ok”.
Adding the Necessary Output Clocks
8. Double-click the Clocking Wizard block highlighted below, and set CLK_IN1 to use “sys_clock” and EXT_RESET_IN to use “reset”.
9. Select the Output Clocks tab and enable clk_out2, clk_out3. Set clk_out2 to 200MHz, and clk_out3 to 125MHz. Set the Reset Type to Active Low using the bullets below. When you are finished, click Ok.
Adding More Interrupts
10. Find the Concat block and double click it. Set number of ports to 5 and press OK.
Adding the IP Cores
11. We will now add all of the necessary IP blocks to our project. There are 4 cores we will add:
- Memory Interface Generator
- AXI Uartlite
- AXI Ethernet Subsystem
- AXI Timer
Add all of these to your design, one at a time, using the “Add IP” button. Once they are all added, you should see the four blocks shown below.
Configuring and Routing the IP Cores
12. Click “Run Block Automation” and run it for the mig_7series_0 block.
When the MIG block automation is run, you will see this specific error message [BD 41-1273]. You can ignore this for now. It will not affect your design in any way. The MIG block will be configured as per the board support files that have been downloaded for Nexys Video. Click OK to dismiss this message. You will find the MIG IP block now has additional input and output pins which have to be connected to valid signals.
13. Click “Run Block Automation” and run it for the axi_ethernet_0 block. Change Physical Interface Selection to RGMII and click OK.
Click “Run Connection Automation”. Un-check the microblaze_0 check-box and click OK.
14. Click “Run Connection Automation” again. Run this for the axi_ethernet_0_dma.
15. Click Regenerate Layout (circled in blue below), and your block design should look like this:
Routing the Missing Connections
16. The Concat block takes interrupt inputs and sends them to the Microblaze controller.
Route the following connections to the inputs of the Concat block. Order does not matter.
- interrupt on the AXI Timer block.
- mm2s_introut and s2mm_introut on the axi_ethernet_0_dma block.
- mac_irq and interrupt on the axi_ethernet_0 block.
- Connect resetn on the Clocking Wizard block to the reset pin input.
- Connect sys_clk_i on the mig_7_series_0 block to the clk_out2 output from the Clocking Wizard.
19. Right click on the blue striped rectangle next to the DDR3+ bus on the Memory Interface Generator block and click “Make External”.
20. Clicking Regenerate Layout again will result in your final block design layout for this project.
21. Click the Validate Design button to make sure that you did not make any errors.
22. Now, right click on your design_1 block diagram and click “Create HDL Wrapper”. When the window pops up, select the “Let Vivado manage wrapper and auto-update” bullet and click OK.
23. Click “Generate Bitstream” at the top of the work space. This process will take a while.
Exporting Hardware Design to SDK
24. On the top left corner of the window, from the tool bar click on File and select Export Hardware. This will export the hardware design with system wrapper for the Software Development Tool - Vivado SDK. Make sure the generated bitstream is included by checking the box.
25. Go to File and select Launch SDK and click OK. The SDK file created local to the Vivado design project location will be launched. The hand-off to SDK from Vivado is complete.
Inside SDK for Vivado
26. A new window for SDK will open. The HW design specification and included IP blocks are displayed in the system.hdf file. SDK tool is independent of Vivado, i.e. from this point, you can create your SW project in C/C++ on top of the exported HW design. If necessary, you can also launch SDK directly from the SDK folder created in the main Vivado Project directory.
Now, if you need to go back to Vivado and make changes to the HW design, then it is recommended to close the SDK window and make the required HW design edits in Vivado. After this you must follow the sequence of creating a new HDL wrapper, save design and bit file generation. This new bit file and system wrapper must then be exported to SDK.
Since we do not have any HW design edits at this point, we will proceed with creating a software application to run an echo server.
Creating New Application Project in SDK
27. Go to File in the main tool bar and select New » Application Project. A new project window will pop up. Give your SDK project a name that has no empty spaces as shown below. Make sure the Target Hardware is the correct hardware design. In our case, it will be “design_1_wrapper_hw_platform_0”.
If for example, you also have another hardware design in the Project Explorer window, then you will also see this design name in the Target Hardware drop down selection list.
Since we only have one hardware design design_1_wrapper_hw_platform_0 this will be our target hardware. Select Create New under Board Support Package. The tool will automatically populate the Board Support Package name to match with the give project name.
Select IwIP Echo Server under the list of available templates and click Finish.
28. After completing the previous step, you will see two new folders in the Project Explorer panel.
- echo_server which contains all the binaries, .C and .H (Header) files
- echo_server_bsp which is the board support folder
echo_server is our main working source folder. This also contains an important file shown here in the src folder called “lscript.ld”. This is a Xilinx auto generated linker script file. Double click on this file to open.
Verify Linker Script File for Memory Region Mapping
29. In the linker script, take a look at the Section to Memory Region Mapping box. If you did the Make DDR2 External step then the target memory region must read mig_7series_0.
Scroll down to check if this applies to all rows. If for any region it does not say mig_7series_0, then click on the row under the Memory Region column and select mig_7series_0.
Setting PHY Link Speed
30. Open the system.mss file within the echo_server_bsp folder and click Modify this BSP's Settings.
Select lwip140, then expand the temac_adapter_options and find phy_link_speed in the list. Change the value of phy_link_speed to CONFIG_LINKSPEED1000 and press OK.
Programming FPGA with Bit File
31. Make sure that the Nexys Video is turned on and connected to the host PC with the provided micro USB cable plugged into the Prog port on the Nexys Video.
On the main toolbar, click Xilinx Tools»Program FPGA
Make sure that the Hardware Platform is selected as design_1_wrapper_hw_platform_0.
In the software configuration box, under ELF File to Initialize in Block RAM column, the row option must read bootloop. If not, click on the row and select bootloop.
Now click on Program.
Setting up the SDK Serial Console and Running the Server
32. Right click on the echo_server project folder and select Run As » Run Configurations
Move the USB plug from the Prog port on your board to the UART port. Now go to the STDIO Connection tab and check the Connect STDIO to Console check-box. Click Apply, then click Run.
Running the Server
33. In the console window at the bottom of the screen the details of the connection will be displayed.
Testing the Server with Tera Term
34. Connect your PC to your Nexys Video using an Ethernet cable.
35. In order to connect to the echo server, you must set up your Ethernet connection with a static IP address. To do this:
- Right click your internet connection and click Open Network and Sharing Center.
- Find the Ethernet Connection to your Nexys Video. It should be an unidentified network. Click Local Area Connection.
- Click Properties.
- Select Internet Protocol Version 4 (TCP/IPv4) and click Properties.
- Click the Use the following IP address: bullet and type in an IP address 192.168.1.XX, where XX is a value between 2 and 255, but not 10. This IP must not be the same as another already on your network. Make sure to click within the Subnet mask field to get the 255.255.255.0 mask to autofill. Click Ok and you will have a static IP address.
36. Open Tera Term and type in the following info and click Ok.
37. Type anything into the console and press Enter. The echo server will echo back your input and display it in the console.
You can go to Setup>Terminal and change the settings below for a more traditional echo server format