NIOS II IDE unsuably slow

1.1k Views Asked by At

I've installed Quartus and NIOS II IDE on my Linux machine. Originally I tried importing an existing NIOS II Project into Eclipse, but it just sits there spinning away and eventually tells me it can't import the project because it already exists.

I tried installing everything on a Win10 machine and the project imported OK. I did notice that some of the paths in the orignal project have backslashes. So, for example:

#include "..\subfolder\include_file.h" 

Kind of thing. I wonder whether maybe it was that was causing issues.

So, I then tried creating an hello world NIOS Processor in Quartus and making a NIOS II project from scratch. Every step along the way with Eclipse was grindingly slow, but eventually worked up until the point I was able to hit Finish at which point it's just hanging with the little circle with red and blue arrows spinning round and round.

I also have a pop up window with a long list of:

Remote System Explorer Opertion

lines, and at the top it says:

The user operation is waiting for background work to complete

It seems like everything is installed correctly, I can open the NIOS II Eclipse IDE from Quartus for example. Quartus itself works nicely.

I used these instructions to installed Eclipse:

Is anyone able to give me any pointers as to why this is so incredibly slow please? My Linux machine is pretty high spec and flies. Nothing else whatsoever even vaguely struggles on it.

If there's anything I can try to give diagnostic info, am more than happy to supply. Thanks!

2

There are 2 best solutions below

2
On

Try using Visual Studio Code instead. It can do (almost) everything that Eclipse can do, with the added benefit that you can debug remote. E.g. in my setup, I develop exclusively using macOS. I have Quartus installed in a Ubuntu 20.04 VM and VSCODE allows me to develop and debug as if I'm running Quartus natively in macOS.

I'll provide a rough 'how-to' below.

I strongly suggest using a Ubuntu environment for Quartus (other linux environments should work too: I've tested Arch and Manjaro). The Windows install is a royal pain to get working, regardless of IDE choice. I haven't tried the Windows version since 20.1 but nothing worked out of the box and it took many hours or messing with config files to fix it. Also, the Windows version isn't native anyway - it's actually running in Ubuntu via WSL.

  1. Make sure you have installed your required version of Quartus - this should work for Pro, Standard and Lite editions. You can skip the manual installation of NiosII Build Tools for Eclipse if you'd like but I would actually recommend installing it. It can still be useful, if only for creating a new project, BSP etc.
  2. Install VSCODE along with the C/C++ Extension provided by Microsoft (and the Visual Studio Code Remote - SSH extension if you intend to use that feature)
  3. Create a new project using Eclipse (or skip, if you already have a project)
  4. Open VSCODE, select open and navigate to the software directory of your project.
  5. VSCODE will open your project and you should see your application directory and BSP directory.
  6. From here, you can work on your code with full linting, auto completion etc.
  7. If you need to regenerate your BSP, you can either do that using Eclipse or just run the command-line tool instead.

Compiling

If you allowed Eclipse to create your project for you, it will have produced a makefile in your application directory. Compiling is as simple as running 'make' from the application directory. I like to keep a terminal window open within VSCODE so I can run various tools as I work so this is usually how I can compile code. If, instead, you'd like to integrate this into VSCODE, you can define a task (https://code.visualstudio.com/docs/editor/tasks).

Eclipse automatically adds new sources that you create to the makefile. VSCODE won't do this - however, I personally don't think this is a bad thing. I don't like IDEs messing with my makefiles, I want fully control over them myself. So when you create a new source file, just remember to add it to the makefile. There is probably a way to get VSCODE to add sources files automatically (you can run commands on save etc) - but I have no motivation to try to figure this out.

Debugging

It is also possible to debug Nios2 software live on the target via the USB-Blaster using VSCODE. To do this, open the launch.json file in the .vscode folder of your project. If this file does not exist, just create it. The path should be:

<project root dir>/.vscode/launch.json

Copy the following into the launch.json file:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "app",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/app/app.elf",
      "stopAtEntry": true,
      "cwd": "${workspaceFolder}",
      "MIMode": "gdb",
      "miDebuggerServerAddress": "localhost:2334",
      "miDebuggerPath": "/PATH/TO/intelFPGA/20.1/nios2eds/bin/gnu/H-x86_64-pc-linux-gnu/bin/nios2-elf-gdb",
      "debugServerPath": "/PATH/TO/intelFPGA/20.1/quartus/bin/nios2-gdb-server",
      "debugServerArgs": "--tcpport 2334 --reset-target --tcppersist",
    }
  ]
}

This file is a list of debug targets and settings. You can add any number of configurations here, but easiest to just start with one for now. The configuration above is called 'app', you can change this to suit your own project if you wish.

  • Update the "program" entry with the path to your applications elf file
  • Update the "miDebuggerPath" path with the path the nios2-elf-gdb on your system. This is the gdb client for Nios2
  • Update the "debugServerPath" path with the path the nios2-gdb-server. This is the gdb server for Nios2
  • Save the file and now click on the "run and debug" button on the left side control panel in VSCODE

You'll see play button at the top of the screen next to the configuration you just defined in launch.json. Hit the play button - this will start an instance of the gdb server, followed by the gdb client and connect the two. If all goes well, your target will run and stop in main.

VSCODE will provide you with a set of debug tools for stepping, watching variables, call stack - all that good stuff. On the right hand side, you can view the debug console which will allow you to enter commands directly into the gdb console. Note, you have to prepend your commands with -exec. E.g. to print the value of a variable x, you would type:

-exec print x

Caveat

There is a problem with this debugging method: nios2-gdb-server doesn't always exit cleanly and as a result the port doesn't close. If you try to start another debug session, the server won't start because the port is in use. Eclipse solves this problem by randomizing the port everytime it launches the gdb. I have not found a way to do that VSCODE yet.

I find easiest way around this is to run the gdb server manually when I need it. Comment out the two 'debugServer' lines above. Open a second terminal in VSCODE and run:

nios2-gdb-server --tcpport 2334 --reset-target --tcppersist

This will keep the server running even when you stop debugging. If you start another debug session, it will reconnect to the same server instance.

Update: rioV8 provided a helpful solution to this problem which involves using a vscode extension to generate a random environment variable which can used be used in place of the port numbers. The solution is here.

3
On

I found a solution here

https://askubuntu.com/questions/761604/eclipse-not-working-in-16-04

To test if this fix works, try opening a terminal, and doing

$export SWT_GTK3=0

then run eclipse-nios2. That is, do something like

$ ~/intelFPGA_lite/20.1/nios2eds/bin/eclipse-nios2

If that fixes the problem then to make the fix permanent edit eclipse.ini which for me is in intelFPGA_lite/20.1/nios2eds/bin/eclipse_nios2

In that file, between the lines openFile and --launcher.appendVmargs

insert

--launcher.GTK_version
2

So it reads:

openFile
--launcher.GTK_version
2
--launcher.appendVmargs

and save.

Worked for me!