world leader in high performance signal processing
Trace: » bf537-stamp

ADSP-BF537 STAMP Quick Start

Introduction

The ADSP-BF537 STAMP uClinux Dist Board Support Package (BSP) provides you with an environment to develop Linux applications for the ADSP-BF537 Blackfin Processor.

This document provides a brief overview of how to get started using the ADSP-BF537 STAMP board. A detailed document of the board, the Linux operating system, and the GNU toolchain can be found on the accompanying CD under the \docs\ directory or on the website at offline docs.

BSP Contents

This kit contains the ADSP-BF537 STAMP board, the Open Source collection CD/DVD, and this document. It also contains an universal 7.5V DC power supply.

www.analog.com_static_imported-files_images_product_descriptions_5678234885385728190adsp_bf537_stamp_color_dark.jpg

The schematics and layout files for this board are on the CD and can be found on the web at schematics. Full specifications for the ADSP-BF537 Blackfin processor can be found on the web at Blackfin Homepage.

Disc Contents

The disc contains might contain outdated releases of our toolchain, kernel, and bootloader. Please visit our homepage to make sure you start off with the latest releases.

Conventions

Some things to keep in mind while reading this guide:

  • When working with dip switches (the ones with numbers on one side), ON means the switch is away from the number
  • Das U-Boot (or just U-Boot) is the default boot loader used on Blackfin systems
  • Linux is the open source operating system typically run by U-Boot
  • Terminal emulators are programs that let you communicate with the board over the serial port

Toolchain Install

You will need to install the Blackfin Toolchain in order to work with Blackfin open source. Basically, visit the toolchain download page and download these files (where <version> is the latest version available):

  • blackfin-toolchain-<version>.i386.tar.bz2
  • blackfin-toolchain-uclibc-default-<version>.i386.tar.bz2

Then unpack them to /opt/uClinux/ by running the following command on each tarball:

$ sudo tar jxf <tarball> -C /

Then update your environment by running (you will need to do this in every new console; some people put this into their ~/.profile):

$ export PATH=/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin:$PATH

If everything went as planned, you can run:

$ bfin-uclinux-gcc --version
bfin-uclinux-gcc (ADI-trunk/git-e311b75) 4.3.5
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you do not see output like above, please consult the more comprehensive installing page.

Cables

Before we can talk to the board, we need to be properly connected to it. The three cables you will need here are:

  • the power supply that came with the board
  • a straight through serial cable (not a null modem or cross over cable)
  • an Ethernet cable

While the Ethernet cable is not strictly necessary as you can load files over the UART to U-Boot, it is significantly faster and will make open source development a much smoother process. So save yourself the hassle and get an Ethernet cable.

Once you have these cables, start connecting and configuring your system:

  1. Connect the serial port on your host computer to the serial port on the board using a serial cable
  2. Connect the Ethernet jack on your board to your local network with an Ethernet cable
  3. Start a terminal emulation program (Minicom or HyperTerminal) on your host computer with the settings:
    • 57600 baud
    • 8 data bits
    • parity none
    • 1 stop bit
    • h/w flow control off
  4. Connect the power cable to the board to power it on
  5. Hopefully you should see some LEDs flashing on the board
  6. Do not worry about what the board is doing right now as we will reset it as needed

Loading U-Boot

Before we can do anything useful, we need a boot loader to bootstrap the processor when powered on. This boot loader will then be used to load the Linux operating system (among many other things).

Your board might already have U-Boot on it, but for completeness sake, we'll assume it does not. If it does, you can skip this section if you see U-Boot output already in your terminal emulator.

Since we have a Blackfin processor that supports booting over the UART, we will use that to bootstrap the processor the first time. Then we can reprogram the flash and save the boot loader to flash. That way the board will be able to locate the boot loader automatically without requiring manual setup from you.

Please visit the U-Boot download page and download the ADSP-BF537 STAMP tarball u-boot-bf537-stamp-<version>.tar.bz2. Inside of that archive, you will find a UART LDR named u-boot-bf537-stamp-uart-<version>.ldr which will be needed below.

You will want to configure the switches on the board as follows:

  • SW16: Set the boot mode switch to position 7
  • JP9: Remove the UART loop back jumper
  • SW4: Set UART switch to {OFF,ON,OFF,ON}
  • SW6: Set flash switch to {ON,ON,ON,ON}

Now with your terminal emulator running, press the reset button (SW9) a few times. You should see no output. Press the space bar a few times and you should see one or two random bytes come back. Hit the reset button a few times again, and try the space bar again. If you still see a few bytes come back, then everything is connected properly. Now quit out of your terminal emulator and once it has exited, hit the reset button a few more times. If things did not go smoothly, please see the troubleshooting page.

Loading over the UART

The ldr-utils can be used to load applications over the UART (for those parts which support it over the BootROM).

$ bfin-uclinux-ldr -l /tftpboot/u-boot.ldr /dev/ttyUSB0 && kermit -l /dev/ttyUSB0 -b 57600 -C connect
Loading LDR /tftpboot/u-boot.ldr ... 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 ... [1/2] [2/2] OK!
Sending blocks of DXE 2 ... [1/6] [2/6] [3/6] [4/6] [5/6] [6/6] OK!
You may want to run minicom or kermit now
Quick tip: run 'ldrviewer <ldr> <tty> && minicom'
Connecting to /dev/ttyUSB0, speed 57600
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
 0
bfin> version
U-Boot-1.1.3-ADI (Sep 28 2006 - 16:16:44)
bfin>

 > bfin-uclinux-ldr -l /tftpboot/u-boot.ldr /COM1
Loading LDR /tftpboot/u-boot.ldr ... OK!
Opening /COM1 ... 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 ... [1/2] [2/2] OK!
Sending blocks of DXE 2 ... [1/6] [2/6] [3/6] [4/6] [5/6] [6/6] OK!
You may want to run minicom or kermit now

Now, run your favorite Windows terminal program.

TFTP Upload

With U-boot up and running, we can program the u-boot-bf537-stamp-bypass-<version>.bin from the ADSP-BF537 STAMP tarball you already downloaded. Copy the file to the TFTP server directory so that it can be fetched and name it u-boot.bin. If you do not already have a TFTP server running, then consult the setting up a TFTP server page.

First make sure ethernet is enabled by configuring the switches on the board as follows: none required

Make sure your board is configured to talk to the TFTP server. By default, the board uses the IP 192.168.0.15 and tries to connect to the server 192.168.0.2 via the gateway 192.168.0.1. You can check the env settings on the board:

bfin> print ipaddr
ipaddr=192.168.0.15
bfin> print serverip
serverip=192.168.0.2
bfin> print gatewayip
gatewayip=192.168.0.1

If you need different addresses, then simply change the value of these variables:

bfin> set ipaddr 192.168.1.100

Now that we are happy with the network settings, we will transfer the file to the board's external memory over Ethernet via tftp (the filesize might not match exactly your output):

bfin> tftp 0x1000 u-boot.bin
Using bfin_mac device
TFTP from server 192.168.0.2; our IP address is 192.168.0.15
Filename 'u-boot.ldr'.
Load address: 0x1000
Loading: ###############
done
Bytes transferred = 212528 (33e30 hex)

Verify the file transferred correctly by using the crc command on the board:

bfin> crc 0x1000 $(filesize)

Then compare the value to the crc computed on your host computer:

$ crc /tftpboot/u-boot.bin

They should of course match.

Flash Programming

We will now program U-Boot into the parallel flash on the board so that you can reboot the board and have U-Boot automatically run. For more details on utilizing parallel flash in U-Boot in general, consult the U-Boot parallel flash documentation.

First make sure parallel flash is connected to the processor by configuring the switches on the board as follows:

  • SW6: set all to ON

Now you should be able to query the flash and see output like so:

bfin> flinfo
Bank # 1: CFI conformant FLASH (16 x 16)  Size: 4 MB in 71 Sectors
  AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x2257
  Erase timeout: 8192 ms, write timeout: 1 ms

  Sector Start Addresses:
  20000000   RO   20002000   RO   20004000   RO   20006000   RO   20008000   RO

To program the flash, you'll first want to unprotect all the relevant sectors:

bfin> protect off 0x20000000 +0x40000
........... done
Un-Protected 11 sectors

Then erase them:

bfin> erase off 0x20000000 +0x40000
........... done
Erased 11 sectors

Write the U-Boot image to the flash:

bfin> cp.b 0x1000 0x20000000 $(filesize)
Copy to Flash... done

Verify everything was written correctly (the exact byte count might not match your output):

bfin> cmp.b 0x1000 0x20000000 $(filesize)
Total of 212528 bytes were the same

Now your board should be all set to go! Change the boot mode switch so that the board will boot out of parallel flash: position 0

Hit the reset button (SW9) and hopefully you should see U-Boot output on your console.

Loading Linux

Now that we have a stable bootloader on the board, we can start playing with Linux. The typical development methodology is to download a uImage (a bootable image of the kernel) over TFTP/Ethernet into external memory and then boot it. You could program the uImage file into your flash if it is small enough, but that's no fun if you want to tweak kernel settings and quickly test the result.

The uImage file is often times compressed. So before it can actually be booted, it must be uncompressed. The default setup will load the uImage to a high address (say around 16MiB) where it can be decompressed to the kernel's load address (usually 0x1000) without clobbering itself. Keep this in mind so you don't accidentally load the uImage to a low address, attempt to boot it, and then get weird decompression errors.

The default distribution used on Blackfin processors is the uClinux distribution. Originally from http://uclinux.org/, the Blackfin fork incorporates many more packages and updates.

Release Image

First let's make sure we can load and boot a known working image. Visit the uClinux Distribution download page and download the uImage-bf537-stamp-<version> file. Place this into your TFTP root directory and name it simply uImage.

uImage Boot

Load the file onto the board. The variable loadaddr defaults to a high address that suits the majority of cases (the filesize might not match exactly your output).

bfin> tftp $(loadaddr) uImage
Using bfin_mac device
TFTP from server 192.168.0.2; our IP address is 192.168.0.15
Filename 'uImage'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################
done
Bytes transferred = 4137524 (3f2234 hex)

Before you can boot it, you might want to tweak the kernel's command line. This is controlled via the bootargs environment variable. The default should work fine for the release and default builds:

bfin> print bootargs
bootargs=root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600 console=ttyBF0,57600

Now actually boot things by running (the addresses here might not line up exactly to yours):

bfin> bootm $(loadaddr)
## Booting kernel from Legacy Image at 01000000 ...
   Image Name:   BF537-2.6.34.7-ADI-2010R1
   Created:      2010-11-29   9:28:19 UTC
   Image Type:   Blackfin Linux Kernel Image (gzip compressed)
   Data Size:    4137460 Bytes = 3.9 MiB
   Load Address: 00001000
   Entry Point:  001f46bc
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Starting Kernel at = 001f46bc
Linux version 2.6.34.7-ADI-2010R1 (root@eight) (gcc version 4.3.5 (ADI-2010R1-RC4) )
...etc...

You should see the normal kernel boot output here if everything went as expected.

Userland

You should see the kernel prompt:

Freeing unused kernel memory: 5916k freed
                           _____________________________________
        a8888b.           / Welcome to the uClinux distribution \
       d888888b.         /       _     _                         \
       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |
       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |
       8'    .88       \        | |   | |  _ \| | | | \  /        |
       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |
      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |
     dP   .    Y8b.       \   For embedded processors including   |
    d8:'  "  `::88b        \    the Analog Devices Blackfin      /
   d8"         'Y88b        \___________________________________/
  :8P    '      :888
   8a.   :     _a88P         For further information, check out:
 ._/"Yaa_:   .| 88P|            - http://blackfin.uclinux.org/
 \    YP"    `| 8P  `.          - http://docs.blackfin.uclinux.org/
 /     \.___.d|    .'           - http://www.uclinux.org/
 `--..__)8888P`._.'  jgs/a:f    - http://www.analog.com/blackfin

Have a lot of fun...


BusyBox v1.16.2 (2010-11-29 17:25:57 CST) hush - the humble shell

root:/> uname -a
Linux blackfin 2.6.34.7-ADI-2010R1 #4 Mon Nov 29 17:28:07 CST 2010 blackfin GNU/Linux

Do what it says and have some fun!

Building uClinux-dist

Now you're ready to start compiling things yourself! Make sure you have a few gigabytes free to unpack and compile the distribution.

Source

Visit the uClinux Distribution download page and download the blackfin-linux-dist-<version>.tar.bz2 archive.

Unpack the huge archive (not as root!):

$ tar xjf blackfin-linux-dist-<version>.tar.bz2

Build

Enter the tree:

$ cd blackfin-linux-dist

Select the default configuration for this board:

$ make AnalogDevices/BF537-STAMP_defconfig

And then build it up:

$ make

Images

Once things have finished compiling, all the final images are placed in the images/ subdirectory. Most of the time, you'll just want to copy the images/uImage file to your TFTP root. For full details on all these files, see the uClinux distribution images page.

$ cp images/uImage /tftpboot/

Now you can boot your local build. The default is to bundle the root filesystem as an initramfs and run everything out of RAM.

For the curious, the romfs/ directory is the generated output tree that is used to create the rootfs.

Customization

If you want to add more userland packages (libraries/servers/programs/etc…), then do:

$ make config_menuconfig

If you want to customize the Linux kernel settings, then do:

$ make linux_menuconfig

After you're done, simply run make again and have updated files in images/.