world leader in high performance signal processing
Trace: » bf548_media_demonstration

Creating the BF548 EZKit Media Demo

The 5 easy steps are:

  1. set the switches per the bf548-ezkit page.
  2. install the bootloader into one of the bootable flashes (SPI or Parallel). These examples show SPI, since most of the VDSP examples sit in parallel flash.
  3. install the kernel into NAND flash
  4. configure the bootloader to load the image from NAND, and boot from the harddrive.
  5. boot a temporary kernel/filesystem in order to install the demo file system into the hard drive

Before starting, it is important to make sure you have all the necessary equipment. All the cables should be plugged in before you start. You will need:

  1. Ethernet cable, from ADI network to the ezkit
  2. Serial cable, from PC to the EZKit.
  3. Power cable

Instructions should be able to be copy/pasted (a line at a time) from this documentation, into the serial application of your choice.

Some demo requires a USB keyboard or a USB mouse. (Please note USB hub is not supported).

These instructions will only work if you have physical access to the Analog Devices Network. VPN, or other connection will not work exactly as stated (For those people working from home offices, this is not going to work). To test this out, try the following from a Linux command prompt, or Windows command prompt
rgetz@imhotep:~> nslookup snoopy.ad.analog.com
Server:         xx.xx.xx.xxx
Address:        xx.xx.xx.xxx#53

Name:   snoopy.ad.analog.com
Address: 10.64.204.21
Your server can be anything (it really does not matter), as long as the address for the snoopy machine comes back.

If this does not work for you -- you can still build everything from the source. There is nothing secret about this, all the source is in the existing uClinux-distribution.

Once built, this binary and the source code from which it is derived, can not be included in a Non-Disclosure Agreement, as defined in the GPL FAQ

You can not distribute, or loan the end result to a non-ADI employee(s), without a proper signed agreement from ADI legal. This has to do with possible potential media patents included in these binaries which can not be transfered to others.

The information found in the tips like this (in green with the light bulb) can safely be ignored - they are just here for information, and further details

Installing the BootLoader (Das U-Boot)

U-Boot is the Bootloader which is used to initialize the Blackfin processor, and load the kernel from NAND flash. For more information, refer to the U-Boot Section of the documentation.

The default EZ-Kit setup has does not ship with U-Boot installed (it includes test applications in the parallel NOR flash and the SPI flash). You have multiple choices to get U-Boot setup. You can:

  1. write it directly into the flash with VDSP++ (Windows) or a supported JTAG device (Linux).
  2. load U-Boot over the UART, and then using the flash driver in the running U-Boot, program the flash.

Since the 2nd option is the one we use all the time, that is the option that we will explore in the most detail.

Load with VDSP

Don't do this unless you are an experienced VDSP user, since I can't answer any questions for you. If you are an experienced VDSP user, you should be able to figure it out.

  1. Download BF548 SPI U-Boot (Right click and “save link as”).
  2. use VDSP++ to write that into the SPI flash. Either the USB debug agent or an ICE can be used to connect to the Ez-Kit. VDSP has instructions for using the flash programmer in the help files. (Note that the u-boot-bf548-ezkit-spi-2008R1.ldr file format is binary, not Intel Hex.)
  3. start Hyperterm, or your other favorite Windows terminal application. Ensure it is set to 57600 baud, 8 data bits, no parity, 1 stop bit, no flow control.
  4. set the Boot Mode to SPI (SW1 to 3)
  5. Reset the board (hit the reset button, or power cycle) Press any key on the keyboard to stop boot in order to get the “bfin>” prompt
  6. skip down to the Write the new U-Boot into flash section

Load over UART

The first section is a little different, depending if you are using a Linux or Windows Host. Instructions for both are given.

Load over UART with a Windows host

This will Boot over the UART and write U-Boot to one of the flashes

  1. Download BF548 UART U-Boot (Right click and “save link as”).
  2. set the Boot Mode to UART boot (SW1 to 7)
  3. Reset the Blackfin, by hitting the reset button.
  4. send it to the BF548 EZKit, as specified in the ldrviewer section, (NOTE: it is required to set the baud rate to 115200 in ldrviewer, and for robustness, set the 2nd stop bit) and then return here.
  5. start Hyperterm, or your other favorite Windows terminal application. Ensure it is set to 57600 baud, 8 data bits, no parity, 1 stop bit, no flow control.
  6. skip down to the Write the new U-Boot into flash section

Load over UART with a Linux host

You will need to install the GNU tool chain before continuing

This will Boot over the UART and write U-Boot to one of the flashes

  1. Download BF548 UART U-Boot (Right click and “save link as”).
  2. set the Boot Mode to UART boot (SW1 to 7)
  3. Reset the Blackfin, by hitting the reset button.
  4. Load it over the UART
    1. with a standard serial port:
      rgetz@imhotep:~> bfin-elf-ldr -l ./u-boot-bf548-ezkit-uart-2008R1.ldr /dev/ttyS0
      Loading LDR /tftpboot/u-boot548_uart.ldr ... auto detected LDR as 'BF548'
      OK!
      Opening /dev/ttyS0 ... OK!
      Configuring terminal I/O ... OK!
      Trying to send autobaud ... OK!
      Trying to read autobaud ... OK!
      Checking autobaud ... OK!
      Autobaud result: 115200bps 49.766mhz (header:0xBF DLL:0x1B DLH:0x00 fin:0x00)
      Sending blocks of DXE 1 ... [12/12] (100%)
    2. with a USB dongle:
      rgetz@imhotep:~> bfin-elf-ldr -l ./u-boot-bf548-ezkit-uart-2008R1.ldr /dev/ttyUSB0
      Loading LDR /tftpboot/u-boot548_uart.ldr ... auto detected LDR as 'BF548'
      OK!
      Opening /dev/ttyUSB0 ... OK!
      Configuring terminal I/O ... OK!
      Trying to send autobaud ... OK!
      Trying to read autobaud ... OK!
      Checking autobaud ... OK!
      Autobaud result: 115200bps 49.766mhz (header:0xBF DLL:0x1B DLH:0x00 fin:0x00)
      Sending blocks of DXE 1 ... [12/12] (100%)
      
  5. start your favorite Linux terminal program. Ensure it is set to 57600 baud, 8 data bits, no parity, 1 stop bit, no flow control.:
    1. with a standard serial port:
      rgetz@imhotep:~> kermit -l /dev/ttyS0 -b 57600 -C connect
    2. with a USB dongle:
      rgetz@imhotep:~> kermit -l /dev/ttyUSB0 -b 57600 -C connect
    3. with a minicom:
      rgetz@imhotep:~> minicom 

Write the new U-Boot into flash

Now that you have a running U-Boot on the BF548, you can use it to connect to the network, and download the correct U-Boot for SPI flash.

  1. Get a IP number for the BF548 EZKit.
    bfin> dhcp
    start Auto negotiation... (take ~2sec)
    Auto negotiation complete, 100BaseTX, full duplex
    BOOTP broadcast 1
    DHCP client bound to address 10.64.204.102
  2. set the serverip to what was returned to you when you looked up the snoopy address above:
    bfin> set serverip 10.64.204.21
  3. download the U-Boot which will be put into the SPI Flash
    bfin> tftp 0x1000000 u-boot548_spi.ldr
    start Auto negotiation... (take ~2sec)
    Auto negotiation complete, 100BaseTX, full duplex
    TFTP from server 10.64.204.21; our IP address is 10.64.204.102
    Filename 'u-boot548_spi.ldr'.
    Load address: 0x1000000
    Loading: #########################################
    done
    Bytes transferred = 205920 (32460 hex)
  4. write it to the spi flash (and yes, you actually type in $(filesize), it is not code for anything else)
    bfin> eeprom write 0x1000000 0x0 $(filesize)
    
  5. set the Boot Mode to SPI (SW1 to 3)
  6. reset the board:
    bfin> reset
    
    U-Boot 1.1.6-svn1145 (ADI-2008R2-pre) (Feb  8 2008 - 09:47:52)
    
    CPU:   ADSP bf548-0.0 (Detected Rev: 0.1)
    Board: ADI BF548 EZ-Kit board
           Support: http:\/\/blackfin.uclinux.org/
    Clock: VCO: 525 MHz, Core: 525 MHz, System: 131 MHz
    RAM:   64 MB
    Flash: 16 MB
    In:    serial
    Out:   serial
    Err:   serial
    NAND:  256 MiB
    Net:   LAN9x18 (0x118a0000) detected at 0x24000000
    MAC:   00:E0:22:FE:B9:38
    I2C:   ready
    Hit any key to stop autoboot: 5
    
  7. press any key to stop the autoboot
    Hit any key to stop autoboot:  0
    bfin>

Load the Linux Kernel into NAND and Filesystem onto the hard drive

Load the Linux Kernel into NAND

  1. Get an IP number for the BF548 EZKit (yes, do this again, since you could not save this anywhere before). You should have a network cable plugged into the ez-kit ethernet connector.
    bfin> dhcp
    start Auto negotiation... (take ~2sec)
    Auto negotiation complete, 100BaseTX, full duplex
    BOOTP broadcast 1
    DHCP client bound to address 10.64.204.102
  2. set the serverip to what was returned to you when you looked up the snoopy address above:
    bfin> set serverip 10.64.204.21
  3. ping the server (and yes, you actually type in $(serverip), it is not code for anything else) :
    bfin> ping $(serverip)
    start Auto negotiation... (take ~2sec)
    Auto negotiation complete, 100BaseTX, full duplex
    host 10.64.204.21 is alive
  4. Download the image to program into the NAND flash
    bfin> tftp 0x1000000 vmImage548
    start Auto negotiation... (take ~2sec)
    Auto negotiation complete, 100BaseTX, full duplex
    TFTP from server 10.64.204.21; our IP address is 10.64.204.102
    Filename 'vmImage548'.
    Load address: 0x1000000
    Loading: #################################################################
             #################################################################
             #################################################################
             ##########################################################
    done
    
  5. erase the nand flash
    bfin> nand erase
    
    NAND erase: device 0 whole chip
    Skipping bad block at  0x04080000
    Skipping bad block at  0x05600000
    Erasing at 0xffe0000 -- 100% complete.
    OK
    
  6. write the file to NAND
    bfin> nand write.jffs2 0x1000000 0x0 0x140000
    
    NAND write: device 0 offset 0x0, size 0x140000
    
    Writing data at 0x13f800 -- 100% complete.
     1310720 bytes written: OK
    
  7. Set up the nandboot command
     bfin> set nandboot 'nand read.jffs2 0x1000000 0x0 0x140000;bootm 0x1000000'
  8. set the bootdelay (number of seconds to count) to 2
    bfin> set bootdelay 2
  9. Set up the default boot arguments:
    bfin> set bootargs root=/dev/sda1 rw earlyprintk=serial,uart1,57600 console=tty0 console=ttyBF0,57600
  10. Set up the default boot mode
    bfin> set bootcmd run nandboot
  11. Save the settings
    bfin> save
    Saving Environment to EEPROM...
    ..done
    

Load the Filesystem onto the hard drive

The easiest (only) way to do this is from a running kernel…

  1. transfer over compressed kernel image
    bfin> tftp 0x1000000 uImage548
    start Auto negotiation... (take ~2sec)
    Auto negotiation complete, 100BaseTX, full duplex
    TFTP from server 10.64.204.21; our IP address is 10.64.204.102
    Filename 'uImage548'.
    Load address: 0x1000000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ###T ##############################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             ############################################T #####################
             #################################################################
             #################T ################################################
             ########
    done
    Bytes transferred = 5028281 (4cb9b9 hex)
    
  2. Boot the kernel
    bfin> bootm
    ## Booting image at 01000000 ...
       Image Name:   Linux-2.6.22.19-ADI-2008R1-svn47
       Created:      2008-05-06  18:50:29 UTC
       Image Type:   Blackfin Linux Kernel Image (gzip compressed)
       Data Size:    5028217 Bytes =  4.8 MB
       Load Address: 00001000
       Entry Point:  0021a000
       Verifying Checksum ... OK
       Uncompressing Kernel Image ... OK
    Starting Kernel at = 21a000
    
    [[snip]]
    
    Have a lot of fun...
    
    BusyBox v1.4.1 (2008-04-30 00:27:32 EDT) Built-in shell (msh)
    Enter 'help' for a list of built-in commands.
    
    root:/> 
    
  3. Repartition the hard drive, since we need to have a ext2 (linux) filesystem. This will provide two file systems, one ext2 (for Linux) and one FAT-32 (for Windows). The first thing to do is print out any existing partitions to understand what currently exists, and delete them.
    root:~> fdisk /dev/sda
    Command (m for help): p
    
    Disk /dev/sda: 40.0 GB, 40007761920 bytes
    255 heads, 63 sectors/track, 4864 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks  Id System
    /dev/sda1               1        1246    10008463+ 83 Linux
    /dev/sda2            1247        2492    10008495   c Win95 FAT32 (LBA)
    
    Command (m for help): d
    Selected partition 1
    
    Command (m for help): d
    Selected partition 2
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-4864, default 1): 1
    Last cylinder or +size or +sizeM or +sizeK (1-4864, default 4864): +10240M
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 2
    First cylinder (1247-4864, default 1247): <return>
    Using default value 1247
    Last cylinder or +size or +sizeM or +sizeK (1247-4864, default 4864): +10240M
    
    Command (m for help): t
    Partition number (1-4): 2
    Hex code (type L to list codes): c
    Changed system type of partition 2 to c (Win95 FAT32 (LBA))
    
    Command (m for help): p
    
    Disk /dev/sda: 40.0 GB, 40007761920 bytes
    255 heads, 63 sectors/track, 4864 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
       Device Boot      Start         End      Blocks  Id System
    /dev/sda1               1        1246    10008463+ 83 Linux
    /dev/sda2            1247        2492    10008495   c Win95 FAT32 (LBA)
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table
    sd 0:0:0:0: [sda] 78140160 512-byte hardware sectors (40008 MB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
     sda: sda1 sda2
    
  4. reformat drive by creating a ext2 based file system (This can take a few minutes)
    root:~> mkfs.ext2 /dev/sda1
    mke2fs 1.39 (29-May-2006)
    Filesystem label=
    OS type: Linux
    Block size=1024 (log=0)
    Fragment size=1024 (log=0)
    1251328 inodes, 10008460 blocks
    500423 blocks (5%) reserved for the super user
    First data block=1
    1222 block groups
    8192 blocks per group, 8192 fragments per group
    1024 inodes per group
    Superblock backups stored on blocks:
            8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553,
            1024001, 1990657, 2809857, 5120001, 5971969
    
    Writing inode tables: done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 22 mounts or
    180.00 days, whichever comes first.  Use tune2fs -c or -i to override.
    
  5. optional to make a windows partition. The only reason to do this is to be able to expose a FAT32 partition to Windows via USB device. (This can take a few minutes)
    root:~> mkfs.msdos -F 32 /dev/sda2
    mkfs.msdos 2.10 (22 Sep 2003)
    
  6. Get an IP number (yeah, do it again)
    root:/> dhcpcd &
    240
    root:/> eth0: SMSC911x/921x identified at 0x24000000, IRQ: 175
    eth0: SMSC911x MAC Address: 00:e0:22:fe:b9:38
    eth0: link down
    eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
    
    You will have to hit return twice after it runs to get the next root:~> prompt.
  7. Note that you may need to wait 5 - 10 seconds in between running the last command, and the next - as it may take a few seconds for the dhcp server on the network to respond to the BF548 EZKit.
  8. Check the network settings were set properly. You will get something that looks like:
    root:/> ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 00:E0:22:FE:B9:38
              inet addr:10.64.204.139  Bcast:10.64.204.255  Mask:255.255.255.0
              UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:286 errors:0 dropped:1673 overruns:0 frame:0
              TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
                        Interrupt:175
    
    or:
    root:/> ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 00:E0:22:FE:B9:38
              UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
                        Interrupt:1
    
    Where the difference between success and failure is the inet addr that is returned. The first case (success) has one, and the second case (failure) does not. If it does not have one try repeating things (yeah, I know - this is a bug, and we are looking into it):
    1. root:/> killall dhcpcd
    2. root:/> dhcpcd &
      240
      root:/> eth0: SMSC911x/921x identified at 0x24000000, IRQ: 175
      eth0: SMSC911x MAC Address: 00:e0:22:fe:b9:38
      eth0: link down
      eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
      
      You will have to hit return twice after it runs to get the next root:~> prompt.
    3. Note that you may need to wait 5 - 10 seconds in between running the last command, and the next - as it may take a few seconds for the dhcp server on the network to respond to the BF548 EZKit.
    4. Check the network settings. You will get something that looks like:
      root:/> ifconfig eth0
      
      If you have success (as defined above) continue to the next step, if you do not get an inet addr address, try again (starting with the killall dhcpcd step. This seems only to be a problem on 1/2 duplex networks, and like I said - we are looking into it. If there is a problem (and there normally is not), it typically only takes a second try and it works.
  9. mount the drive
    root:~> mount /dev/sda1 /mnt
  10. make a directory to mount nfs on:
    root:~> mkdir /nfs
  11. mount the files which you want to copy over to the BF548 EZKit Hard drive.
    root:~> mount -t nfs -o rsize=1024,wsize=1024,nolock snoopy.ad.analog.com:/srv/nfs4 /nfs
  12. Copy the files to the kit from the server (depending on the network setup this could take up a long time - typically 6+ hours - just leave it running overnight, your terminal program does not need to be attached while the system is copying, and it is perfectly OK to disconnect the serial port, leave the Blackfin running overnight, and then reconnect the serial port in the morning. Network and power - must be applied 100% of the time):
    root:~> cp -a /nfs/romfs/* /mnt
    You may see message that look like
    nfs: server snoopy.ad.analog.com not responding, still trying
    nfs: server snoopy.ad.analog.com OK

    which is normal - it just means that the network is slow.

  13. Add the device nodes
    root:/> /nfs/mkdev
    /mnt
    /mnt/dev
    crw-------    1 root     root       5,   1 Aug  9 20:20 console
    crw-rw-rw-    1 root     root       1,   3 Aug  9 20:20 null
    drwxr-xr-x    2 root     root         1024 Aug  9 20:20 pts
    crw-rw-rw-    1 root     root       1,   5 Aug  9 20:20 zero
    
  14. safely unmounts the kits HD
    root:~> sync
    root:~> umount /mnt
  15. reboot the target
    root:~> reboot
    Aug  9 20:22:12 dhcpcd[240]: terminating on signal 15
    
    sd 0:0:0:0: [sda] Synchronizing SCSI cache
    Restarting system.
    
    
    U-Boot 1.1.6-svn1145 (ADI-2008R2-pre) (Feb  8 2008 - 09:47:52)
    
    CPU:   ADSP bf548-0.0 (Detected Rev: 0.1)
    Board: ADI BF548 EZ-Kit board
           Support: http:\/\/blackfin.uclinux.org/
    Clock: VCO: 525 MHz, Core: 525 MHz, System: 131 MHz
    RAM:   64 MB
    Flash: 16 MB
    In:    serial
    Out:   serial
    Err:   serial
    NAND:  256 MiB
    Net:   LAN9x18 (0x118a0000) detected at 0x24000000
    MAC:   00:E0:22:FE:B9:38
    I2C:   ready
    Hit any key to stop autoboot:  0
    
    NAND read: device 0 offset 0x0, size 0x140000
    
    Reading data from 0x13f800 -- 100% complete.
     1310720 bytes read: OK
    ## Booting image at 01000000 ...
       Image Name:   Linux-2.6.22.16-ADI-2008R2-pre-s
       Created:      2008-01-30  12:27:59 UTC
       Image Type:   Blackfin Linux Kernel Image (gzip compressed)
       Data Size:    1290501 Bytes =  1.2 MB
       Load Address: 00001000
       Entry Point:  00001000
       Verifying Checksum ... OK
       Uncompressing Kernel Image ... OK
    Starting Kernel at = 1000
    Linux version 2.6.22.16-ADI-2008R2-pre-svn4147 (rgetz@imhotep) (gcc version 4.1.2 (ADI svn)) #198 Wed Jan 30 07:27:53 EST 2008
    early printk enabled on early_BFuart0
    Hardware Trace Active and Enabled
    
    [snip]
    
    Have a lot of fun...
    Aug  9 20:25:10 login[251]: root login on 'tty0'
    Aug  9 20:25:10 login[254]: root login on 'ttyBF0'
    
    
    BusyBox v1.4.1 (2008-01-30 07:41:51 EST) Built-in shell (msh)
    Enter 'help' for a list of built-in commands.
    
    root:~>
    

Running the demos

There are a few demos on the file system

Mount the Drive as Read/Write

The hard drive is normally mounted as read-only (to reduce the amount of accidental damage that you, the end user can do). However, for networking to work, you must allow the networking applications to write to the file systems. This is a easy process, which involves only a few steps.

  1. Check the status of the drive, to make sure it is read-only (ro):
    root:~> mount
    rootfs on / type rootfs (rw)
    /dev/root on / type ext2 (ro)
    proc on /proc type proc (rw)
    ramfs on /var type ramfs (rw)
    ramfs on /tmp type ramfs (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw)
    debugfs on /sys/kernel/debug type debugfs (rw)
    securityfs on /sys/kernel/security type securityfs (rw)
    usbfs on /proc/bus/usb type usbfs (rw)
    root:~> 
    
  2. If it is read-only, remount it as read-write (rw):
    root:~> mount -o remount,rw /
    
    This will respond in one of two ways,
    root:~>
    
    indicating there is no error, and you can skip to the next step,or
    EXT2-fs warning: checktime reached, running e2fsck is recommended
    root:~>
    
    Where you then need to remount things as read only (don't fix a live filesystem), and run the file system checker (fsck)
    root:~> mount -o remount,ro /
    root:~> fsck.ext2 -y /dev/sda1
    e2fsck 1.39 (29-May-2006)
    /dev/sda1 has gone 8191 days without being checked, check forced.
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    /dev/sda1: 2448/1251328 files (2.7% non-contiguous), 1372027/10008460 blocks
    
    Then you can remount things, and it should work OK.
    root:~> mount -o remount,rw /
    root:~>
    
  3. You can then set up the network, which is normally just a matter of running dhcpcd
  4. After the network is set up, and you are ready, you can remount the drive as read only, to protect yourself from you.
    root:~> sync
    root:~> mount -o remount,ro /