In our last blog discussing Intel devices, we created a Nios II processor using platform designer before generating the programming files targeting the MAX 10-based DE10-Lite board.
In this blog, we’ll take the next step and write a simple application to run on the processor. In order to create a software application targeting the Nios II processor, first we need to create both an application and board support package in Eclipse.
To open the build tools, go to the tools menu and select Nios II Software Build Tools for Eclipse.
If you are familiar with Eclipse, the following will be normal. Eclipse requires you to confirm your workspace. This is where all settings and associated metadata will be stored. The actual software itself is stored under a directory called software.
Once the workspace has been created, the next step is to create the board support package. This is done in the Eclipse environment.
Since we need both an application and BSP, we can create them together with a template application to save time. For this example, we are going to create a simple hello world application.
This will open a dialog box which allows us to define the project name and template design we wish to create. It will also configure the BSP. To create the BSP, we will need to know the configuration of the processor system which is defined within the SPOC information file. This file will be at the top level of the your Quartus project directory.
Once the SPOC file has been added, the next step is to name the project and select the template type.
With the template selected, the next tab will show the BSP settings and allow us to select an existing BSP if one exists. Since one does not exist, we need to create a new BSP name so we know which application it is associated with.
This will create the application and BSP along with performing the compilation.
Once the application and BSP are compiled to deploy on the hardware, we then need to program the FPGA. From the Nios II window, select Quartus Prime Programmer. This will open the programmer in a new window. Ensure the board is connected to your development machine over its USB connection.
Once the programmer is open, select the programming file from the Quartus project outputs directory.
Start the programming and wait until it shows as programmed. It should take only a few seconds.
With the file programmed, we can now debug the application running on the Nios II processor in the DE10-LITE board.
To do this, we can select from the application project under the project explorer. Right click and select Debug As. Then select 2 Nios II Hardware.
This will open a new dialog for the debugger to download the application and halt execution. You might need to click on the target connection tab and refresh the connection before you can download the application.
Once the application is downloaded, the processor will halt at the first executable line. Eclipse will also ask you to change perspective view to the debug perspective. This view provides more information on the execution and debugging of the processor.
The STDIN / STDOUT of this application has been set to JTAG UART because there was not one within the hardware design. As such, you will see the Nios II console where messages from the processor will be visible.
We will see the application output visible in the Nios II console by running the application. This shows the application running as expected.
Now that we know how to create a simple Nios II processor in the hardware and an application in the software, we can begin looking at more advanced use cases.
Hi, I'm following the tutorial exactly as you say but I keep getting the same error, "Downloading ELF Process failed". I am using the Altera DE2-115 Development and Education Board with Quartus Prime Lite Edition v21.1.1 running on Windows 10.