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

Cross compiling

Altera_Forum
Honored Contributor II
1,157 Views

Hi folks 

 

Have any of you tried cross compiling for the uCLinux on a NIOS2 trough cygwin ??? 

I am trying to crosscompile the Osip framework which has lots and lots of makefiles that are created from a ./configure. 

I need to setup the enviroment so that I can compile code for the NIOS2 from the cygwin shell and not in the NIOS2 IDE. 

 

Hope some of you can help me out with this. 

 

Regards 

Michael E
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
493 Views

Hi Michael, 

 

> I am trying to crosscompile the Osip framework 

 

Me too ... shoot me an email ... we can share notes :-) 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
493 Views

Hi Michael, 

 

> Me too ... shoot me an email ... we can share notes :-) 

 

No need ... builds fine. Here's how: 

 

1. edit scripts/config.sub 

 

Add an entry for nios2 for the basic_machine variable. All you need is "nios2" in there ;-) 

 

2. setup cppflags & ldflags for the configure script 

 

$ export CPPFLAGS=-I$UCLIBC_PLUGIN/include 

$ export LDFLAGS=-L$UCLIBC_PLUGIN/lib 

 

3. create your build directory (optional) 

 

Create a separate build directory ... this will make things easy if you fat finger your configuration 

options (or decide to change things later) since you can just blow away the entire directory without 

touching the actual sources. 

 

$ mkdir build 

 

4. configure the build 

 

This assumes you have a directory structure that looks like this: 

 

<TOP> 

..| 

..+-- libosip2-2.2.0 

..+-- build 

 

$ cd build 

$ ../libosip2-2.2.0/configure --host=nios2-elf 

 

This will setup all the makefiles, etc. you need to build the libraries. After the configuration is 

complete, the exported CPPFLAGS and LDFLAGS are no longer needed. 

 

5. build the libraries 

 

In the build directory: 

 

$ make 

 

That&#39;s all. You may want to make install, but if not the libraries can be found here: 

 

build/src/osip2/.libs/libosip2.a 

build/src/osipparser2/.libs/libosipparser2.a 

 

And you&#39;ll need the osip2 and osipparser2 header directories from the libosip include tree. 

 

Regards, 

--Scott
0 Kudos
Reply