Forum Discussion
Problem dloading vmlinux to 2C35
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!15 Replies
- Altera_Forum
Honored Contributor
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).
- Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
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! - Altera_Forum
Honored Contributor
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" - Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
Hi hippo,
I've got the DE2_NET.sof on the board. After that, I tried using nios2-download:
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'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 triednios2-download -g vmlinux
(I'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'm assuming this is happening because the vmlinux.bin is quite large ~2.5MB (cfi flash is only 1 MB) and I'm not sure how to reduce that size by much (strip vmlinux only gets the vmlinux's original 8 MB down to about 7MB) Would appreciate very much any direction you could give on this! Thanks!nios2-elf-objcopy -O binary vmlinux vmlinux.bin bin2flash --location=0x0 --input=vmlinux.bin --output=vmlinux.flash nios2-flash-programmer --base=0x800000 vmlinux.flash - Altera_Forum
Honored Contributor
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" - Altera_Forum
Honored Contributor
Hi hippo,
Thanks, I got this after opening up nios2-terminal- <div class='quotetop'>QUOTE </div> --- Quote Start --- Linux version 2.6.11-uc0 ([email protected]) (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! - Altera_Forum
Honored Contributor
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-