You are on page 1of 4

Setting Up SVN Files for Quartus II and the Nios II IDE

Revised: 29 Nov 2007


Description
This document describes how to get all the project files from the SVN in a state usable by the
development programs. It also describes how to flash programs and FPGA configuration files
to the DE2.
Setting up SVN trunk
This assumes you correctly have TortoiseSVN installed on your machine
1. Create a folder on your computer that you will use to hold all the SVN files. The
computers in our clinic room use "2007MicronClinicSVN"
2. Right click on this folder and click on "SVN Checkout"
3. Where it asks for the URL...use the following
https://2007-uofu-micron-clinic.googlecode.com/svn/trunk/
You can get your password by logging into the google code website and click
on the source tab. There is a link on that page that will give you your
password.
4. It will take a few minutes to download all the files
Setting up your SVN branch
Using branches of the code allows you to tweak firmware/hardware and test your changes
without affecting everyone else's code. After you have tested your code, you can merge the
changed files back into the trunk if you are the one in charge of that code.
1. After the downloads are finished from step 1, open up the directory you created.
2. Right click on the folder "NANDFlashController" and click on "Branch/Tag"
3. Next to the "To URL:" field, click the "..." button on the right
4. Collapse the top level and then expand it out again. You should see a "branches"
folder, expand this out.
5. Right click on the "branches" folder and create a folder with your name
6. Select the folder with your name and click OK
7. Add "/NANDFlashController" to the end of the URL in the "To URL:" field and click
OK
8. You now have your own copy of code in the /branches/NAME/NANDFlashController
repository in SVN
Setting up the Quartus II files
1. Create a folder on your hard drive (recommended spot is C:
\altera\NANDFlashController...should with with other locations, but no guarantees) to
store the projects
2. In this folder, create three folders "NiosII_Firmware", "DE2_Hardware_Trunk" and
"DE2_Hardware_Branch"
3. Right click on the "DE2_Hardware_Branch" folder and click on SVN Checkout
4. Browse to your branch and select the "DE2_Hardware" folder and click OK. Do the
same for the "DE2_Hardware_Trunk", but checkout the files under the trunk part of
the SVN.
5. SVN files will now be downloaded to these folders. Quartus will work out of the box
with this setup, just open the project file stored in these directories. You can test this
by compiling the project...if it compiles it works.
Setting up Nios II IDE files
1. Fire up Nios II IDE and select the "NiosII_Firmware" folder as your workspace and
close welcome tab
2. Click of File -> New -> Nios II System Library
You can name this whatever you want...I recommend something like
"ControllerFirmware_trunk_syslib"
Make sure that "Specify Location" is checked and browse to your
"NiosII_Firmware" folder
The SOPC Builder System PTF file is found in the "DE2_Hardware_Branch"
folder you created earlier
3. Click Finish. This creates the "ControllerFirmware_trunk_syslib" and "altera.
components" projects in your workspace.
4. To add the SVN project, make sure you have the SVN plugin for Eclipse installed.
Click on File -> Import
5. Click on Other -> Checkout projects from SVN. Click next.
6. Create a new repository location and use the following URL...accept the certificate
https://2007-uofu-micron-clinic.googlecode.com/svn/
7. Select the "NANDFlashController/NiosII_Firmare/NANDFlashControllerFirmware"
folder the trunk of the SVN
8. Leave the defaults for this screen and click Finish.
9. Select Altera Nios II -> Nios II C/C++ Application and click next
10. Here are the settings for this page
You can name this whatever you want...I recommend
"ControllerFirmware_trunk"
Make sure that "Specify Location" is checked and browse to your
"NiosII_Firmware" folder
The SOPC Builder System PTF file is found in the "DE2_Hardware_Trunk"
folder you created earlier
Select blank project for the template
11. Click Next
12. Select the trunk System Library you created earlier and click Finish. Click OK on the
confirm overwrite
13. Right click on the system library project and go to properties
14. In the left panel, click on "System Library"
15. In the heap memory option, change it from sdram_0 to sram_0. This allows the
firmware and the NAND controller to share memory
16. Right click on the system library project and click on New -> Other...
17. Select General -> Folder, click next then click on Advanced
18. Check "Link to file in the file system"
19. Browse to the "NANDFlashController/DE2_Hardware_Branch/ISP1362" folder and
click Finish
20. Repeat steps 18 and 19 for the "NAND_Controller" folder
21. (Optional) To enable the printing of debugging messages, right click on the either
your branch project or your trunk project, click on Properties and go to the C/C++
Build section. Click on the "preprocessor" folder and add the following preprocessor
tags, depending on what you want to enable
DEBUG_LCD_ENABLE
DEBUG_STDERR_ENABLE
22. The former will print messages to the LCD and the latter will print over the USB to
the console on the PC in the Nios II IDE. You probably don't need to do this since
debugging info is by default send over USB to the testing application portion of our
GUI.
23. To set up the build target, select the project you want to use to download to the board
(i.e. your branch or your trunk). Under the Run menu, click on Run. Double click the
"Nios II Hardware" text to create a default target for this project. After building the
project (Ctl-B or through the Project Menu), using this run target will download the
binaries to the board and fire it up. If you created both trunk and branch projects, you
can create two run targets by selecting the other project and then double clicking the
"Nios II Hardware" to create a target for that project. You can quickly run the last run
target with the green play button and selecting your target by click the little down
arrow next to it.
Repeat this section if you want to add yourbranch code. You will need to create a new system
library with the PTF file of "DE2_Hardware_Branch" and then check out the SVN project
from your branch instead of the trunk. You only need to set up branch projects if you intend
to modify the firmware AND check in into the repository.
Setting up the Flash Programmer
1. Make sure you have a current SOF file downloaded to the board. This should be the
case from now on since the trunk SOF is already flashed onto the board.
2. With the project you want to flash selected in the Nios II IDE, click on Tools -> Flash
Programmer
3. Double click the Flash Programmer icon to initialize a default configuration for this
project
4. Click "Load JDI File" and select the JDI in the proper hardware directory
(DE2_Hardware_Branch or DE2_Hardware_Trunk)
5. Click the box to download the SOF to the board as well
6. Click apply
7. Click Program Flash
Note on Version Numbers
The firmware is set up to display the NAND controller version (set in s1_slave.v) as well has
the firmware version (set in main.c). These are displayed on the seven segment display with
the hardware version on the two leftmost displays and the firwmware in the next two displays
to the right. Whenever something functionally changes with either the firmware or the
hardware, the version number should be incremented. Matching number should indicate that
both the firmware and the hardware have been designed and tested to work with each other.

You might also like