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++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

uClinux trouble with making kernel

Altera_Forum
Honored Contributor II
1,660 Views

I've tried to follow the five steps at nioswiki but get some errors when i'm trying to make my own uClinux kernel. I created a new sopc-builder file and copied it to the kernel directory the following way: 

 

$ sopc-create-header-files --single custom_fpga.hsopc-create-header-files: Using SOPC design file ./linux_sopc.sopcinfo found in . swinfo2header: Creating C-header file 'custom_fpga.h' for module 'cpu' ~/studier/IL2207_SoC_Architectures/lab1/sopc2 $ cp custom_fpga.h /home/erik/studier/uClinux/nios2-linux/linux-2.6/arch/nios2/include/asm/ cp: overwrite `/home/erik/studier/uClinux/nios2-linux/linux-2.6/arch/nios2/include/asm/custom_fpga.h'? y After that i do : 

make menuconfig 

In Vendor/Product selection i choose "Altera" and "nios2" 

In Kernel/Library/Defaults selections i choose "customize kernel settings" 

When the next screen appears i choose NiosII configuration-->NiosII FPGA configuration and then choose "custom FPGA" 

 

When i then run make i get the following error: 

/home/erik/studier/uClinux/nios2-linux/linux-2.6/arch/nios2/kernel/asm-offsets.c:122: error: 'DDR2_TOP_BASE' undeclared (first use in this function) /home/erik/studier/uClinux/nios2-linux/linux-2.6/arch/nios2/kernel/asm-offsets.c:122: error: (Each undeclared identifier is reported only once /home/erik/studier/uClinux/nios2-linux/linux-2.6/arch/nios2/kernel/asm-offsets.c:122: error: for each function it appears in.) /home/erik/studier/uClinux/nios2-linux/linux-2.6/arch/nios2/kernel/asm-offsets.c:123: error: 'DDR2_TOP_SPAN' undeclared (first use in this function) Anyone who knows why i get this error? Do i have to include a DDR2? I have included the sdram.. 

 

Info: 

I've succefully downloaded the the prebuilt "TryOutuClinux"-files to my DE2 board. 

The only time i have been able to compile a kernel was when i used default setting with mmu. 

I'm running the prebuild binary toolchain on ubuntu 9.10 

 

/Erik
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
603 Views

You don't have to do your first thing. Follow this : 

In SOPC Builder do "Generate" 

Then copy you find your ".ptf" file (it's in you project directory). 

in you "nios2-linux/uClinux-dist/" directory do the following : 

make vendor_hwselect SYSPTF="XXXXXXXXX" replace the XXXX with your path to your ptf. Example : 

make vendor_hwselect SYSPTF="/opt/altera/project/myproject.ptf" 

Answer the question. 

In the same directory 

make menuconfig 

select Kernel/Libray/Default Selection/  

Select Default all setting (lose changes) 

Exit -> Exit -> Save 

 

make 

 

That's all !
0 Kudos
Altera_Forum
Honored Contributor II
603 Views

Be aware that there are two flows. One for Nios II (with MMU) running Linux and one for MMU-less Nios II running uClinux. 

 

Whatever you do, be sure that you follow one or the other... 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
603 Views

actris:  

when i try the vendor_hwselect command i just get the following error: 

 

make[3]: *** No rule to make target `select'. Stop. 

 

But i think i saw somewhere that i, in the last version of the toolchain, don't have to use that command. I also couldn't see anything about it in the 5 steps on nioswiki. Is this correct? 

 

slacker: 

I have tried both with and without a MMU. The problem is that i'm unsure of what to choose after i have choosen nios2 or nios2nommu in menuconfig(and i have also used different sopc-files of course). I just used Enter for all the chioses( default i guess?...) 

and when i tried to customize the kernel myself i just changed to custom_fpga. 

 

Is there anyone that can provide me with the .sopc-files for Quartus/SOPC-builder v9.0 that you are sure working? An exact description of what to choose in menuconfig would also be appriciated. 

 

Thanks a lot!
0 Kudos
Altera_Forum
Honored Contributor II
603 Views

actris's instructions with vendor_hwselect and the PTF file apply for the non-MMU version. For the MMU version, it sounds like you are doing it right. 

 

The headers might expect DDR or DDR2 (DDR_SDRAM_BASE should be defined in custom_fpga.h). What kind of RAM are you using, and what macros do you get for the RAM in custom_fpga.h?
0 Kudos
Altera_Forum
Honored Contributor II
603 Views

I'm pretty sure you're going to want to go the no mmu route for now. If you don't know that you need it, that's your answer. 

 

 

--- Quote Start ---  

actris:  

...when i tried to customize the kernel myself i just changed to custom_fpga 

--- Quote End ---  

 

 

I'm not sure that this is necessary. As far as I understand, this is taken care of by the "make vendor_hwselect ..." command. (but I could be wrong) However, I do know that command is necessary, otherwise the tool has no idea what the hardware looks like and can't build the image appropriately. 

 

I am also using Ubuntu 9.10 and Quartus 9.1 and found that I could not use the pre-built toolchain. I didn't know why, but I just moved on and built it. I have done this before with previous versions of Ubuntu and Quartus (for a design for the Candian Altera design competition - 3rd place), but I, too have run into a problem with this new configuration (that it seems you have overcome). Once the image is built, I cannot load it onto the board using "nios2-download -g ..." which is a Quartus tool. I'm pretty sure this is not a problem with the build, but a problem with the load(er) [version incompatibility? I'm not sure yet] because it doesn't even work with the images provided by the wiki. 

 

Yes, the jtagconfig shows a jtag cable. Yes, I've selected the cable, etc. 

 

scilattji: since we're having problems on the same OS (what version of Quartus are you using?), I thought we could help each other out. Maybe you could provide your *.ptf file and I could see if I could get it to build on my system? Meanwhile, you could build the toolchain and see if that works. I also found a guy who has a vmware image of a fully functional/tested system, so I'm going to try that. What do you think? 

 

*EDIT* 

Actually, I was thinking that you may want to try to build the image for one of the examples on the wiki first. You know that those are 'working' ptf files, so this would be a good next step before you build the toolchain.
0 Kudos
Reply