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++

Advanced Compilation

Altera_Forum
Honored Contributor II
1,107 Views

Hi all, 

 

I am building a system which compiles for both a x86 running Windows, and a NIOS-II "running" uC. The project consists of 3 parts, a core part, a Win32 part and a uC part.  

 

The core is totally platform independant while the Win32 part implements a couple of synchronization objects and a dialog application which creates an instance of the core, and perform some actions on it. The uC part does the same thing, except uC is used. 

 

To build a win32 version, I compile the core, and export the header files along with the object files to a directory. Then I build the windows specific classes / dialogs etc, and link it with the objects from the core. I then have a win32 executable. 

 

This works quite well. 

 

However using Eclipse hides a all the compilation stuff from me, all I get is an autogenerated makefile, and a MAKE -s ALL..  

 

I want to be able to build the core, using the nios2-elf-gcc compiler in the same way that I build the Win32 project, but even the simplest of projects, seem to be a hassle to compile. 

 

Does anyone understand what I am talking about http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif , and if you do, please help me find a link that documents the build process more accurately than MAKE -s ALL.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
397 Views

morten_tor, 

 

All Eclipse is doing for you is generating two makefiles, one for the application and one for the system library, these can be found in the release or debug directory and are called makefile. Eclipse then simply calls make -s ALL as you&#39;ve identified. I would suggest looking at Chapter 5 of the Nios II Software Developers Handbook which covers some of this material. 

 

The online help also covers this in detail from with the IDE go help->help contents. From the dialogue that pops up click on Nios II IDE Help under the reference tab is a topic Nios II IDE Managed Make Build Environment, this should help.
0 Kudos
Altera_Forum
Honored Contributor II
397 Views

Thank you for the pointers. I read the text, but it was not really applicable. I don&#39;t know why I didn&#39;t think of it before, but I opened the prompt and built the project using "make all", omitting the -s switch, I piped the output to a file, and rebuilt my own makefiles. 

 

Next issue on the table is the NIOS-II IDE. It appears that it is impossible (ok .. ok .. very difficult ) to create a project and compile files which are OUTSIDE the project directory. I could use Visual Studio as an editor, but I really like the integrated debugging facilities in the NIOS-II IDE.  

 

 

Any ideas?
0 Kudos
Altera_Forum
Honored Contributor II
397 Views

morten_tor, 

 

 

You wrote  

 

" Thank you for the pointers. I read the text, but it was not really applicable. I don&#39;t know why I didn&#39;t think of it before, but I opened the prompt and built the project using "make all", omitting the -s switch, I piped the output to a file, and rebuilt my own makefiles." 

 

Did you read the online help? As this should explain the entire build flow if something is missing please say what. As for doing make from the command line, there is also an option in the IDE to show all the make output Window->Preferences Select Nios II and tick the tick box  

 

Show command lines when running make (i.e. Don&#39;t use -d &#39;flag&#39; on make) 

 

Please note though this slows down the build. 

 

As for your other question 

 

"Next issue on the table is the NIOS-II IDE. It appears that it is impossible (ok .. ok .. very difficult ) to create a project and compile files which are OUTSIDE the project directory. I could use Visual Studio as an editor, but I really like the integrated debugging facilities in the NIOS-II IDE." 

 

Sorry if you want the integrated debugging facilities, this is a restriction you have to live with for now.
0 Kudos
Altera_Forum
Honored Contributor II
397 Views

Thinking back, I recall that I used the Show Command Lines.. option before. But thanks anyway! 

 

So, there&#39;s no way that I can make a NIOS-II project link with external .o files? 

 

The NIOS-II IDE is a good tool, no doubt about that. What I am trying to do is probably not very common, so tweaking the IDE to suit  

my purpose is probably not the way to go.
0 Kudos
Altera_Forum
Honored Contributor II
397 Views

hmm.. I made some stupid comments about the IDE.. I figured it out though 

 

my core is compiled into a lib, ( it HAS to be called libXXXXXX.a ). 

 

My uC/NIOS-2 port then links to that lib, by adding XXXXXX as a lib ( the lib and .a part is stripped ). I guess most people in here knew that .. I didn&#39;t.. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif
0 Kudos
Reply