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

Problem dloading vmlinux to 2C35

Altera_Forum
Honored Contributor II
2,935 Views

Hi, 

 

I was trying to download the vmlinux.flash image to the board and received this error 

 

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 

Resetting and pausing target processor: FAILED 

(I get this immediately so it's not the same problem as the one described as happening after 20 seconds for which Altera's put out a fix for) 

 

I used the standard.sof and std_2C25.ptf but I'm not sure whether that is the correct design to use for linux or whether we need to create our own sof? 

 

Also, I'm wondering why my vmlinux.flash size was so large at about 8.3 mb? Is it supposed to be that size since I saw this in the toolchain setup thread: 

 

Memory available: 63744k/65536k RAM, 0k/0k ROM (694k kernel code, 417k data) 

 

Lastly, since the flash memory size isn't too big, is it possible to use the RAM instead of the flash for the kernel? Would I need to compile the kernel with different options in that case? 

 

Thanks a lot in advance!
0 Kudos
15 Replies
Altera_Forum
Honored Contributor II
1,177 Views

You can definitely download the kernel to RAM - just in the properties for the system library, make sure all the code/data locations are set to RAM instead of some sort of Flash. Then, to run, you can either download the .elf file directly using nios2-download, or clicking 'run as Nios II hardware'.. (or something like that).

0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

the vmlinux.flash is S-record format, a kind of hex file. so it take up more space than the actual binary size. 

 

the vmlinux elf file contains debug symbols, so it may reach 10M. you can use "xxxx-strip" to remove the symbols, and it should be around 2M. 

 

You should try to download the elf to dram as a beginning.
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

I did a  

 

strip --target=srec vmlinux 

 

and the original 8314kb got skimmed down to 7685kb, which still seems quite big. Should I be using some other options? 

 

And where is the system library I should be looking for to set to RAM rather than FLASH? 

 

Sorry if the question seems a bit basic but if you don't mind giving step by step instructions for that? 

 

Thanks a lot!
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

Finally, I borrowed a CycloneII dev board, and worked out. 

 

You should have quartusII v5.1 sp1, and NiosII v5.1 sp1. 

 

There is no need to strip the vmlinux. 

First open the project and download the sof of your board with QuartusII programmer. eg, if you use CycloneII dev board, 

it is altera/kits/nios2/examples/verilog/niosII_cycloneII_2c35/standard/ standard.sof 

 

Next, open two "Nios II SDK shell" windows. 

From one, run "nios2-terminal". 

From two, run "nios2-download -g vmlinux"
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

I just tried that but I'm still getting the same error though 

 

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 

Resetting and pausing target processor: not responding 

Resetting and trying again: FAILED 

Leaving target processor paused 

 

I'm trying this with the standard.sof from the CD but I'm using the DE2 Cyclone II 2C35 board which doesn't have ddr_sdram. I assume if I create my own design (ie .sof and .ptf) and use that .ptf I should be able to get the sdram option during hwselect when compiling the kernel? 

 

Currently, I don't have an option for sdram with the std_2C35.ptf and it instead only gives the options for ddr_sdram, ext_ssram and epcs_controller for selecting a device ot execute the kernel from.
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

The DE2 is different from CycloneII dev board. 

 

You can find in the kit dir, 

DE2_System/DE2_demonstrations/DE2_NET 

use file nios_0.ptf for kernel hwselect 

use file DE2_NET.sof for the board.
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

Hi hippo, 

 

I've got the DE2_NET.sof on the board. After that, 

 

I tried using nios2-download: 

 

nios2-download -g vmlinux 

 

and it shows 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Using cable "USB-Blaster [USB-o]", device 1, instance 0x00 

Pausing target processor: OK 

Downloaded 2563KB in 32.2s 

Verified OK 

Starting processor at address 0x0000000[/b] 

--- Quote End ---  

 

 

I assume it downloaded onto the board fine but the nios2-terminal I started doesn&#39;t show anything beyond this 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

connected to hardware target using JTAG UART on cable 

"USB-Blaster [USB-0]", device 1, instance 0 

<Used hte IDE stop button or Ctrl-C to terminate>[/b] 

--- Quote End ---  

 

 

How do I actually get to type in the uClinux commandline? 

 

I also tried 

 

nios2-elf-objcopy -O binary vmlinux vmlinux.bin bin2flash --location=0x0 --input=vmlinux.bin --output=vmlinux.flash nios2-flash-programmer --base=0x800000 vmlinux.flash 

 

(I&#39;ve verified in the nios_system.h file that the cfi flash does indeed start at that address) 

 

And it shows: 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 

Resetting and pausing target processor: OK 

Checksummed/read 1024kB in 22.9s 

Erased 576kB in 20.1s 

Program failed 

Leaving target processor paused[/b] 

--- Quote End ---  

 

 

I&#39;m assuming this is happening because the vmlinux.bin is quite large ~2.5MB (cfi flash is only 1 MB) and I&#39;m not sure how to reduce that size by much (strip vmlinux only gets the vmlinux&#39;s original 8 MB down to about 7MB) 

 

Would appreciate very much any direction you could give on this! 

 

Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

The previous steps to generate flash file was wrong. I will tell you about that later. Let first run it in ram. 

 

Built the kernel with jtag uart. with minimal config first. and minimal rootfs. 

cp ~/download/kernel.config .config 

make ..... hwselect SYSPTF=....../nios_0.ptf 

make ..... menuconfig 

change Device drivers--> Char devices -> serial drivers --> 

unselect Nios serial support, 

select Altera JTAG UART support and support for console on Altera JTAG UART 

exit and save 

make ..... 

 

There is no need to do strip. 

 

(if nios2-terminal is open, close nios2-terminal with control-C.) 

Use Quartus to download the DE2_NET.sof to the board. 

Open a nios2 sdk shell, (there is no need to open two sdk shell, one is OK). 

run "nios2-download -g vmlinux" 

(the nios2 does not run yet, it will wait for jtag uart on nios2-terminal) 

then run "nios2-terminal"
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

Hi hippo, 

 

Thanks, I got this after opening up nios2-terminal- 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Linux version 2.6.11-uc0 (Ricky@localhost.localdomain) (gcc version 3.4.5)# 6 Sa 

t Mar 4 20:28:04 EST 2006 

 

 

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

Built 1 zonelists 

Kernel command line: 

PID hash table entries: 64 (order: 6, 1024 bytes) 

Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) 

Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) 

Memory available: 5456k/8192k RAM, 0k/0k ROM (704k kernel code, 1912k data) 

Mount-cache hash table entries: 512 (order: 0, 4096 bytes)[/b] 

--- Quote End ---  

 

 

seems like linux is now on the board but it seems to go into some kind of weird loop where it keeps outputting the following: 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

Free pages:        0kB (0kB HighMem) 

Active:1023 inactive:148 dirty:0 writeback:0 unstable:0 free:0 slab:191 mapped:0 

pagetables:0 

DMA free:0kB min:0kB low:0kB high:0kB active:4092kB inactive:592kB present:8192k 

B pages_scanned:2552 all_unreclaimable? no 

lowmem_reserve[]: 0 0 0 

Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pag 

es_scanned:0 all_unreclaimable? no 

lowmem_reserve[]: 0 0 0 

HighMem free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pa 

ges_scanned:0 all_unreclaimable? no 

lowmem_reserve[]: 0 0 0 

DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 

0*4096kB = 0kB 

Normal: empty 

HighMem: empty 

oom-killer: gfp_mask=0xd2 

DMA per-cpu: 

cpu 0 hot: low 2, high 6, batch 1 

cpu 0 cold: low 0, high 2, batch 1 

Normal per-cpu: empty 

HighMem per-cpu: empty[/b] 

--- Quote End ---  

 

 

thanks in advance!
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

There may be problem in initramfs image. rebuild it. 

rm -rf ~/rootfs cp -a ~/buildroot/build_nios2/root ~/rootfs cd ~/rootfs# remove include and lib to save space# the dev nodes are generated via ~/download/rootfs_list rm -rf dev usr/include usr/lib# you may use this instead of the one from buildroot cp ~/download/inittab etc# clean headers for uClinux-dist cd ~/buildroot/build_nios2/staging_dir/include/linux rm config.h autoconf.h touch config.h autoconf.h cd ~/linux-2.6.x# rebuild image for initramfs make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc-
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

The 8 MB sdram of DEII is very tight for uclinux. 

 

remove unused applets in busybox, keep only init, msh, and some coreutils. 

remove unused files in ~/rootfs/etc, keep only inittab 

remove unused dev nodes in ~/download/rootfs_list, keep only console,zero,null. 

 

cd ~/buildroot/build_nios2/busybox make menuconfig make cd ~/buildroot make rm -rf ~/rootfs cp -a ~/buildroot/build_nios2/root ~/rootfs cd ~/rootfs# remove include and lib to save space# the dev nodes are generated via ~/download/rootfs_list rm -rf dev usr/include usr/lib etc/*# you may use this instead of the one from buildroot cp ~/download/inittab etc# clean headers for uClinux-dist cd ~/buildroot/build_nios2/staging_dir/include/linux rm config.h autoconf.h touch config.h autoconf.h cd ~/linux-2.6.x# rebuild image for initramfs make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc-
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

Thanks, hippo! Looks like its working now http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/laugh.gif  

 

uClinux/Nios II Altera Nios II support (C) 2004 Microtronix Datacom Ltd. Built 1 zonelists Kernel command line: PID hash table entries: 64 (order: 6, 1024 bytes) Dentry cache hash table entries: 2048 (order: 1, 8192 bytes) Inode-cache hash table entries: 1024 (order: 0, 4096 bytes) Memory available: 6984k/8192k RAM, 0k/0k ROM (704k kernel code, 385k data) Mount-cache hash table entries: 512 (order: 0, 4096 bytes) Linux NoNET1.0 for Linux 2.6 Serial: JTAG UART driver $Revision: 1.4 $ ttyJ0 at MMIO 0x81004000 (irq = 1) is a jtag_uart io scheduler noop registered io scheduler deadline registered Freeing unused kernel memory: 304k freed (0xba000 - 0x105000) init started:  BusyBox v1.1.1-pre0 (2006.03.06-00:20+0000) multi-call binary BusyBox v1.1.1-pre0 (2006.03.06-00:20+0000) Built-in shell (msh) Enter &#39;help&#39; for a list of built-in commands. #  

 

By the way, if I had to install the bluez module into the linux kernel as well as the driver for the IP core for USB, would that likely cause any problems with running out of RAM? 

 

Also, in the toolchain, the compiler used to compile was  

 

nios2-linux-uclibc-gcc hello.c -o hello -elf2flt 

 

If I already have a compiled object file (compiled with g++), is there any way of converting the object file with something like elf2flt?
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

The kernel is working now. 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

By the way, if I had to install the bluez module into the linux kernel as well as the driver for the IP core for USB, would that likely cause any problems with running out of RAM?[/b] 

--- Quote End ---  

 

Add them one by one. It is still possible to run out of ram. Check in only what is required. Or if you could, change the sdram chip to a 16Mx16 device, check your PCB if extra MA lines are required. 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

If I already have a compiled object file (compiled with g++), is there any way of converting the object file with something like elf2flt?[/b] 

--- Quote End ---  

 

You can add the elf2flt flags. Note the libstdc++ might still have problems, it compiled and linked with elf2flt, but it crashed when running. I am not a c++ user, and I don&#39;t know how to resolve (and I am quite busy now).
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

when i nios2-download -g vmlinux! 

 

it appears: 

 

SOPC Builder]$ nios2-download -g vmlinux 

ios2-elf-objcopy: &#39;./vmlinux&#39;: No such file 

/vmlinux.srec: Unable to open input file 

m: cannot remove `./vmlinux.srec&#39;: No such file or directory 

/altera/kits/nios2_51/examples 

 

 

why ? 

 

where my &#39;vmlinux.bin&#39; file shoulde lay?
0 Kudos
Altera_Forum
Honored Contributor II
1,177 Views

 

--- Quote Start ---  

originally posted by iriver@Apr 13 2006, 08:26 PM 

when i nios2-download -g vmlinux! 

 

it appears: 

 

sopc builder]$ nios2-download -g vmlinux 

ios2-elf-objcopy: &#39;./vmlinux&#39;: no such file 

/vmlinux.srec: unable to open input file 

m: cannot remove `./vmlinux.srec&#39;: no such file or directory 

/altera/kits/nios2_51/examples 

 

 

why ? 

 

where  my &#39;vmlinux.bin&#39; file shoulde lay? 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14330) 

--- quote end ---  

 

--- Quote End ---  

 

the vmlinux is in your kernel build dir . 

and if you make zImage , arch/nios2nommu/boot/zImage . 

 

Note the drives mapping in nios2 sdk shell,  

drive c: is /cygdrive/c/ 

drive d: is /cygdrive/d/ 

 

if you map your linux home to h: on windows with samba server, 

then it is /cygdrive/h/linux-2.6.x/vmlinux  

or /cygdrive/h/linux-2.6.x/vmlinux/arch/nios2nommu/boot/zImage
0 Kudos
Reply