Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12589 Discussions

Building NIOS2 Applications using command line

Altera_Forum
Honored Contributor II
949 Views

Hi everybody, 

 

we decided to use a NIOS2 core in our project and I'm facing the challenge, to build applications without the NIOS2-IDE. Since we do automated nightly builds and regression tests I need to control this process by command line, i.e. by a script. 

I know, that this issue has already been raised in this forum and some of you say that this is not possible. Our Altera-FAE promissed me to provide some information but it seems to be some kind of difficult. Anyway, since the IDE is only a graphical IF, there must be a way to do this. Compiling a simple hello-world with nios2-elf-gcc works but downloading it fails or does not start. Of course, since a whole stuff is missing. In a second step I took the system library created by the IDE and tried to link my hello-world against it. It linked successfully, but it did not run neither. 

In both cases I failed with an error while downloading (Verify failed ...) 

I changed the board setup of my stratix2 eval board from full-featured to fast and was at least able to successfully download the elf-File. But the application did not start (though I used the -g and -r options ) or did not what I desired. 

Now I do not have any idea. Does anyone of you have ? 

I would be grateful for any hint ! 

 

 

Regards 

 

Umberto
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
250 Views

It depends on the scope of what you're trying to test. Are you verifying just the logic in the software, or the hardware as well?  

 

For just the software I suppose you could use a similar GNU compiler/linker suite that produces a x86 target in a regression test harness. For such a test it would be worth implementing a Hardware Abstraction Layer to allow stubs to replace the real I/O. 

 

If you're using ATE to test the hardware, and need to run the image there is probably a "very hacky" way of automating the running of the NIOS environment. You could use Spy++ to determine the window classes and WM_COMMAND messages fired for specific menu commands. Then use FindWindow and SendMessage to determine the window handle and fire the menu commands in your test harness app'. Be careful with using Spy++, it can hang your machine. 

 

I've just experimented with this -> the window class is SWT_Window0 (child windows also have this, but no menu handle), and the "Run" command ID is 274.
0 Kudos
Altera_Forum
Honored Contributor II
250 Views

Hi Jason, 

 

thanks for your answer. 

We need to do both, tests on a development host and tests on the target. 

The appropriate executable is built according to a compiler switch. 

Anyway, your solution is much too complicated and it will cost a lot since you have to purchase new tools (Spy++) which do not run for example on Solaris or Linux. 

The Nios2 IDE is only a GUI which controls the NIOS2 command line based GNU-Tools. 

So, there must be a way to do it like I described it in my posting. 

 

Nevertheless thank you for your contribution 

 

 

Regards 

 

umberto http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Reply