Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
3,784 Views

Question on Git Branches to use [nios2mmu vs unstable-nios2mmu]

Hi everyone 

 

I'm currenlty looking into using Linux on the NIOS for my company. Will be getting a DE4 from Terassic shortly but in the meantime I'm doing all the prepwork to understand as much as possible beforehand. I'm a complete newbie to this whole NIOS/Linux dev so please bear with me... 

 

I'll be using MMU support. I have been trying the build with MMU support using the following git branches: 

"unstable-nios2mmu" in linux-2.6 

"trunk" in uClinux-dist 

 

after setting Vendor=>Altera, Product=>nios2 and then defaulting config settings, building the project has always failed. I have followed the alterawiki instructions as I understand them. 

 

Today after reading the info carefully on this page [alterawiki.com/wiki/Downloading_Linux_Distribution ], specifically the last paragraph, I realised that perphaps the "nios2mmu" branch should be checked out instead of "unstable-nios2mmu" as the shell segment on that page suggests. I then managed to complete a succesful build by again just using default config settings. 

 

The last paragraph on the index nios/linux webpage [alterawiki.com/wiki/Linux_for_the_Nios_II_Processor] however suggests that the "unstable-nios2mmu" is the branch be used (to get a current build). I appreciate that the "unstable-nios2mmu" branch is at kernel rev 2.6.39 and "nios2mmu" branch at 2.6.35. 

 

So, my questions are: 

1: Should I be concerned about the "unstable-nios2mmu" branch not compiling 

2: Assuming I can get "unstable-nios2mmu" to compile, which branch is the correct/better one to use 

 

Cheers 

Tones
0 Kudos
36 Replies
Altera_Forum
Honored Contributor I
26 Views

nios2mmu uses the custom_fpga.h file to get your hardware configuration as described in http://alterawiki.com/wiki/creating_a_nios_ii_design_with_an_mmu 

 

unstable-nios2mmu moved to using DeviceTree: http://alterawiki.com/wiki/devicetree 

which is probably why you are having trouble compiling it.
Altera_Forum
Honored Contributor I
26 Views

Yep, that got me sorted on the "unstable-nios2mmu" branch. Thanks alot

Altera_Forum
Honored Contributor I
26 Views

Hello, 

 

Have you succed to compile a uClinux with MMU ? 

 

I try with the nios2mmu branch for linux and trunk for uClinux but I have comiplations errors... 

 

Thank you for your help. 

Best regards. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

Hi Pierre 

 

I am currently compiling both the nios2mmu and unstable-nios2mmu branches. I must admit though, I did not invest a whole lot of effort into the nios2mmu branch though, it did compile but I want to be working with the latest developments which you'll find in the unstable-mmu branch. 

 

Please tell us a bit more about the issues you're facing
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

I use the nios2mmu branch because it deals with the custom_fpga.h file instead of the device tree (I work with Windows XP and I don't know if the sopc2dts tool works with Windows). 

 

I created a board layer like said here in Altera Wiki (alterawiki.com/wiki/Creating_a_Nios_II_Design_with_an_MMU

 

I downloaded the toolchain nios2gcc-20080203.tar.bz2 

 

Here is my problem: 

 

After having exported the PATH (export PATH=$PATH:~/path_to_toolchain/opt/nios2/bin), when I want to compile the kernel, the simple instruction make dosen't work. Here is the trace: 

 

////////////////////////////////////////////////////////////////////////////////// 

pierre@ubuntu:~/nios_linux_2010/nios2-linux/uClinux-dist$ CROSS_COMPILE=/home/pierre/nios_compilo/opt/nios2/bin/nios2-linux- make 

make -f tools/autotools.mk autotools-cache 

make[1]: entrant dans le répertoire « /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist » 

set -e;  

mkdir -p /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build//$$;  

cd /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build//$$;  

gt=`../../create-target-cache.sh nios2-linux-gnu`;  

cp $gt /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/vendors/config/$gt;  

touch /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build/nios2-linux-gnu 

../../create-target-cache.sh: 30: nios2-linux-gnu-gcc: not found 

../../create-target-cache.sh: 31: nios2-linux-gnu-gcc: not found 

Using inc dir for nios2-linux-gnu (nios2-unknown-linux-gnu): 

 

 

../../create-target-cache.sh: 65: nios2-linux-gnu-gcc: not found 

xargs: nios2-linux-gnu-readelf: Aucun fichier ou dossier de ce type 

make[1]: quittant le répertoire « /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist » 

ln -sf staging-compiler tools/nios2-linux-gnu-gcc 

ln -sf staging-compiler tools/nios2-linux-gnu-g++ 

ln -sf staging-compiler tools/nios2-linux-gnu-cpp 

ln -sf staging-compiler tools/nios2-linux-gnu-ld 

ln -sf cross-pkg-config tools/nios2-linux-gnu-pkg-config 

chmod +x tools/romfs-inst.sh tools/modules-alias.sh tools/build-udev-perms.sh 

. linux-2.6.x/.config; if [ "$CONFIG_INITRAMFS_SOURCE" != "" ]; then  

mkdir -p `dirname $CONFIG_INITRAMFS_SOURCE`;  

touch $CONFIG_INITRAMFS_SOURCE || exit 1;  

fi 

rm -f linux-2.6.x/usr/initramfs_data.cpio 

make ARCH=nios2 CROSS_COMPILE=nios2-linux-gnu- O=/home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/linux-2.6.x -j1 -C ../linux-2.6 || exit 1 

make[1]: entrant dans le répertoire « /home/pierre/nios_linux_2010/nios2-linux/linux-2.6 » 

nios2-linux-gnu-gcc: command not found; perhaps you need to fix your PATH? 

Using /home/pierre/nios_linux_2010/nios2-linux/linux-2.6 as source for kernel 

GEN /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/linux-2.6.x/Makefile 

CHK include/linux/version.h 

CHK include/generated/utsrelease.h 

CC kernel/bounds.s 

nios2-linux-gnu-gcc: command not found; perhaps you need to fix your PATH? 

make[3]: *** [kernel/bounds.s] Erreur 127 

make[2]: *** [prepare0] Erreur 2 

make[1]: *** [sub-make] Erreur 2 

make[1]: quittant le répertoire « /home/pierre/nios_linux_2010/nios2-linux/linux-2.6 » 

make: *** [linux] Erreur 1 

pierre@ubuntu:~/nios_linux_2010/nios2-linux/uClinux-dist$ 

 

////////////////////////////////////////////////////////////////////////////////// 

 

I have to add CONFIGURE_HOST=nios2-linux because, without this, the prefix needed is nios2-linux-gnu witch dosen't exists for me. 

 

But then, I have this error : 

 

 

////////////////////////////////////////////////////////////////////////////////// 

pierre@ubuntu:~/nios_linux_2010/nios2-linux/uClinux-dist$ CROSS_COMPILE=/home/pierre/nios_compilo/opt/nios2/bin/nios2-linux- make CONFIGURE_HOST=/home/pierre/nios_compilo/opt/nios2/bin/nios2-linux- 

make -f tools/autotools.mk autotools-cache 

make[1]: entrant dans le répertoire « /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist » 

set -e;  

mkdir -p /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build//home/pierre/nios_compilo/opt/nios2/bin//$$;  

cd /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build//home/pierre/nios_compilo/opt/nios2/bin//$$;  

gt=`../../create-target-cache.sh /home/pierre/nios_compilo/opt/nios2/bin/nios2-linux-`;  

cp $gt /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/vendors/config/$gt;  

touch /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build//home/pierre/nios_compilo/opt/nios2/bin/nios2-linux- 

/bin/sh: ../../create-target-cache.sh: not found 

make[1]: *** [/home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/tools/autotools-cache/build//home/pierre/nios_compilo/opt/nios2/bin/nios2-linux-] Erreur 127 

make[1]: quittant le répertoire « /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist » 

make: *** [autotools-cache] Erreur 2 

pierre@ubuntu:~/nios_linux_2010/nios2-linux/uClinux-dist$ CROSS_COMPILE=/home/pierre/nios_compilo/opt/nios2/bin/nios2-linux- make CONFIGURE_HOST=nios2-linuxmake -f tools/autotools.mk autotools-cache 

make[1]: entrant dans le répertoire « /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist » 

make[1]: Rien à faire pour « autotools-cache ». 

make[1]: quittant le répertoire « /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist » 

chmod +x tools/romfs-inst.sh tools/modules-alias.sh tools/build-udev-perms.sh 

. linux-2.6.x/.config; if [ "$CONFIG_INITRAMFS_SOURCE" != "" ]; then  

mkdir -p `dirname $CONFIG_INITRAMFS_SOURCE`;  

touch $CONFIG_INITRAMFS_SOURCE || exit 1;  

fi 

rm -f linux-2.6.x/usr/initramfs_data.cpio 

make ARCH=nios2 CROSS_COMPILE=nios2-linux- O=/home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/linux-2.6.x -j1 -C ../linux-2.6 || exit 1 

make[1]: entrant dans le répertoire « /home/pierre/nios_linux_2010/nios2-linux/linux-2.6 » 

Using /home/pierre/nios_linux_2010/nios2-linux/linux-2.6 as source for kernel 

GEN /home/pierre/nios_linux_2010/nios2-linux/uClinux-dist/linux-2.6.x/Makefile 

CHK include/linux/version.h 

CHK include/generated/utsrelease.h 

CC kernel/bounds.s 

nios2-linux-gcc: /include: No such file or directory 

nios2-linux-gcc: /include: No such file or directory 

make[3]: *** [kernel/bounds.s] Erreur 1 

make[2]: *** [prepare0] Erreur 2 

make[1]: *** [sub-make] Erreur 2 

make[1]: quittant le répertoire « /home/pierre/nios_linux_2010/nios2-linux/linux-2.6 » 

make: *** [linux] Erreur 1 

////////////////////////////////////////////////////////////////////////////////// 

 

 

 

Thank you for your help. 

Best regards. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

Hi 

 

i didn't read all of your posting, but as I see you used the false toolchain. The Toolchain you used is for noMMU. For the MMU-Version there is already a binary toolchain included. The directory is "toolchain-mmu". 

You should add "nios2-linux/toolchain-mmu/x86-linux2/bin" to the PATH variable. 

 

 

Urmel
Altera_Forum
Honored Contributor I
26 Views

Thank you for your prompt response. 

 

I try to use the nios2-linux/toolchain-mmu/x86-linux2/bin path, but it the same. I have the same error. 

 

Thank you for your help. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

If the right toolchain is in your PATH, you should not need CROSS_COMPILE or CONFIGURE_HOST.

Altera_Forum
Honored Contributor I
26 Views

Make sure that only one of the toolchains is in the PATH variable. 

As ykozlov wrote there is no need to use CROSS_COMPILE or something like that. 

So just type 'make' in the "uClinux-dist" directory. 

 

Urmel
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

Thank you for your responses, it works with that. 

I have another question. 

I try to use the unstable_nios2mmu branch for linux2.6 and trunk for uClinuxdist in order to use the dts (device tree) support. I try to follow the Altera Wiki (alterawiki.com/wiki/Devicetree) but it's said : 

 

//////////////////////////////////////////////////////////////////////////////////// 

5) enable device tree support in your uClinux-dist kernel config. enter the full path to your dts file in (), which will be dtc compiled and the dtb is linked into the kernel. important: You may still need to edit the file linux-2.6/arch/nios2/boards/generic-dts/include/asm/nios.h, to match your memory and cpu info.  

//////////////////////////////////////////////////////////////////////////////////// 

 

In the unstable_nios2mmu branch I find any linux-2.6/arch/nios2/boards/generic-dts/include/asm/nios.h path... The only boards are 3c120 or neek... 

 

I can select device tree support in kernel config but there are any fields "()" to specify the path to my dts file. 

 

Have I the right branch? 

 

Thank you very much for your help. 

 

Best regards. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

Hi Pierre 

 

Like I said earlier I'm also very new to the Nios/Linux dev, but if you go to the linux-2.6 directory and type "git show" you will see a quick sumary of the current commit you're working from, the date at the top should be fairly new (mine is late April 2011).  

 

about the location of nios.h, i don't have the linux-2.6/arch/nios2/boards/generic-dts/include/asm/ in my branch, but did get the nios.h file in this location 

linux-2.6/arch/nios2/include/asm/nios.h so I have been modding that file instead. [If that's wrong, will the more experienced guys please let me know please ] 

 

For me to get to the dts file location, I do make menuconfig then customize kernel setings => exit and save. 

then from the kernel config screens I find it under Platform Options, then enable "Compile and link device tree into kernel image" and then the option to enter dts file location becomes available right underneath. 

 

Hope that helps.  

 

I'm currently struggling to program my kernel into ram, but I'm suspecting a SDRAM timing issue. Keep fighting the good fight dude, we'll get there eventually .... :) 

 

Cheers 

Antonie
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

Ok, but I don't know why I have any linux-2.6/arch/nios2/include/asm/nios.h path.... May be I have the wrong branch. 

After untar the Linux tarball, I did : 

 

/////////////////////////////////////////////////// 

cd linux-2.6 

git checkout unstable-nios2mmu 

cd ../uClinux-dist 

git checkout trunk 

cd .. 

./checkout # to obtain the toolchain-mmu but I stay in unstable-nios2mmu branch for linux-2.6 (checked with "git status") 

//////////////////////////////////////////////////// 

 

Thank you for your help 

Best regards. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

I believe that is correct though, as far as I know you must be in the unstable-nios2mmu branch. did you also fetch the latest version of the repository with "git fetch origin" from the linux-2.6 directory? 

 

when you do "git show" from linux-2.6, what date is listed at the top?
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

Thank you very much for your help!!!! I forgot "git fetch origin"... 

I optained my first Kernel image, but it dosen't make boot... 

 

I have one question : 

 

I don't understand the Altera Wiki... Have I to make my SDRAM at the address 0x10000000 or the on-chip memory at this address ? Because Linux is in SDRAM... I work know with mmu. 

 

Best regards. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

I found!! 

The address of the SDRAM is 0x10000000. I fact I used zImage.initramfs.gz instead of linux.initramfs.gz... 

 

With this, uClinux boots. 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

Congrats! You're now 1 step ahead of me, still having issues programming my kernel to ram and running my CPU up. I'm glad though cause this confirms that I'm on the right track at least. 

 

Cheers 

Antonie
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

Do you have problems with "nios2-download" ? Or is it a hardware problem? 

 

Pierre
Altera_Forum
Honored Contributor I
26 Views

Hi Pierre, did get it to download in the end, but it does not boot successfully, during the bootup process I get 

 

BUG: failure at /home/antonie.christie/nios2-linux/linux-2.6/arch/nios2/kernel/time.c:128/nios2_late_time_init()! 

Kernel panic - not syncing: BUG! 

 

I am running on custom hardware with a CPU based on the golden reference for the cycloneIII devkit. I've got a bit of debugging to do and I suspect my hardware or CPU design to be the main cause. 

 

Good luck with the rest of the development...
Altera_Forum
Honored Contributor I
26 Views

Hi, 

 

Do you have a timer in your design? 

You have to add a timer for Linux functioning -> full featured, counter size 32 with interrupt priority level of 0 (most important interrupt). 

 

Pierre