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

Need hint to compile GNU Scientific Library for Nios II IDE

Altera_Forum
Honored Contributor II
1,496 Views

Dear Forum, 

I've built a system with two Nios II cpus. One Nios II runs uClinux and the second Nios II does real-time stuff running a stand-alone C program written under the Nios II IDE. I need to do some cubic spline fitting on measurements in the real-time Nios II before sending the smoothed measurements to the Nios II running uClinux. I've successfully cross-compiled the GNU Scientific Library (GSL) for the Nios II running uClinux, and I can write application executables using (say) the interpolation functions in the GSL library that run on the Nios II under uClinux. However, I would really like to be able to run code from the GSL library in the Nios II that runs stand-alone C code developed in the Nios II IDE, but I don't understand enough about the Nios II IDE to figure out how to make this happen. Could someone give me a hint about what to do or what to read in order to be able to compile GSL code in a stand-alone C program written under the Nios II IDE?  

 

Here is how I cross compile GSL code for the Nios II under uClinux. On my Linux PC, the GSL include files and the library are in /usr/local/include and /usr/local/lib. To compile an application executable (say) spline_test.c I go, 

$ nios2-linux-uclibc-gcc -I/usr/local/include spline_test.c -o spline_test -L/usr/local/lib -lm -lgsl -lgslcblas -elf2flt 

 

I should mention that, for historical reasons, I develop the uClinux code on a Linux box but run Quartus and the Nios II IDE on a Windoxs box.  

 

Yours sincerely 

Stephen
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
295 Views

I would be tempted to throw away the IDE. 

If you just run gcc and ld (with your own linker script) you'll find it much easier to control what ends up at which addresses. 

It is trivial to parse the elf program headers so you should be able to load the code for your 2nd nios cpu from the uclinux system. 

There are instructions for building gcc on the wiki - the latest source an the Altera website is 9.0 b141 - which is slightly later than the version the IDE has.
0 Kudos
Altera_Forum
Honored Contributor II
295 Views

Hi,  

Please can you help me to compile any program with gls library, or if you have any tutorial to do, it will be appreciated.  

Than you. 

 

--- Quote Start ---  

Dear Forum, 

I've built a system with two Nios II cpus. One Nios II runs uClinux and the second Nios II does real-time stuff running a stand-alone C program written under the Nios II IDE. I need to do some cubic spline fitting on measurements in the real-time Nios II before sending the smoothed measurements to the Nios II running uClinux. I've successfully cross-compiled the GNU Scientific Library (GSL) for the Nios II running uClinux, and I can write application executables using (say) the interpolation functions in the GSL library that run on the Nios II under uClinux. However, I would really like to be able to run code from the GSL library in the Nios II that runs stand-alone C code developed in the Nios II IDE, but I don't understand enough about the Nios II IDE to figure out how to make this happen. Could someone give me a hint about what to do or what to read in order to be able to compile GSL code in a stand-alone C program written under the Nios II IDE?  

 

Here is how I cross compile GSL code for the Nios II under uClinux. On my Linux PC, the GSL include files and the library are in /usr/local/include and /usr/local/lib. To compile an application executable (say) spline_test.c I go, 

$ nios2-linux-uclibc-gcc -I/usr/local/include spline_test.c -o spline_test -L/usr/local/lib -lm -lgsl -lgslcblas -elf2flt 

 

I should mention that, for historical reasons, I develop the uClinux code on a Linux box but run Quartus and the Nios II IDE on a Windoxs box.  

 

Yours sincerely 

Stephen 

--- Quote End ---  

0 Kudos
Reply