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

about cfi-flash for DE2 board....

Altera_Forum
Honored Contributor II
2,644 Views

hi hippo 

 

my cif-flash addr is 0x0800000. 

Dose i need to change my cfi-flash addr mapping MTD partition of altera.c ? 

 

Thx !
0 Kudos
32 Replies
Altera_Forum
Honored Contributor II
612 Views

 

--- Quote Start ---  

originally posted by jay_1025@May 29 2006, 06:22 PM 

hi hippo 

 

my cif-flash addr is 0x0800000. 

dose i need to change my cfi-flash addr mapping mtd partition of altera.c ? 

 

thx ! 

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

--- quote end ---  

 

--- Quote End ---  

 

Yes, you must change the map start and size to that of your cfi flash.
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
612 Views

No, you should not change cfi in sopc builder. 

You should only change mtd/maps/altera.c . 

 

(if you change in sopc builder, you need to regenerate hardware and compile a new sof, 

then in the kernel dir, make ... clean, make ... hwselect ...new ptf ......  

You have to rebuild almost everything. )
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

 

--- Quote Start ---  

originally posted by hippo@May 29 2006, 08:25 AM 

no, you should not change cfi in sopc builder. 

you should only change mtd/maps/altera.c. 

 

(if you change in sopc builder, you need to regenerate hardware and compile a new sof, 

then in the kernel dir, make ... clean, make ... hwselect ...new ptf ......  

you have to rebuild almost everything. ) 

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

--- quote end ---  

 

--- Quote End ---  

 

 

hippo 

 

I have regenerated hw(.ptf) and compiled a new .sof on QII,but i didn&#39;t used "make clean" this step under linux.  

finally,i have proplem about cpu start addr, when i have changed sdram addr in sopc builer,and how to edit cpu start addr in kernel configure ? 

 

Thx !!!
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

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

--- Quote Start ---  

finally,i have proplem about cpu start addr, when i have changed sdram addr in sopc builer,and how to edit cpu start addr in kernel configure ?[/b] 

--- Quote End ---  

 

You need to make clean, and make hwselect. 

The hwselect script will update cpu start address linkage in kernel.
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

 

--- Quote Start ---  

originally posted by hippo@May 29 2006, 08:21 PM 

<div class='quotetop'>quote  

--- quote end ---  

 

--- quote start ---  

finally,i have proplem about cpu start addr, when i have changed sdram addr in sopc builer,and how to edit cpu start addr in kernel configure ? 

--- Quote End ---  

 

You need to make clean, and make hwselect. 

The hwselect script will update cpu start address linkage in kernel. 

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

[/b] 

--- Quote End ---  

 

 

hi hippo 

 

I have already done according to what you said("make clean","make hwselect".....)  

Finally, the same problem apperas,again. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

Why I always meet the same problem ? 

 

and which place i didn&#39;t set and miss ? 

 

so far, i directly download zImage to sdram under sdk shell. 

i have compiled my project and generated new up4.rbf on QII. 

i have two guestions about how to program epcs serial flash ?(storing hw config and zImge): 

 

Q1: how to download my up4.rbf to epcs and use nios2-flash-programmer under sdk shell ? 

 

Q2:Does i need to change format of my zImage ? 

how to download my zImage to epcs and give spectify addr with using nios2- flash-programmer commad ? 

 

can you give me a example how to use nios2-flash-programmer command ? 

 

THx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

Look in the wiki, http://nioswiki.jot.com/wikihome/operating...flashprogrammer (http://nioswiki.jot.com/wikihome/operatingsystems/%c2%b5clinux/flashprogrammer

 

you must use Nios2 v5.1 sp1 or later to program the EPCS correctly. 

 

Check your kernel dir, include/nios2_system.h 

or check in sopc builder , to find out the epcs controller&#39;s base address. 

If you want Nios II to boot from EPCS device, you have to set "reset address" to EPCS device in cpu option, SOPC builder. 

Then generate hardware in SOPC builder, and compile to sof. 

You have to update kernel, by "make ... clean" , "make.... hwselect.." and rebuild the kernel. 

 

If you use EPCS flash, find out and change the sof path and epcs base (replace 0x00900800) below. 

on nios2 sdk shell, 

cd arch/nios2nommu/boot# Creating .flash file for the FPGA configuration 

sof2flash --epcs --input=your_new_de2.sof --output=standard.flash# Programming flash with the FPGA configuration 

nios2-flash-programmer --epcs --base=0x00900800 standard.flash# Creating .flash file for the project 

elf2flash --epcs --after=standard.flash --input=zImage --output=epcs_controller.flash --boot=$SOPC_KIT_NIOS2/components/altera_nios2/boot_loader_epcs.srec# Programming flash with the project 

nios2-flash-programmer --epcs --base=0x00900800 epcs_controller.flash
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

Hi hippo 

 

Thank u very much ! 

 

I can program sof.flash and zImage.flash to epcs falsh under sdk shell, 

and i have set "reset addr" to epcs device in sopc builder, but i don&#39;t boot zImage from epcs flash. i sure my hw configure data is OK.because i can directly download zImage to sdram and execute "nios2-termial" command to boot uClinux. so i don&#39;t need to download .sof every time.  

 

I have already tested it several times but can&#39;t succeed.  

 

what is something cause can&#39;t boot from epcs flash ?  

 

or i need to enable and disable some options in kerneal configure. 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

hi hippo 

 

I can boot from epcs flash,now. 

If i want to execute command under uclinux os that need to cost more than 1 minutes at least. 

 

Why need to spend so much time to boot from epcs flash ? 

 

When I ececute "free" command under console that can know not increase space of free memory. 

 

Finally, i can&#39;t mount jffs2 mtdblock0 to mnt dir and meet same problem again.. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

1. Which nios2 version do you use ? 

Old version is very slow. 

 

2. Boot from EPCS or CFI will not increase free memory, it is the same as nios2-download to sdram. 

You may follow my latest uClinux-dist , it will increase free memory. 

http://nioswiki.jot.com/wikihome/operating...nux/uclinuxdist (http://nioswiki.jot.com/wikihome/operatingsystems/%c2%b5clinux/uclinuxdist

 

3. Please post your nios2_system.h , altera.c and boot message again. 

You may look in /proc for the info of your mtdblock0.
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

TO_BE_DONE

0 Kudos
Altera_Forum
Honored Contributor II
612 Views

Remove this line from your map in altera.c , which made it read-only, but we want to write. 

.mask_flags =MTD_WRITEABLE, 

 

Which quartus version do you use? 

Which Nios II version do you use? (eg, v5.0 ?) ( not buildroot version)
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

 

--- Quote Start ---  

originally posted by hippo@May 31 2006, 07:07 AM 

remove this line from your map in altera.c , which made it read-only, but we want to write. 

.mask_flags =mtd_writeable, 

 

which quartus version do you use? 

which nios ii version do you use?  (eg, v5.0 ?) ( not buildroot version) 

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

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo 

 

My QII version is 5.1 sp2 and Nios II version is 5.1 sp1. 

 

I am using DE2 examples for 1.0 version. 

 

Does i need to upgrade DE2 version to 1.3 ? 

 

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

--- Quote Start ---  

# mount -t jffs2 /dev/mtdblock0 /mnt# ls /mnt# cd /proc# more mounts 

rootfs / rootfs rw 0 0 

proc /proc proc rw 0 0 

sysfs /sys sysfs rw 0 0 

none /proc/bus/usb usbfs rw 0 0 

/dev/mtdblock0 /mnt jffs2 rw 0 0# umount /mnt[/b] 

--- Quote End ---  

 

 

It seems that I can mount mtdblock0 to mnt dir. 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

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

--- Quote Start ---  

# mount -t jffs2 /dev/mtdblock0 /mnt# ls /mnt# cd /proc# more mounts 

rootfs / rootfs rw 0 0 

proc /proc proc rw 0 0 

sysfs /sys sysfs rw 0 0 

none /proc/bus/usb usbfs rw 0 0 

/dev/mtdblock0 /mnt jffs2 rw 0 0# umount /mnt[/b] 

--- Quote End ---  

 

 

Hi hippo 

 

Thank u !!!! 

 

It seems that I can mount mtdblock0 to mnt dir. 

I will disable initramfs option in kernel configure and copy rootfs to mnt dir ,then rebuild kernel. 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

hi hippo 

 

I have disabled initramfs path to empty and copied rootfs to ~/rootfs/mnt dir, then rebuilt kernel and reprogramed zImage.flash to epcs flash.but i can&#39;t execute command under uclinux . 

 

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

--- Quote Start ---  

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

Built 1 zonelists 

Kernel command line: root=/dev/mtdblock0 

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: 6768k/8192k RAM, 0k/0k ROM (1185k kernel code, 144k data) 

Mount-cache hash table entries: 512 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

JFFS2 version 2.2. (NAND) © 2001-2003 Red Hat, Inc. 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x80481120 (irq = 1) is a jtag_uart 

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank 

Amd/Fujitsu Extended Query Table at 0x0040 

number of CFI chips: 1 

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. 

cmdlinepart partition parsing not available 

RedBoot partition parsing not available 

Using Altera NDK partition definition 

Creating 1 MTD partitions on "Altera NDK flash (AMD)": 

0x00000000-0x00400000 : "jffs2" 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

isp1362-hcd isp1362-hcd: new USB bus registered, assigned bus number 1 

isp1362-hcd isp1362-hcd: irq 4, io mem 0x804810d0 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: ISP1362 Memory usage: 

isp1362-hcd isp1362-hcd: ISTL:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: USED/FREE: 3968    128 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 2 ports detected 

ISP1362 Host Controller, irq 4 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)[/b] 

--- Quote End ---  

 

 

Before, I can mount mtdblock0 to mnt dir and mtdblock0 is blank , because i have not store something in flash.  

 

How to use cfi-flash for jffs2 on uclinux ? 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

add "rootfstype=jffs2" to kernel command line. 

 

You should umount pseudo filesystem , such as /proc/bus/usb, /proc,/sys,  

before "cp -a" or  

skip the cp and use mkdir instead.
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

 

--- Quote Start ---  

originally posted by hippo@May 31 2006, 07:59 PM 

add "rootfstype=jffs2" to kernel command line. 

 

you should umount pseudo filesystem , such as /proc/bus/usb, /proc,/sys,  

before "cp -a"  or  

skip the cp and use mkdir instead. 

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

--- quote end ---  

 

--- Quote End ---  

 

 

hi hippo 

 

So ,there are have root=/dev/mtdblock and rootfstype=jffs2 in kernel command line. Is right ? 

 

I don&#39;t konw how to umount pseudo filesystem ? where ? 

 

Can you explain about it more detial ? 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

If you want to root fs on the jffs2 drive, erase the flash, and on Nios II uClinux, 

 

mount -t jffs2 /dev/mtdblock0 /mnt cd /mnt mkdir proc sys var tmp mnt cp -a init /etc /dev /bin /sbin /lib /usr /root /home . umount /mnt 

 

Config kernel command line "root=/dev/mtdblock0 rootfstype=jffs2" , 

and empty the initramfs path. Then rebuild kernel.
0 Kudos
Altera_Forum
Honored Contributor II
612 Views

hi hippo 

 

I have disable kernel path to empty and rebuild kernel .  

My new kernel size reduce much more that around is 587KB.  

But ,i can not execute command on uclinux. 

 

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

--- Quote Start ---  

uClinux/Nios II 

Altera Nios II support © 2004 Microtronix Datacom Ltd. 

Built 1 zonelists 

Kernel command line: root=/dev/mtdblock0 rootfstype=jffs2 

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: 6768k/8192k RAM, 0k/0k ROM (1185k kernel code, 144k data) 

Mount-cache hash table entries: 512 

SCSI subsystem initialized 

usbcore: registered new driver usbfs 

usbcore: registered new driver hub 

JFFS2 version 2.2. (NAND) © 2001-2003 Red Hat, Inc. 

io scheduler noop registered 

io scheduler deadline registered (default) 

Serial: JTAG UART driver $Revision: 1.4 $ 

ttyJ0 at MMIO 0x80481120 (irq = 1) is a jtag_uart 

Altera NDK flash (AMD): Found 1 x16 devices at 0x0 in 8-bit bank 

Amd/Fujitsu Extended Query Table at 0x0040 

number of CFI chips: 1 

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. 

cmdlinepart partition parsing not available 

RedBoot partition parsing not available 

Using Altera NDK partition definition 

Creating 1 MTD partitions on "Altera NDK flash (AMD)": 

0x00000000-0x00400000 : "jffs2" 

usbmon: debugfs is not available 

driver isp1362-hcd, 2005-04-04 

isp1362-hcd isp1362-hcd: ISP1362 Host Controller 

isp1362_hc_reset: 

isp1362-hcd isp1362-hcd: new USB bus registered, assigned bus number 1 

isp1362-hcd isp1362-hcd: irq 4, io mem 0x804810d0 

isp1362_hc_start: 

isp1362-hcd isp1362-hcd: ISP1362 Memory usage: 

isp1362-hcd isp1362-hcd: ISTL:    2 *  256:      512 @ $0000:$0100 

isp1362-hcd isp1362-hcd: INTL: 16 * ( 64+8):  1152 @ $0200 

isp1362-hcd isp1362-hcd: ATL : 32 * ( 64+8):  2304 @ $0680 

isp1362-hcd isp1362-hcd: USED/FREE: 3968    128 

usb usb1: configuration# 1 chosen from 1 choice 

hub 1-0:1.0: USB hub found 

hub 1-0:1.0: 2 ports detected 

ISP1362 Host Controller, irq 4 

Initializing USB Mass Storage driver... 

usbcore: registered new driver usb-storage 

USB Mass Storage support registered. 

VFS: Mounted root (jffs2 filesystem) readonly. 

Freeing unused kernel memory: 44k freed (0x938000 - 0x942000) 

Warning: unable to open an initial console. 

Kernel panic - not syncing: No init found.  Try passing init= option to kernel.[/b] 

--- Quote End ---  

 

 

Do you know why can not find init ? 

 

Thx !
0 Kudos
Altera_Forum
Honored Contributor II
562 Views

Sorry, the cp of init is incorrect. init => /init 

cp -a /init /etc /dev /bin /sbin /lib /usr /root /home .
0 Kudos
Reply