Intel® Quartus® Prime Pro Edition User Guide: Debug Tools

ID 683819
Date 7/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

7.8.1. Nios® II Processor Example

This example programs the Nios® II processor on your board to run the count binary software example included in the Nios® II installation. This is a simple program that uses an 8-bit variable to repeatedly count from 0x00 to 0xFF. The output of this variable is displayed on the LEDs on your board. After programming the Nios® II processor, you use System Console processor commands to start and stop the processor.

To run this example, perform the following steps:

  1. Download the Nios® II Ethernet Standard Design Example for your board from the Intel® website.
  2. Create a folder to extract the design. For this example, use C:\Count_binary.
  3. Unzip the Nios® II Ethernet Standard Design Example into C:\Count_binary.
  4. In a Nios® II command shell, change to the directory of your new project.
  5. Program your board. In a Nios® II command shell, type the following:
    nios2-configure-sof niosii_ethernet_standard_<board_version>.sof
  6. Using Nios® II Software Build Tools for Eclipse, create a new Nios® II Application and BSP from Template using the Count Binary template and targeting the Nios® II Ethernet Standard Design Example.
  7. To build the executable and linkable format (ELF) file (.elf) for this application, right-click the Count Binary project and select Build Project.
  8. Download the .elf file to your board by right-clicking Count Binary project and selecting Run As > Nios® II Hardware.
    • The LEDs on your board provide a new light show.
  9. Type the following:
    system-console; #Start System Console.
    
    #Set the processor service path to the Nios II processor.
    set niosii_proc [lindex [get_service_paths processor] 0]
    
    set claimed_proc [claim_service processor $niosii_proc mylib]; #Open the service.
    
    processor_stop $claimed_proc; #Stop the processor.
    #The LEDs on your board freeze.
    
    processor_run $claimed_proc; #Start the processor.
    #The LEDs on your board resume their previous activity.
    
    processor_stop $claimed_proc; #Stop the processor.
    
    close_service processor $claimed_proc; #Close the service.
    
    • The processor_step, processor_set_register, and processor_get_register commands provide additional control over the Nios® II processor.