Community
cancel
Showing results for 
Search instead for 
Did you mean: 

Guide to 2C35 cf with u-boot

Guide to 2C35 cf with u-boot

 

Please setup DasUBoot first.

Study the cfi flash partition in the 2C35 dev board user guide. We will use the first 2M for u-boot and kernel, 12M for jffs2 and 2M for factory configuration. We will put env in the last flash sector.


in u-boot dir, put 2C35.h in include/configs/, put 2c35_cf.h in board/altera/nios2-generic/. Then add an entry 2C35 to the NIOS2_GENERIC list in Makefile.

make 2C35_config

make

You will get u-boot elf and u-boot.bin.

 

1. configure the sof from neek_ocm_spi_mmu.zip

nios2-configure-sof

NiosII_cycloneII_2c35_full_featured.sof


2. download u-boot elf

nios2-download -g u-boot

nios2-terminal

 

3. set env

<p> <p>==> setenv ethaddr 08:00:3e:26:0a:5b # set MAC of nios2 board

</p>==> setenv ipaddr 192.168.4.2 # set ip of nios2 board

</p>

==> setenv serverip 192.168.4.254 # set to your tftp server <p>==> saveenv 

</p>

==> bdinfo

mem start  = 0xC6000000

mem size   = 0x02000000

flash start = 0xE0000000

flash size = 0x01000000

flash offset= 0x00000000

ethaddr    = 08:00:3e:26:0a:5b

ip_addr    = 192.168.4.2

baudrate   = 115200 bps

 

4. program sof to epcs

A C program, bitrev.c, is provided to do the convert sof. You may generate the reversed rbf for epcs flash with,

 

echo bitstream_compression=on > 2c35_cf.cpf

quartus_cpf -c -m PS -o 2c35_cf.cpf NiosII_cycloneII_2c35_full_featured.sof 2c35_cf.rbf

gcc bitrev.c -o bitrev

bitrev < 2c35_cf.rbf > 2c35_cf.rev

==> sf probe 0

8192 KiB M25P64 at 0:0 is now current device

==> tftp c7000000 2c35_cf.rev

SMC91111: MAC 08:00:3e:26:0a:5b

Using SMC91111-36 device

TFTP from server 192.168.4.254; our IP address is 192.168.4.2

Filename '2c35_cf.rev'.

Load address: 0xc7000000

Loading: ###########################

done

Bytes transferred = 390053 (5f3a5 hex)

==> sf erase 0 80000

==> sf write c7000000 0 $filesize

 

5. program zImage to flash 

You may convert an elf executable to binary for flashing with this command, 

nios2-elf-objcopy -O binary zImage zImage.bin

 

==> tftp c7000000 zImage.bin

SMC91111: MAC 08:00:3e:26:0a:5b

Using SMC91111-36 device

TFTP from server 192.168.4.254; our IP address is 192.168.4.2

Filename 'zImage.bin'.

Load address: 0xc7000000

Loading: #################################################################

    #################################################################

    #################################################################

    #################################################################

    #####

done

Bytes transferred = 3882728 (3b3ee8 hex)

==> erase e0000000 +400000


................................................................ done

Erased 64 sectors

==> cp.b c7000000 e0000000 $filesize

Copy to Flash... done


 

 

6. close nios2-terminal, disconnect jtag cable, power off and power on, you will see User LED in FPGA Config blinking quickly. Then the D0 LED will blink slowly, this is the heart-beat of nios2-linux. Reconnect the jtag cable, and start nios2-terminal. You can access the shell of nios2-linux.

 

7. program u-boot to flash, this will overwrite the image we wrote in step 5.

==> tftp c7000000 u-boot.bin

==> erase e0000000 +40000 

==> cp.b c7000000 e0000000 $filesize

Reboot, then you can access the u-boot prompt. 

 

8. program kernel image to

flash.

==> tftp c7000000 vmImage



==> erase e0040000 +1c0000

==> cp.b c7000000 e0040000 $filesize

 

9. program jffs2 to flash

==>tftp c7000000 &rootfs.jffs2

 

==> erase e0200000 +c00000

==> cp.b c7000000 e0200000 $filesize

 

10. Set the env as,

==> setenv mtdparts 'mtdparts=physmap-flash.0:256k(boot),1792k(kernel),12m(fs),2m(factory)'

==> setenv bootcmd 'set bootargs $mtdparts root=/dev/mtdblock2 rootfstype=jffs2 ip=dhcp;bootm e0040000'

==> saveenv 

Boot linux with jffs2 

==> run bootcmd

 


<p>11. you may load files from CF card like this,


==> ide res


Reset IDE: Bus 0: OK 

 Device 0: Model: Flash Card Firm: 2N3-0925 Ser#: CF00000000

           Type: Removable Hard Disk

           Capacity: 246.0 MB = 0.2 GB (503808 x 512)

==> fatls ide 0

 1176207  vmimage 

 2703439  rootfs.initramfs.gz 

 2703503  ramdisk.img 

 5972512  mboot.img 


4 file(s), 0 dir(s)


==> fatload ide 0 c7000000 vmimage

reading vmimage


1176207 bytes read


</p> <p>The

uClinux-dist will build the kernel to a file named as "vmImage" using mkimage. You may supply your rootfs with boot args and boot from this file. You can root your filesystem on jffs2 or others. The following example creates a ramdisk image, and boot with the initramfs from images file on cf card of a 2c35 board. Please note, ramdisk image must

be in sdram to run bootm command with initrd.

</p> <p>mkimage -A nios2 -O linux -T ramdisk -d images/rootfs.initramfs.gz ramdisk.img 

</p> <p> </p> <p> </p>


==> fatload ide 0 0xc7000000 vmimage

reading vmimage


1176207 bytes read

==> fatload ide 0 0xc7200000 ramdisk.img

reading ramdisk.img


2703503 bytes read

==> setenv bootargs console=ttyJ0

==> bootm 0xc7000000 0xc7200000

* kernel: cmdline image address = 0xc7000000

## Booting kernel from Legacy Image at c7000000 ...

  Image Name:  Linux-2.6.30-00511-g00fd692-dirt

  Image Type:  NIOS II Linux Kernel Image (gzip compressed)

  Data Size:   1176143 Bytes = 1.1 MB

  Load Address: c6000000

  Entry Point: c6000000

  Verifying Checksum ... OK

  kernel data at 0xc7000040, len = 0x0011f24f (1176143)

* ramdisk: cmdline image address = 0xc7200000

## Loading init Ramdisk from Legacy Image at c7200000 ...

  Image Name:   

  Image Type:  NIOS II Linux RAMDisk Image (gzip compressed)

  Data Size:   2703439 Bytes = 2.6 MB

  Load Address: 00000000

  Entry Point: 00000000

  Verifying Checksum ... OK

  ramdisk start = 0xc7200040, ramdisk end = 0xc749408f

  Uncompressing Kernel Image ... OK

  kernel loaded at 0xc6000000, end = 0xc6278200

bootargs=console=ttyJ0 @ 0xc7e7daf0

initrd=0xc7200040-0xc749408f

Linux version 2.6.30-00511-g00fd692-dirty () (gcc version 4.1.2) #16 Tue Mar 9 11:17:09 CST 2010

console [early0] enabled

Early printk initialized


 

Download

Attachments
Version history
Revision #:
1 of 1
Last update:
‎06-27-2019 03:47 PM
Updated by:
 
Contributors