Embedded Design Handbook

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

4.2.2.4.6. Building and Running the Software in Nios® II Software Build Tools for Eclipse

Building the Project

After you edit the BSP settings and properties, and generate the BSP (including the makefile), you can build your project. Right-click your project in the Project Explorer view and click Build Project.

Downloading and Running the Software

To download and run or debug your program, right-click your project in the Project Explorer view. To run the program, point to Run As and click Nios II Hardware.

Before you run your target application, ensure that your FPGA is configured with the target hardware image in your .sof file.

Communicating with the Target

The Nios® II Software Build Tools for Eclipse provide a console window through which you can communicate with your system. When you use the Nios® II Software Build Tools for Eclipse to communicate with the target, characters you input are transmitted to the target line by line. Characters are visible to the target only after you press the Enter key on your keyboard.

If you configured your application to use the stdio functions in a UART or JTAG UART interface, you can use the nios2-terminal application to communicate with your target subsystem. However, the Nios® II Software Build Tools for Eclipse and the nios2-terminal application handle input characters very differently.

On the command line, you must use the nios2-terminal application to communicate with your target. To start the application, type the following command: nios2-terminal

When you use the nios2-terminal application, characters you type in the shell are transmitted, one by one, to the target.

Software Debugging in Nios II Software Build Tools for Eclipse

This section describes how to debug a Nios® II program using the Nios II Software Build Tools for Eclipse. You can debug a Nios® II program on Nios® II hardware such as a Nios development board. To debug a software project, right-click the application project name, point to Debug As and click Nios® II Hardware.

Note: Do not select Local C/C++ Application. Nios® II projects can only be run and debugged with Nios® II run configurations.

For more information about using the Nios® II Software Build Tools for Eclipse to debug your application, refer to the Debugging Nios® II Designs chapter of the Embedded Design Handbook.

Run Time Stack Checking

For debugging purposes, it is useful to enable run-time stack checking, using the hal.enable_runtime_stack_checking BSP setting. When properly used, this setting enables the debugger to take control if the stack collides with the heap or with statically allocated data in memory.

For information about how to use run-time stack checking, refer to “Run-Time Analysis Debug Techniques” and Stack Overflow in the Debugging Nios® II Designs chapter. And "Run Time Stack Checking And Exception Debugging" section in the Getting Started with Graphical User Interface chapter of the Nios II Gen2 Software Developer's Handbook.

For more information about this and other BSP configuration settings, refer to “Settings Managed by the Software Build Tools” in the Nios® II Software Build Tools Reference chapter of the Nios® II Gen2 Software Developer's Handbook.