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

Extreme Guide to Kill NEEK with u-boot

Extreme Guide to Kill NEEK with u-boot


STOP! This guide is dangerous. You may kill your NEEK. You are warned.

This is a guide to program your NEEK with u-boot and linux images. It won't really kill the hardware. But the GUI selector will be destroyed though you may recover GUI later when you want.

Please setup DasUBoot first. 

This is based on the neek_ocm_spi_mmu.zip example design. All the image files are attached, so you may try out without any compilation. For more examples of u-boot usages, you may check the blackfin wiki.


1. Study the memory map of cfi flash on the user guide.

0x20000 is the first fpga configuration data, which was the rbf of selector.

0x0 +0x8000 is the boot loader.

We will use the top 3 MB for u-boot and kernel image. You may have 12MB of 0x100000-0xd00000 for jffs2 or other images. 

 

2. we will place u-boot at,

0xfe0000 +0x20000 , top - 1 sector (128K) the u-boot env

0xfa0000 +0x40000, top - 3 sector the u-boot binary code (256KB)

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

make NEEK_config

make

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


3. we will place a tiny boot jump code to u-boot at

0x0 the neek.s binary, which will clear icache and jump to 0xc4fa0000

The source of neek.s is attached. Run ./mneek to build neek.bin


4. we will erase the GUI selector and program our neek_ocm_spi_mmu rbf at 0x20000.

Open quartus, convert programming file,

change file type to Raw binary file, rbf

name the output as neek_ocm.rbf

change mode to active parallel

click configuration master, add file, the sof of neek_ocm_spi_mmu.

generate the neek_ocm.rbf.

 

 

5. copy the above, u-boot.bin, neek.bin, output_file.rbf to your tftp server.

Use nios2-configure-sof and nios2-download to configure and run u-boot on NEEK.

 

nios2-configure-sof cycloneIII_embedded_evaluation_kit_standard.sof

nios2-download -g u-boot

nios2-terminal 

U-Boot 2010.06-rc1-00023-g9bb3b3d-dirty (May 31 2010 - 10:52:15)


CPU   : Nios-II

SYSID : 5f316e28, Mon Oct 05 10:56:53 2009

BOARD : NEEK

MMC:   

Net:  ETHOC-0

==> 

Set your ipaddr and server ip, burn these images,

 

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

setenv ipaddr 192.168.4.2 # set ip of nios2 board

setenv serverip 192.168.4.254 # set to your tftp server saveenv



tftp c1000000 neek.bin

protect off e4000000 +20000

erase e4000000 +20000

cp.b c1000000 e4000000 $filesize


tftp c1000000 u-boot.bin

protect off e4fa0000 +40000

erase e4fa0000 +40000

cp.b c1000000 e4fa0000 $filesize


tftp c1000000 neek_ocm.rbf

protect off e4020000 +e0000

erase e4020000 +e0000

cp.b c1000000 e4020000 $filesize

 

Diconnect nios2-terminal, power cycle, you should see led1 blinking at 1Hz. Then you can connect nios2-terminal again.

 

6. the uClinux-dist will build images/vmImage, which is u-boot image. We will enable MTD command line partition table parsing,fs jffs2 support. We will copy the vmImage and

rootfs.jffs2 to your $(TFTPDIR) dir, which is specified in the uClinux-dist/Makefile.

The header generated using sopc-create-header-files is already in the boards dir,

linux-2.6/arch/nios2/boards/neek/include/asm/neek_ocm_fpga.h.

cd

nios2-linux/uClinux-dist/vendors/Altera

cp -a nios2 neek

And copy Makefile; , config.linux-2.6.x and config.vendor-2.6.x to this neek dir.

Then build,

cd nios2-linux/uClinux-dist

make menuconfig # Select vendor/product, Altera/neek.

make

 

 

7. program the linux kernel image and jffs2 using u-boot,

 

tftp c1000000 vmImage

protect off e4d00000 +200000

erase e4d00000 +200000

cp.b c1000000 e4d00000 $filesize

imi e4d00000 


tftp c1000000 rootfs.jffs2

protect off e4100000 +c00000


erase e4100000 +c00000


cp.b $fileaddr e4100000 $filesize

 

Set the u-boot env for booting linux with,

setenv mtdparts 'mtdparts=physmap-flash.0:128k(boot),896k(fpga),12m(fs),2688k(kernel),384k(uboot)'

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

 

Boot linux with jffs2 

run bootcmd

  1. Booting kernel from Legacy Image at e4d00000 ...
  2.   Image Name:  Linux-2.6.30-00514-ge7e25ac-dirt
  3.   Image Type:  NIOS II Linux Kernel Image (gzip compressed)
  4.   Data Size:   1274277 Bytes = 1.2 MiB
  5.   Load Address: c0000000
  6.   Entry Point: c0000000
  7.   Verifying Checksum ... OK
  8.   Uncompressing Kernel Image ... OK
  9. Linux version 2.6.30-00514-ge7e25ac-dirty (49.25 BogoMIPS (lpj=246272)
  10. Mount-cache hash table entries: 512
  11. net_namespace: 296 bytes
  12. NET: Registered protocol family 16
  13. init_BSP(): registering device resources
  14. bio: create slab <bio-0> at 0
  15. NET: Registered protocol family 2
  16. IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
  17. TCP established hash table entries: 1024 (order: 1, 8192 bytes)
  18. TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
  19. TCP: Hash tables configured (established 1024 bind 1024)
  20. TCP reno registered
  21. NET: Registered protocol family 1
  22. JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
  23. msgmni has been set to 57
  24. io scheduler noop registered
  25. io scheduler anticipatory registered
  26. io scheduler deadline registered
  27. io scheduler cfq registered (default)
  28. fb0: altfb frame buffer device at 0x1e00000+0x177000
  29. ttyJ0 at MMIO 0x8001410 (irq = 7) is a Altera JTAG UART
  30. console handover: boot [early0] -> real [ttyJ0]
  31. ethoc-mdio: probed
  32. physmap platform flash device: 01000000 at 04000000
  33. physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
  34.  Intel/Sharp Extended Query Table at 0x010A
  35.  Intel/Sharp Extended Query Table at 0x010A
  36.  Intel/Sharp Extended Query Table at 0x010A
  37.  Intel/Sharp Extended Query Table at 0x010A
  38.  Intel/Sharp Extended Query Table at 0x010A
  39. Using buffer write method
  40. Using auto-unlock on power-up/resume
  41. cfi_cmdset_0001: Erase suspend on write enabled
  42. 5 cmdlinepart partitions found on MTD device physmap-flash.0
  43. Creating 5 MTD partitions on "physmap-flash.0":
  44. 0x000000000000-0x000000020000 : "boot"
  45. 0x000000020000-0x000000100000 : "fpga"
  46. 0x000000100000-0x000000d00000 : "fs"
  47. 0x000000d00000-0x000000fa0000 : "kernel"
  48. 0x000000fa0000-0x000001000000 : "uboot"
  49. altps2 : base e8001420 irq 9
  50. mice: PS/2 mouse device common for all mice
  51. ads7846 spi1.0: touchscreen, irq 4
  52. input: ADS784x Touchscreen as /devices/platform/altspi.1/spi1.0/input/input0
  53. i2c /dev entries driver
  54. i2c-gpio i2c-gpio.0: using pins 7 (SDA) and 6 (SCL, no clock stretching)
  55. i2c-gpio i2c-gpio.1: using pins 1 (SDA) and 0 (SCL, no clock stretching)
  56. i2c-gpio i2c-gpio.2: using pins 5 (SDA) and 4 (SCL, no clock stretching)
  57. mmc_spi spi2.0: ASSUMING SPI bus stays unshared!
  58. mmc_spi spi2.0: ASSUMING 3.2-3.4 V slot power
  59. mmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
  60. Registered led device: led0
  61. TCP cubic registered
  62. NET: Registered protocol family 17
  63. RPC: Registered udp transport module.
  64. RPC: Registered tcp transport module.
  65. atkbd.c: keyboard reset failed on altps2.0
  66. Sending DHCP requests ., OK
  67. IP-Config: Got DHCP answer from 192.168.4.254, my address is 192.168.4.17
  68. IP-Config: Complete:
  69. VFS: Mounted root (jffs2 filesystem) readonly on device 31:2.
  70. Welcome to
  71.          ____ _ _
  72.         / __| ||_|                 
  73.    _  _| | | | _ ____ _  _ _ _ 
  74.   | | | | | | || | _ \| | | |\ \/ /
  75.   | |_| | |__| || | | | | |_| |/   \
  76.   | ___\____|_||_|_| |_|\____|\_/\_/
  77.   | |
  78.   |_|

  79. For further information check:
  80. http://www.uclinux.org



  81. BusyBox v1.16.1 (2010-05-31 10:32:41 CST) hush - the humble shell
  82. Enter 'help' for a list of built-in commands.

    1. root:/>

Connect a keyboard. And you may try out mmc/sd, and microwin. 

modprobe vfat

modprobe mmc_spi

export TSLIB_TSDEVICE=/dev/event0

export CONSOLE=/dev/tty1

ts_calibrate

nano-X &

nanowm &

nxclock &

nxterm &

If you want u-boot start Linux automatically after power on, add this to the end of NEEK.h and reprogram u-boot. 

  1. define CONFIG_BOOTDELAY   3 

 

Optioal,

8. You can boot with initramfs.

We will need to convert the initramfs image.

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

tftp c1000000 ramdisk.img

protect off e4100000 +600000

erase e4100000 +600000

cp.b c1000000 e4100000 $filesize


Copy ramdisk to ram, and boot linux with initrd.  

cp.l e4100000 c1000000 200000 

bootm e4d00000 c1000000

 

 

9. You may use mmc/sd flash card, (NOTE, these patches are not merged to mainline yet. I will update on this)

==> mmc_spi 0

Create MMC Device

MMC_SPI: 0 at 0:0 30000000 3

==> mmcinfo

Device: MMC_SPI

Manufacturer ID: 17

OEM: 5457

Name: TWTTI 

Tran Speed: 25000000

Rd Block Len: 512

SD version 1.10

High Capacity: No

Capacity: 127664128

Bus Width: 1-bit

==> fatls mmc 0

 4063232  rootfs.jffs2 

  129376  u-boot.bin 

 1219091  vmimage 


3 file(s), 0 dir(s)

Download


Changelog:

20100630: update to v2.6.34, use mdev

Version history
Revision #:
1 of 1
Last update:
‎07-31-2019 08:27 PM
Updated by:
 
Contributors