1. Introduction
This article describes the development process for a system implementing the Nios® V processor (hereafter as Nios® V) using Ashling's RiscFree* IDE.
Nios® V is available starting with Quartus® Prime Pro Edition software version 21.3 (hereafter as Quartus® Prime Pro v21.3), but this version requires Command Line-based development. RiscFree* IDE
RiscFree* IDE support is available from Quartus® Prime Pro v22.2 and is not available for Quartus® Prime versions prior to this version.
For more information on Command Line-based development procedures, please see the following article.
Reference: Nios® V Processor Quick Start Guide for the procedure.
Point: When trying out Nios® V for the first time, we recommend using the latest version of our development tools, which support the RiscFree* IDE, version 22.2 and later, with improvements in usability with each version release.
For Nios® V related materials, follow the links below:
Reference: Nios®V Embedded Processor Design Handbook
Reference: Nios®V Processor Reference Manual
Reference: RiscFree* Integrated Development Environment (IDE) for FPGAs User Guide
2. System requirements
2-1. Supported devices and tool versions
For RiscFree* IDE installation, you can download Quartus® Prime as a Complete Download or Multiple Download, which includes the installer. If you are downloading Quartus® Prime as an Individual Files, please download the installer separately from the Additional Software section.
Quartus® Prime Pro v22.2 and later can be used without additional configuration, eliminating the need to install a compiler or other software from an external site, which was required in Quartus® Prime Pro v21.3.
See [Table 1] for supported devices.
| Nios® V Processor |
Quartus® Prime Standard Edition |
Quartus® Prime Pro Edition |
| Processor core |
Nios® V/c processor |
Nios® V/c processor |
| Device support |
MAX® 10 |
Cyclone® 10 GX |
2-2. Licensing
Both Nios® V and RiscFree* IDE can be used free of charge, but a license is required.
Please refer to the following article for details.
Reference: How to obtain a license file for Nios® V processor IP
3. Introduction of sample designs
3-1. Block diagram
This article uses "Arria® 10 FPGA - Nios® V/m Processor based Hello World" from "Nios® V/m Processor Intel FPGA IP" (hereafter as Nios® V/m) as a sample design.
This sample design is provided as a Nios® V/m sample design and can be downloaded from the following link.
Reference Material: Arria® 10 FPGA - Nios® V/m Processor based Hello World
A block diagram of the above sample design is shown below.
This sample design includes the Nios® V/m and was created with the smallest possible configuration that can be tested using the console.
Figure 1. Block Diagram of the Sample Design
3-2. Platform Designer Configuration
The Platform Designer system is created using the "create_qsys.tcl" file from the sample design introduced in "3-1. Block Diagram".
To create the Platform Designer system using the .tcl file, follow the steps of Platform Designer's View menu ⇒ System Scripting ⇒ Add "create_qsys.tcl" to Project Scripts ⇒ Run Script.
Figure 2. How to execute a .tcl file
The following figure shows the configuration of Platform Designer.
Figure 3. System Configuration of the Sample Design
4. Development of Nios® V with RiscFree* IDE
4-1. Preliminary preparations
As described in "3. Introduction of sample designs", hardware editing is not necessary for this sample design, so from this chapter we will introduce software development and RiscFree* IDE operation. First of all, RiscFree* IDE does not have any tools to create projects, so you need to create an empty project.
In this article, we will follow the RiscFree* IDE user guide and set the app folder name to "app" and the bsp folder name to "bsp."
Create the two folders in the following directories
<Quartus® Prime Project folder > \software\app
<Quartus® Prime Project folder > \software\bsp
Note: The "software" folder is used as a Workspace for the RiscFree* IDE.
After the folder is created, an empty file in the app folder is fine, and should contain the file in which you plan to write Main's application code.
This completes the preliminary preparation for project creation (in this sample, the app folder has already been created and hello.c is stored in the folder).
4-2. Bsp project creation
In this section, we will discuss how to create a bsp project, as described in "4-1. 4-1. Preliminary Preparation In this section, bsp projects are created by storing various files in the empty bsp folder created in section 4-1.
There are some differences in the flow between Quartus® Prime Pro and Quartus® Prime Standard. The following is an introduction to each.
4-2-1. In the case of Quartus® Prime Pro
In Quartus® Prime Pro, bsp projects are created in Platform Designer.
The procedure is as follows.
(1) Select the "BSP Editor" tab from the Open System GUI that opens when you start Platform Designer.
Figure 4. GUI of Create New BSP
(2) Click the Create button in the right red frame of the BSP setting file, and create a new .bsp file in the empty bsp folder created in "4-1. Preliminary preparations" from the New Platform Designer BSP.
Figure 5. bsp creation screen of Create New BSP
(3) Click the browse button [...] in the right red box in the System file (qsys or sopcinfo) column, select the .qsys file you created using the .tcl file in "3-2. Platform Designer Configuration" and click the Select button.
Figure 6. Select .qsys file in Create New BSP.
(4) After setting the bsp file and the .qsys file, Revision, CPU name, and Operating system are populated with data based on the .qsys file. After confirming that Revision and CPU name are correct, confirm that Altera HAL is selected for Operating system, and click the Create button.
Figure 7. Selection screen of "Operating system" in Create New BSP
Confirm that "jtag_uart" is set to stdin, stdout, and stderr, and click the Generate BSP button.
Figure 8. BSP Editor Settings Screen
The above is the procedure for creating a bsp project with Quartus® Prime Pro. 4-2-2.
4-2-2. In case of Quartus® Prime Standard
In Quartus® Prime Standard, bsp projects are created from the Nios® V command shell.
The procedure is shown below.
(1) Start the Nios® V command shell from the following directory:
<Quartus® installation directory>\<Quartus® Version>\Niosv\bin\Niosv-shell.exe
(2) Execute the following command from a Nios® V command shell:
niosv-bsp-editor.exe
Figure 9. Command input screen in Nios® V command shell
(3) After starting up the Bsp Editor, select File menu ⇒ New BSP to open the New BSP window, then click the browse button [...] under the SOPC Information File name. Click the browse button [...] under SOPC Information File name and select the .sopcinfo file.
Figure 10. .sopcinfo file selection screen
(4) After entering the sopcinfo file, you will be able to select the CPU name, Operating system, and Version. If you want to change the BSP target directory and the BSP Settings File name, you can uncheck Use default locations and use the BSP target directory browse [...] button.
Figure 11. Various setting screens in the New BSP window
(5) If there are no problems after checking each setting, click the "OK" button.
Figure 12. New BSP Window Setting Completion Screen
(6) Click the "Generate" button after completing the desired settings in the BSP Editor.
Figure 13.
4-3. app project creation
This section describes how to create an app project.
You can create an app project only by using commands, but you can also execute commands from the GUI by registering commands in the RiscFree* IDE.
To register commands in the RiscFree* IDE, see "5. launching external tools from the RiscFree* IDE". This section describes how to use the Nios® V Command shell.
Nios® V command shell from the following directory.
<Quartus® installation directory>\<Quartus® Version>\Niosv\bin\Niosv-shell.exe
The following two commands are used.
Executing this command will create the app project and generate the Cmakelist.txt file.
niosv-app --bsp-dir=<bsp project directory> --app-dir=<app project directory> --srcs=<source code directory> --elf-name=<name of the ELF file>
cmake.exe -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -B <build directory> -S <source code directory>
In this sample design, specify the current directory as the directory where the sample project is located and execute the command as follows
Execution example
niosv-app --bsp-dir=software/bsp --app-dir=software/app --srcs=software/app/hello.c --elf-name=hello.elf
cmake.exe -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -B software/app/build/Debug -S software/app
These are the steps to be taken before starting RiscFree* IDE.
4-4. Starting up RiscFree* IDE
This section describes how to debug using the RiscFree* IDE.
First, start the RiscFree* IDE.
Start the Nios® V command shell as described in section "4-3. app project creation".
After starting the Nios® V command shell, execute RiscFree.exe.
Figure 14. RiscFree.exe execution screen from Nios® V command shell
After executing RiscFree.exe, the Workspace selection screen will appear.
In this GUI, specify the software folder created in "4-1. Preliminary preparations" and click the ”Launch" button.
Figure 15. Workspace Selection Screen
The following screen will appear immediately after RiscFree* IDE is launched.
Figure 16. RiscFree* IDE Startup Screen
4-5. Importing a project
Since there is no project associated with the RiscFree* IDE in "4-4. Starting up RiscFree* IDE " in Figure 16, import the project first.
4-5-1. In case of Quartus® Prime Pro / Standard Ver 23.x or earlier
After selecting "New ⇒ Project" from the File menu, the GUI will be displayed.
Figure 17. How to import a project before v23.x (Part 1)
Select ”C/C++ ⇒ C/C++ Project" from the New Project window and click the "Next" button.
Figure 18. How to import a project before v23.x (Part 2)
Select "C++ Managed Build" from the New C/C++ Project window and click the "Next" button.
Figure 19. How to import a project before v23.x (Part 3)
In the C++ Project window, enter the name of the project in the Project name field, select "Cmake driven ⇒ Empty Project" in the Project Type field and "CMake driven" in the Toolchains field, and click the "Finish" button.
Figure 20. How to import a project before v23.x (Part 4)
4-5-2. In case of Quartus® Prime Pro Ver. 24.1 or later
After selecting "Import Nios V Cmake project..." from the File menu shown in the figure below, the GUI will appear. Follow the procedure below to import the project.
Figure 21. How to import a v24.1 or later project (Part 1)
The Import window shown below will appear. Select the project you want to import from the "Browse" button and click the "Finish" button.
Figure 22. How to import projects in v24.1 or later (Part 2)
This is how to import a project.
After the import is complete, the app and bsp projects will appear in the Project Explorer as shown below.
Figure 23. Project Explorer after importing a project
Note: In this article, both app and bsp projects are imported, but since debugging is possible even if only the app project is imported, import the bsp project according to the situation.
4-6. Building the project
After the project import is complete, build the project.
Right-click on the app project and select "Build project" from the menu shown below.
Figure 24. Build project
After the build is complete, confirm that the ELF file is generated as shown in the figure below.
Figure 25. Folder structure after the project build is complete.
Note: If you start the RiscFree* IDE from the Windows icon, a niosv-stack-report return error will occur during the build process. However, if an ELF file is generated, you can safely ignore this error.
Reference: Why does niosv-stack-report return error during Nios® V build flow in RiscFree* IDE for FPGAs?
4-7. Running the Project
After the build is complete, download the ELF file and run the software.
Download the .sof file from the Quartus® Prime Programmer and complete the FPGA configuration before proceeding.
In this example, the Reset input to Nios® V is controlled by ISSP (In system source and probe), so it is necessary to toggle the Reset signal from Quartus® Prime.
Open the "In-System Source and probes Editor" from the Tools menu of Quartus® Prime.
Figure 26. Launching the In-System Source and probes Editor
The window shown below will appear. Click the number in the red frame twice to toggle the Reset input.
Figure 27. Toggling the Reset signal in the In-System Source and probes Editor
Return to the RiscFree* IDE window, right-click on the app project, and select "Run As ⇒ Run Configurations".
Figure 28. Startup of Run Configurations
From the Run Configurations window that appears, double-click "app Debug" under Ashling RISC-V (auto-detect) Hardware Debugging to display the configuration screen shown below.
In the Main tab, make sure that the app project name is listed under Project, and select the .elf file that you generated in C/C++ Application.
Figure 29. Startup of Run Configurations
After completing the settings on the Main tab, open the Debugger tab. If the settings are correct, click
Auto-Detect Scan Chain in the center of the screen. If they are correct, click on the Auto-Detect Scan Chain button at in the center of the screen.
Note: RiscFree* IDE does not have a JTAG console, so you can check the output by connecting to a separate JTAG console. For information on how to connect a JTAG console with the RiscFree* IDE, see See " 5. Launching external tools from the RiscFree* IDE".
Figure 30. Run Configurations setting
Figure 31. JTAG Console Output Screen
4-8 Debug Run of Project
This section introduces the software Debug Run.
First, start the GUI for Debug Run. Right-click on the app project and select "Debug As ⇒ Debug Configurations" same as executing Run As.
Figure 32. Startup procedure of Debug Configurations
After selecting "Debug Configurations," a GUI in the same format as the GUI for Run configuration will be displayed. Click "Apply" and "Debug".
When the Confirm Perspective Switch window shown below appears, click "Switch" to close it.
Figure 33. Debug Perspective Selection Window
The following figure shows the state immediately after the debug window is launched. The program counter is break status at the first instruction in the main function.
Figure 34. Debug Window Startup Screen
The above figure provides a brief overview of the three main windows.
The "Show View" menu in the Window menu allows you to display windows other than the ones displayed by default in the debug window.
Figure 35. How to Add Windows
To see where the current Break is, check the instruction in the source code display that is highlighted with a green background.
If you want to break at other instructions, double-click on the left side of the instruction you want to break, and you can add a break point as shown in the red frame part of the figure below.
Figure 36. How to Add a Break Point
Debugging operations can be performed from the debug toolbar at the top of the screen.
For details on how to use each toolbar, please refer to the following figure and table.
Figure 37. Description of Debug Toolbar Buttons
| No. | Button Name | Function |
| 1 | Resume | Resumes until the next Break point or until the debugging process is completed. |
| 2 | Suspend | Suspends the code being debugged. |
| 3 | Terminate | Terminates the code being debugged. |
| 4 | Step into | Steps into the next method of the currently executing code. |
| 5 | Step Over | Steps over to the next method in the currently executing code. |
| 6 | Step Return | Returns from the method that stepped in. |
5. Launching external tools from the RiscFree* IDE
5-1. Overview
The RiscFree* IDE uses the External Tools Configuration to execute an executable file with arguments in the GUI.
Since RiscFree* IDE does not have a JTAG console by default, use this configuration when using console output via JTAG UART.
5-2. Registering external tools
This section describes how to register external tools.
(1) Select Run menu ⇒ External Tools ⇒ External Tools Configuration in the RiscFree* IDE.
Figure 38. How to Register External Tools (Part 1)
(2) Select "New launch configuration" from the red frame in the figure below.
Figure 39. How to register External Tools (Part 2)
(3) Enter the values as shown below and click the Apply button to complete the registration.
Figure 40. How to register External Tools (Part 3)
*1 : By selecting "Browse Workspace", you can easily enter the app and bsp directories.
*2 : By clicking "Show Command Line", you can confirm the actual command to be executed as shown in the figure below.
Figure 41. How to register External Tools (Part 4)
5-3. Recommended registration commands
This section introduces some useful executable files that can be registered to streamline your work when developing a system implementing Nios® V in the RiscFree* IDE.
| Executable File Name | Location | Arguments | Summary |
| juart-terminal.exe | <Quartus® installation directory>\ <Quartus® Version>\Quartus\bin64 |
-c 1 -d 0 -i 0 | Displaying the Jtag Console |
| niosv-app.exe | <Quartus® installation directory>\ <Quartus® Version>\Niosv\bin |
See ” 4-3. app project creation ”. | |
| cmake.exe |
<Quartus® installation directory>\ |
||
6. Conclusion
In this article, we have described the procedure for developing a Nios® V implementation system using Ashling's RiscFree* IDE.
For more information on the Nios® V processor, please refer to the manufacturer's page below.
We have also compiled information on Nios® V on our web content "Nios® V Summary Page" which contains a summary of information on Nios® V. Please refer to this page as well, as it contains useful information other than this article.