Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

4.3.3.4.2. Building the Software

To create and build a software example, execute the following steps:

  1. Identify the directory containing the software example that you want to run, based on the hardware example that you want to use. For example, to run the mpu_basic software example on the MPU_Design_limit hardware design example, the directory is <design examples> /MPU_Design_limit/software_examples/app/ mpu_basic.
  2. Use one of the following methods to open the Nios® II Command Shell:
    • In the Windows operating system, on the Start menu, point to Programs > Intel FPGA > Nios® II EDS <version>, and click Nios II <version> Command Shell.
    • In the Linux operating system, in a command shell, execute the following commands:
      cd $SOPC_KIT_NIOS2
      ./sdk_shell
  3. Change directories to the software example directory identified in Step 1.
  4. Type the following command:
    ./create-this-app
  5. After the projects are generated and built, configure your board with the hardware image and run the software with the following commands:
    nios2-configure-sof -C ../../../
    nios2-download -g <example>.elf && nios2-terminal

    Each software example displays information on the screen. The output from the mpu_basic example resembles the example below.

mpu_basic Console Output

Using cable "
               Intel® FPGA Download Cable [USB-0]", device 1, instance 0x00
Pausing target processor: OK
Initializing CPU cache (if present)
OK
Downloaded 3KB in 0.0s
Verified OK
Starting processor at address 0x00010020
nios2-terminal: connected to hardware target using JTAG UART on cable
nios2-terminal: "
               Intel® FPGA Download Cable [USB-0]", device 1, instance 0
nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

Hello from a simple MPU-Enabled 
               Nios® II System!.
val1 = 0xfeedface, val2 = 0xfeedface, val3 = 0x@.

The output from the mpu_exc_detection example resembles unresolvable-reference.html#iga1464978349539.

mpu_exc_detection Console Output

mpu_exc_detection Console Output

Using cable "
               Intel® FPGA Download Cable [USB-0]", device 1, instance 0x00
Pausing target processor: OK
Initializing CPU cache (if present)
OK
Downloaded 5KB in 0.0s
Verified OK
Starting processor at address 0x00010110
nios2-terminal: connected to hardware target using JTAG UART on cable
nios2-terminal: "
               Intel® FPGA Download Cable [USB-0]", device 1, instance 0
nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

Hello from a simple MPU-Enabled 
               Nios® II System!.
	Starting some exceptions tests.
=====
MPU NULL data pointer test.
MPU NULL data pointer test passed!
MPU wild pointer test.
MPU wild pointer test passed!
MPU stack overflow test.
MPU stack overflow test passed!
=====
	Exception Tests ended.
Now exiting program.

For further details, refer to the source code and the <design examples>/ReadMe.txt file accompanying the examples.

If the software example appears to hang, verify that you have configured your board with the correct .sof.