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\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


Documentaion | Download PDF

Housekeeping before starting dev tools

We need to create a software folder in out project directory so that our software can be stored

  1. Navigate to our project folder for example C:\altera\mySystems\system1
    1. Add a new folder by right clicking --> new --> folder
    2. Name this folder “software”
  2. Now navigate into the software folder we just made at C:\altera\mySystems\system1\software
    1. Add a new folder by right clicking --> new --> folder
    2. Name this folder “workspace”


Note: You cannot have any spaces in your file names

Setting up a project in Nios II IDE
  1. Start the Nios II Software build tools for eclipse
  2. A popup asking for workspace should pop up, in this popup clink browse
    1. Select the workspace folder we just made C:\altera\mySystems\system1\software\workspace
  3. Once eclipse has loaded go to file --> new --> Nios II Application and BSP form template
    1. A popup should show up, specify the path to your sopc information file name by clicking on the ... icon (this should be located at C:\altera\mySystems\system1\niosIISystem.sopcinfo
    2. Name the project (Hello_world in this case)
    3. For project location select default, this should be the location to the software folder we just created. If the default location is different de-select the use default location check box and ender in the correct project location
    4. You can now select a template file, for this demo we will be using the Hello World Small template. If you are building a new custom project from scratch you can select Blank Project
    5. Click next
    6. You want to make sure the bsp is stored in the same location as the project location on the previous screen.
    7. Make sure the filename for the bsp is Hello_World_bsp
    8. Click finish
  4. Once its fichined int he project exploer pane (on the left had side) there shoudl be two projects, Hello_World and Hello_World_bsp
  5. Right click on the Hello_World_bsp and go to properties --> Nios II BSP Properties and click on BSP editor; this will open the bsp editor
    1. Make sure that stdin, stdout, stderr are all set to jstg_urt
    2. Under hal.linker make sure that for exeption_stack_memory_region_name and interrupt_stack_memory_region_name are both set to onchip_memory
    3. Go to the linker script tab at the top and make sure it is setup like figure 1
  6. Click Generate
  7. Once generated click exit
  8. In the properties window click ok
  9. Right click on the Hello_World project and go to Build Project
  10. Plug in the FPGA power and usb cables as seen in figure 2 for the DE2-115
  11. Go to Nios II in the top navigation and select Quartus II programmer, this will open the Quartus II programmer utility
    1. Click add files and select the .sof files located at C:\altera\mySystems\system1\output_files\NiosII_time_limited.sof (if you paid for Quartus II and are not using the web edition the file will just be NiosII.sof)
    2. Click OK to the time limited popup
    3. Click start
    4. Once the progress is finished the board will have the system programed onto the fpga (note this is just the system and not the software, think of this as building hardware)
    5. If a popup opens for time limited notice, leave this popup open as it allows the use of Altera IP inthe web edition.
  12. Go back to the Nios II dev tools for eclipse and right click on the Hello_World project and go to Run As --> Nios II Hardware
  13. Your project should now run on the fpga
  14. Some common errors are elf error, failure to download. This error is a blanked error that most like occurs because you ran out of space for your program, like using on chip memory when you should use sram. This can also occur for other reasons, if it does go back and check your system and your bsp settings.
  15. If you get a popup saying no Nios II target connection paths were located, go under the Target connection tab, click refresh connections
  16. If you get timetamp or mismatch system id errors fix this by going to the run configurations window
    1. Right click on your Hello_World project go to run/debug settings
    2. Double click on the one for the current project Hello_World Nios II Hardware Configuration
    3. Under target connection tab in system ID checks check the Ignore mismatched system ID and Ignore mismatched system timetamp


Note: Do not edit files in the Hello_World_bsp project



Downloads

Download Written Documentaion (PDF)

Download Quartus, Qsys and Eclipse Project Files (ZIP)

Well this donation will also go towards things like FPGA’s, server space and well beer if there is any left over.
Support the site by buying the stuff you were already going to buy