Diy_de2 port uClinux

Source: Internet
Author: User
I. Summary

Transplant uClinux on the diy_de2 Development Board.

 

Ii. Experimental Platform

1. Virtual Machine: VMWare

2. Linux: ubuntu10.04

3. Quartus II 6.0 + NiO II 6.0

 

3. Software preparation 1. Download nios2gcc-20080203

Http://www.niosftp.com/pub/gnutools/nios2gcc-20080203.tar.bz2

Or

Ftp://ftp.altera.com/outgoing/nios2gcc-20080203.tar.bz2

Or

Http://sopc.et.ntust.edu.tw/pub/gnutools/nios2gcc-20080203.tar.bz2

Or

Ftp://sopc.et.ntust.edu.tw/pub/gnutools/nios2gcc-20080203.tar.bz2

2. Download nios2-linux-20100621

Http://www.niosftp.com/pub/linux/nio...x-20100621.tar

Or

Http://sopc.et.ntust.edu.tw/pub/linu...x-20100621.tar

Or

Ftp://sopc.et.ntust.edu.tw/pub/linux...x-20100621.tar

Some people on the Internet say that the software may be damaged when downloading the above files in the window operating system. I downloaded the files in the window here, and there was no problem.

After downloading, place nios2gcc-20080203tar.bz2and nios2-linux-20100621.tar in the shared folder linuxshare, which is the shared folder created in the previous blog.

 

Iv. Configure the cross-compilation environment 1. Get root permissions

For later convenience, use the root permission to open the terminal and enter commands.

Sudo Su

Enter the logon password to obtain the root permission.

2. Place nios2gcc-20080203tar.bz2 in the/usr/local/src directory.

Copy nios2gcc-20080203.tar.bz2 from the shared folder to the/usr/local/src directory under ubuntu. and enter the following command on the terminal:

CP/mnt/HGFS/linuxshare/nios2gcc-20080203.tar.bz2/usr/local/src/nios2gcc-20080203.tar.bz2

3、decompress nios2gcc-20080203.tar.bz2

Go to the/usr/local/src directory

CD/usr/local/src

Decompress nios2gcc-20080203.tar.bz2

Tar jxvf nios2gcc-20080203.tar.bz2

In this way, an opt directory is generated under usr/local/src, which is the decompressed result.

4. Set the path for cross-GCC Compilation

For Ubuntu users, to enable the terminal, they need to reload the profile file, so we need to change this file. Open the profile file, or in the usr/local/src path

Gedit ~ /. Profile

Add the cross GCC path and add the following statement at the end.

Export Path = $ path:/usr/local/src/opt/nios2/bin

As shown in

After changing the profile file, you need to re-log out and login. Here, we can use the following command to make the profile file take effect.

Source ~ /. Profile

5. Check whether the cross GCC path is set correctly.

Input command:

Echo $ path

When the following path appears

The cross GCC path is set correctly.

6. Check whether cross GCC is successfully installed.

Input command:

Nios2-linux-uclibc-gcc-V

If the installation is successful, the following results will appear:

Now, cross GCC is successfully installed! In this step of installation, there will be basically no problems, if there are any small problems, we should be able to solve.

 

V. Configure and compile the Linux Kernel

Some problems have occurred in this step, and some time has been delayed. Because the computer in the lab is not connected to the Internet, errors always occur when installing some commands, later, the commands were successfully installed on your computer over the Internet. The instructions used will be detailed below.

1、place nios2-linux-20100621.tar in the/usr/local/src directory

In ubuntu, copy nios2-linux-20100621.tar from the shared folder to the/usr/local/src directory, and enter the following command on the terminal:

CP/mnt/HGFS/linuxshare/nios2-linux-20100621.tar/usr/local/src/nios2-linux-20100621.tar

2nd extract nios2-linux-20100621.tar

Or execute the following command to extract nios2-linux-20100621.tar in usr/local/src.

Tar-C/usr/local/src-xvf nios2-linux-20100621.tar

In this way, a directory named nios2-linux is generated under usr/local/src

3. Configure the kernel

Enter the kernel directory.

CD/nios2-linux/uClinux-Dist

Run the following command to configure the kernel.

Make menuconfig

Two consecutive errors occur during this step.

(1) first error

"Make: *** no rule to make target 'menuconfig'. Stop ."

Later, I found that the command was missing. I used checkout to check what command was missing.

Go to the directory/usr/local/src/nios2-linux

CD/usr/local/src/nios2-linux

Enter checkout

./Checkout

As shown in

This step shows that the GIT command is not installed. Continue to Google and get the solution. Install Git-core and enter the command on the terminal:

Apt-Get install Git-core

Ubuntu will download the required data packet from the source, and then automatically install it. There is a choice in the middle. Enter y.

Do you want to continue [Y/n]? Y <-- enter y here.

Then run the checkout check under the directory/usr/local/src/nios2-linux. The result is as follows:

This indicates that the installation is complete.

Then, enter the kernel directory based on the previous step.

CD uClinux-Dist

Run the following command to configure the kernel.

Make menuconfig

The second error is returned.

(2) key_max is not defined

Run the following command to solve the problem.

Apt-Get install libncurses5-dev

As shown in:

Then return to the kernel directory again.

CD uClinux-Dist

Run the following command to configure the kernel.

Make menuconfig

The Kernel configuration page is displayed, as shown in:

The first option is venddor/product selection settings, as shown in:

Follow the settings and press e to return to the previous interface. Set kernel/library/defaults selection, as shown in:

Select the first default all setting (press the y key on the keyboard), and then exit, exit, yes, and OK!

4. Set the hardware makefile Based on the PTF file generated by the system disk.

Copy the PTF file generated by the system disk to the current/usr/local/src directory.

CP/mnt/HGFS/linuxshare/System_0.ptf/Usr/local/src/System_0.ptf

Run the following command to set the hardware makefile:

Make vendor_hwselect sysptf =/use/local/src/system_0.ptf

Here again appeared a problem, that is to say, the nios2-linux-gun-gcc command can not find, at first glance, thought it is a cross environment is not installed well, but carefully, found that this and nios2-linux-uclibc-gcc is still different, why? Finally, find a solution to the problem on Google!

Http://www.alteraforum.com/forum/showthread.php? T = 23549

The above is a solution to the problem. If you do not understand it, please take a look! I will explain it a little here. There are two branch, one is trunk, one is test-nios2, while uClinux is installed under the test-nios2 branch, so it needs to be transferred to the test-nios2 branch directory, no way, execute the following command to go to The test-nios2 branch. The current directory is/Usr/local/src.

CD linux-2.6

Git checkout test-nios2

CD uClinux-Dist

Git checkout test-nios2

If successful, switching to test-nios2 branch appears, as shown in.

Run the command again to set the hardware makefile.

Make vendor_hwselect sysptf =/usr/local/src/system_0.ptf

There will be two options, one for CPU and the other for SDRAM, as shown in.

5. Compile the kernel

The kernel directory is/usr/local/src/nios2-linux/uClinux-Dist, Enter the command to compile the kernel.

Make

Here I have encountered two errors:

(1) "nasys_clock_freq" is not defined

Find the cause after Google

A full-featured timer is missing when you use the system-based system-specific system-based system.

(2) YACC: Command not found

Google find the cause and install

After solving these two problems, compile the kernel.

Input command:

Make

Wait for a while. So far, the kernel has been compiled successfully!

The zimage file is eventually generated under/usr/local/src/nios2-linux/uClinux-Dist/linux-2.6.x/ARCH/nios2/boot.

If compilation fails, run the following command:

Make clean

Clear the previous compilation results, and then re-compile.

 

6. Download 1. Step 1

Copy the zimage file toD: \ Altera \ kits \ nios2_60 \ examples. If VMware Tools is installed, you can use the copy and paste function in windows and ubuntu.

2. Step 2

Copy the configuration file. Sof toD: \ Altera \ kits \ nios2_60 \ examples.

3. Step 3

Start "start --> AllProgram--> Altera --> niosii eds6.0 --> niosii command shell"

4. Step 4

Download the. Sof file to FPGA and enter the following command:

Nios2-configure-sof de2_nios.sof

As shown in.

5. Step 5

Download the image file zimage to SDRAM and enter the following command:

Nios2-download-G zimage

As shown in.

6. Step 6

Start Linux and enter the following command:

Nios2-terminal

As shown in.

So far, the transplantation of uClinux on FPGA has been completed successfully.

 

 

PS:

Sometimes restart the system and run

Make vendor_hwselect sysptf =/usr/local/src/CPU. PTF

When the nios2-linux-uclibc-gcc can not find the error, this need to re-call the command:

Source ~ /. Profile

In addition, note that spaces in each command.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.