User Tools

Site Tools


blackfin:uclinux_bf561setup

Based on the original wiki entry “uCLinux on the BF537 EZLite” by Dr. Andrew Willis arwillis

This document describes the installation of uClinux(an embedded version of the standard linux kernel ) on an Analog Devices, Inc. ADSP-BF561 EZ-KIT Lite evaluation board. The BF561 provides computational power through a dual-core processor configuration and with the support of the blackfin.uclinux.org community website that includes Analog Devices, Inc. engineers. — twmeiswi 2007/09/17 23:18

Hardware you need

  1. The BF561-EZLITE evaluation board.
  2. A serial cable or a USB⇒serial connector (see details below).
  3. A computer running Linux - I prefer Ubuntu for the plethora of support available.

These are the only two things needed to run uClinux on the BF561. I suggest looking into the purchase of a USB⇒serial converter. This is a nifty way to connect to the target using a contemporary usb port rather than a 9-pin serial port which may / may not exist on PCs in the future (or even today). Connectors are available all over the web. One such place is here : http://www.pfranc.com/usb/usb.shtml.

The following installation on the BF561 may take between 10 to 20 hours to complete depending on the speed of the development system. The retrieval of the source code from servers and compiling time requires a large chunk of time, but during these times it is helpful to take breaks and take a nap or drink some coffee. The total disk space that the source code and compiled tools takes up should be around 6 gigabytes, so make sure you are patient and bear with the wiki.

Register to the Blackfin uClinux Site

Go to blackfin.uclinux.org and register to the uclinux blackfin community. Questions can be answered through the forums and responses usually are quick(within 24 hours).

Serial Terminal Emulators

The BF561-EZLITE has two standard ports(USB and RS232) for communications to the outside world. The USB port is designed for debugging in VisualDSP++ and serial communication must be used by default for file transfers. There are three major serial terminal emulators available for Linux:

  1. CuteCom(good) - graphical terminal similar to Hyperterminal in Microsoft Windows
  2. gtkterm(better) - basic serial terminal
  3. minicom(best) - best for handling file transmission to the Blackfin through the serial port with automatic file handling

Since the USB→serial cable that was used had a male connection on the serial end, a gender changer was connected to change to female before connecting to the BF561.

| Installing Serial Communication Programs
rootbash$> apt-get install cutecom
rootbash$> apt-get install gtkterm
rootbash$> apt-get install minicom

More information on these can be found at http://cutecom.sourceforge.net/,http://sourceforge.net/projects/gtkterm/, and http://alioth.debian.org/projects/minicom/

Getting the SubVersioN (SVN) Source

The uClinux community at the blackfin.uclinux.org website is very active and changes to source code are made on a regular basis. Therefore, it is crucial that the latest version of the tools available are downloaded to ensure proper operation of the BF561 board. Subversion or svn, is a program which downloads files from a server and stores them locally on the development system, so that the most up-to-date tools are compiled.

| Installing subversion
rootbash$> apt-get install subversion

Once you have obtained subversion, you can download the latest and greatest versions of all things relating to the Blackfin. There are four packages that must be downloaded through SVN for the proper operation of uClinux on the Blackfin platform. It's a good idea to navigate to the /home directory before executing the svn commands, as it is much easier to keep things organized for future use.

The following commands get

  1. Toolchain source → includes the necessary cross-compilers and debuggers for porting source code to run on the uClinux platform
  2. uClinux distribution source → includes applications to run on the Blackfin boards
  3. linux kernel source → includes drivers and low-level functionality for the Blackfin platform
  4. u-boot source → bootloader used to automatically boot uClinux on startup

UPDATE

Checking out the code from blackin.uclinux.org can take a very long time (3+hours). Hence, the projects are being mirrored locally on the visionlab server.

| Checking out the latest Blackfin source
bash$> svn checkout http://www.visionlab.uncc.edu/svn/toolchain
bash$> svn checkout http://www.visionlab.uncc.edu/svn/uclinux-dist
bash$> svn checkout http://www.visionlab.uncc.edu/svn/linux-kernel
bash$> svn checkout http://www.visionlab.uncc.edu/svn/u-boot

If for some reason you can't get the sources locally from visionlab.uncc.edu, try the following commands :

| Checking out the latest Blackfin source
bash$> svn checkout svn://sources.blackfin.uclinux.org/toolchain/trunk toolchain
bash$> svn checkout svn://sources.blackfin.uclinux.org/uclinux-dist/trunk uclinux-dist
bash$> svn checkout svn://sources.blackfin.uclinux.org/linux-kernel/trunk linux-kernel
bash$> svn checkout svn://sources.blackfin.uclinux.org/u-boot/trunk u-boot

After running each command it should output the version number of the source code downloaded. For example:

“toolchain version 1488”

“uclinux-dist version 4995”

“linux kernel version 2793”

“u-boot version 614”

Directions on setting up mirrors are provided here : http://docs.blackfin.uclinux.org/doku.php?id=version_control_systems&s=rsync#mirroring_svn

Note that u-boot seems to have both u-boot-1.1.3 and u-boot-1.1.6 as part of the trunk. I believe version 1.1.6 will be the one we will use for our system.

Build the Blackfin toolchain

We now will compile the source to the toolchain which will be the workhorse of our system. The toolchain takes C code we write and generates binaries executable on the target system. To compile the toolchain we will need to install all of the programs which the toolchain build script requires. The following command tests for the presence of these programs.

| Checking prerequisites for building toolchain
$bash:toolchain/buildscript$>./BuildToolChain -p
Can not find autoconf
Can not find automake
bison (GNU Bison) 2.3
flex 2.5.33
gcc (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)
gettext (GNU gettext-runtime) 0.14.6
grep (GNU grep) 2.5.1
ln (GNU coreutils) 5.97
GNU M4 1.4.4
GNU Make 3.81
makeinfo (GNU texinfo) 4.8
msgfmt (GNU gettext-tools) 0.14.6
/usr/bin/which: illegal option -- -
Usage: /usr/bin/which [-a] args
mv (GNU coreutils) 5.97
cp (GNU coreutils) 5.97
rm (GNU coreutils) 5.97
This is free software.  You may redistribute copies of it under the terms of
There is NO WARRANTY, to the extent permitted by law.
grep (GNU grep) 2.5.1
mkdir (GNU coreutils) 5.97
tail (GNU coreutils) 5.97
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Can not find runtest
/bin/bash

Looks like I am missing a couple of needed tools for compile. I install them the debian way below.

| Install needed programs
bashroot$> apt-get install autoconf automake

You also need dejagnu for the runtest program used for cross-compilation.

| Install needed programs
bashroot$> apt-get install dejagnu

It's a good idea to run the check for prerequisites again, just in case a package was not properly installed. The following was output after installing all of the needed packages.

| Checking prerequisites for building toolchain, again
$bash:toolchain/buildscript$>./BuildToolChain -p
Check http://gcc.gnu.org/install/prerequisites.html for more information
Autoconf version 2.13
Autoconf 2.13 chosen by Debian wrapper script.
For information and tuning advice see autoconf(1).
automake (GNU automake) 1.10
bison (GNU Bison) 2.3
flex 2.5.33
gcc (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
gettext (GNU gettext-runtime) 0.16.1
grep (GNU grep) 2.5.1
ln (GNU coreutils) 5.97
GNU M4 1.4.8
GNU Make 3.81
makeinfo (GNU texinfo) 4.8
msgfmt (GNU gettext-tools) 0.16.1
Illegal option --
Usage: /usr/bin/which [-a] args
mv (GNU coreutils) 5.97
cp (GNU coreutils) 5.97
rm (GNU coreutils) 5.97
grep (GNU grep) 2.5.1
mkdir (GNU coreutils) 5.97
tail (GNU coreutils) 5.97
/bin/sh: Illegal option --
Expect version is       5.43.0
Tcl version is          8.4
Framework version is    1.4.99
SHELL = /bin/bash
Done checking for prerequisites

The command below will build the toolchain needed to cross-compile programs so they can run on the Blackfin architecture and are required to get linux up and running on a Blackfin board. Since the compile process takes a long time, the following is the output from a compile that Dr. Willis did for the BF537. The output is very similar to the BF561 platform, with some minor version number differences between the packages installed. This command will take about one hour (and 10 mins) on a newer computer, but may take upwards of 6 hours on an older processor(Pentium 4 1.5GHz) to complete if successful.

| Build the toolchain
bash~$> mkdir build
bash$> ~/toolchain/buildscript/BuildToolChain -s ~/toolchain -k ~/linux-kernel -u ~/u-boot/u-boot-1.1.6 -b ~/build -o ~/cvsoutput
 
Building gcc versions 4.1
Utilizing make: make -j2
Found multiple versions of autoconf, using the one at /usr/bin/autoconf
Found multiple versions of automake, using the one at /usr/bin/automake
Found multiple versions of bison, using the one at /usr/bin/bison
Found multiple versions of flex, using the one at /usr/bin/flex
Found multiple versions of gcc, using the one at /usr/bin/gcc
Found multiple versions of gettext, using the one at /usr/bin/gettext
Found multiple versions of m4, using the one at /usr/bin/m4
Found multiple versions of make, using the one at /usr/bin/make
Found multiple versions of makeinfo, using the one at /usr/bin/makeinfo
Found multiple versions of msgfmt, using the one at /usr/bin/msgfmt
Found multiple versions of which, using the one at /usr/bin/which
Found multiple versions of tail, using the one at /usr/bin/tail
Found multiple versions of make, using the one at /usr/bin/make
Removing /opt/uClinux/bfin-uclinux/bin from the PATH
Toolchain source is at      /home/drew/archive/bf537/toolchain
Kernel source is at         /home/drew/archive/bf537/linux-kernel
Build will be done in       /home/drew/archive/bf537/build
Path to elf output dir  /home/drew/archive/bf537/cvsoutput-elf
/home/drew/archive/bf537/cvsoutput-elf already exists - cleaning
Path to binutils dir        /home/drew/archive/bf537/toolchain/binutils-2.17
Path to elf2flt dir         /home/drew/archive/bf537/toolchain/elf2flt
Path to uClibc dir          /home/drew/archive/bf537/toolchain/uClibc
Path to genext2fs           /home/drew/archive/bf537/toolchain/genext2fs
Path to cramfs-tools        /home/drew/archive/bf537/toolchain/cramfs-1.1
Path to ldr-utils           /home/drew/archive/bf537/toolchain/ldr-utils
Path to uClinux output dir  /home/drew/archive/bf537/cvsoutput-uclinux
/home/drew/archive/bf537/cvsoutput-uclinux already exists - cleaning
Path to linux-uClibc output dir  /home/drew/archive/bf537/cvsoutput-linux-uclibc
/home/drew/archive/bf537/cvsoutput-linux-uclibc already exists - cleaning
Path to kernel output dir  /home/drew/archive/bf537/build/kernel_build
/home/drew/archive/bf537/build/kernel_build already exists - cleaning
Path to U-Boot Source       /home/drew/archive/bf537/u-boot/u-boot-1.1.6
Path to uClibc Config files /home/drew/archive/bf537/toolchain/uClibc/extra/Configs/
Creating log file           /home/drew/archive/bf537/build/logs/log
Removing old build dir
*** Configuring Elf Binutils & GDB Sat Mar  3 21:10:15 EST 2007
*** Building Elf Binutils & GDB    Sat Mar  3 21:10:18 EST 2007
*** Installing Elf Binutils & GDB  Sat Mar  3 21:15:56 EST 2007
Path to gcc dir             /home/drew/archive/bf537/toolchain/gcc-4.1
*** Linking files from /home/drew/archive/bf537/toolchain/binutils-2.17/newlib to /home/drew/archive/bf537/toolchain/gcc-4.1
*** Configuring GCC                Sat Mar  3 21:16:01 EST 2007
*** Building GCC                   Sat Mar  3 21:16:05 EST 2007
*** Installing GCC                 Sat Mar  3 21:32:59 EST 2007
*** Building Elf elf2flt           Sat Mar  3 21:33:24 EST 2007
*** Make Elf elf2flt               Sat Mar  3 21:33:27 EST 2007
*** Installing Elf elf2flt         Sat Mar  3 21:33:28 EST 2007
*** Building libdsp                Sat Mar  3 21:33:28 EST 2007
*** Installing libdsp              Sat Mar  3 21:33:29 EST 2007
*** Installing libdsp              Sat Mar  3 21:33:29 EST 2007
*** Configuring Linux Kernel       Sat Mar  3 21:33:29 EST 2007
*** Configuring uClibc             Sat Mar  3 21:33:48 EST 2007
*** Cleaning uClibc                Sat Mar  3 21:33:50 EST 2007
*** Building uClibc                Sat Mar  3 21:33:56 EST 2007
*** Installing uClibc              Sat Mar  3 21:35:03 EST 2007
*** Configuring sep-data uClibc    Sat Mar  3 21:35:04 EST 2007
*** Cleaning uClibc                Sat Mar  3 21:35:04 EST 2007
*** Building uClibc                Sat Mar  3 21:35:10 EST 2007
*** Installing uClibc              Sat Mar  3 21:36:21 EST 2007
*** Configuring shared flat uClibc Sat Mar  3 21:36:22 EST 2007
*** Cleaning uClibc                Sat Mar  3 21:36:22 EST 2007
*** Building uClibc                Sat Mar  3 21:36:28 EST 2007
*** Installing uClibc              Sat Mar  3 21:37:37 EST 2007
*** Configuring uClibc for FD-PIC  Sat Mar  3 21:37:38 EST 2007
*** Cleaning uClibc                Sat Mar  3 21:37:38 EST 2007
*** Building uClibc                Sat Mar  3 21:37:44 EST 2007
*** Installing uClibc              Sat Mar  3 21:38:58 EST 2007
*** Cleaning uClibc                Sat Mar  3 21:38:59 EST 2007
*** Building uClibc                Sat Mar  3 21:39:05 EST 2007
*** Installing uClibc              Sat Mar  3 21:40:19 EST 2007
*** Cleaning kernel                Sat Mar  3 21:40:19 EST 2007
*** Cleaning uClibc                Sat Mar  3 21:40:19 EST 2007
*** Configuring uClinux Binutils & GDBSat Mar  3 21:40:25 EST 2007
*** Building uClinux Binutils & GDB   Sat Mar  3 21:40:29 EST 2007
*** Installing uClinux Binutils & GDB Sat Mar  3 21:46:17 EST 2007
Path to gcc dir             /home/drew/archive/bf537/toolchain/gcc-4.1
*** Configuring GCC                Sat Mar  3 21:46:22 EST 2007
*** Building GCC                   Sat Mar  3 21:46:26 EST 2007
*** Installing GCC                 Sat Mar  3 21:59:11 EST 2007
*** Building uClinux elf2flt       Sat Mar  3 21:59:27 EST 2007
*** Cleaning uClinux elf2flt       Sat Mar  3 21:59:27 EST 2007
*** Building uClinux elf2flt       Sat Mar  3 21:59:30 EST 2007
*** Installing uClinux elf2flt     Sat Mar  3 21:59:31 EST 2007
*** Configuring linux-uclibc Binutils & GDBSat Mar  3 21:59:31 EST 2007
*** Building linux-uclibc binutils    Sat Mar  3 21:59:35 EST 2007
*** Installing linux-uclibc binutils  Sat Mar  3 22:05:32 EST 2007
Path to gcc dir             /home/drew/archive/bf537/toolchain/gcc-4.1
*** Configuring GCC                Sat Mar  3 22:05:39 EST 2007
*** Building GCC                   Sat Mar  3 22:05:43 EST 2007
*** Installing GCC                 Sat Mar  3 22:16:19 EST 2007
Installing /home/drew/archive/bf537/cvsoutput-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libstdc++.so.6.0.8
Installing /home/drew/archive/bf537/cvsoutput-linux-uclibc/lib/gcc/bfin-linux-uclibc/4.1.2/libgcc_s.so.1
*** Installing uClinux libdsp      Sat Mar  3 22:16:25 EST 2007
*** Building uClinux genext2fs     Sat Mar  3 22:16:25 EST 2007
*** Cleaning uClinux genext2fs     Sat Mar  3 22:16:25 EST 2007
*** Make uClinux genext2fs         Sat Mar  3 22:16:31 EST 2007
*** Installing uClinux genext2fs   Sat Mar  3 22:16:33 EST 2007
*** Building uClinux cramfs-tools  Sat Mar  3 22:16:33 EST 2007
*** Cleaning uClinux cramfs-tools  Sat Mar  3 22:16:33 EST 2007
*** Make uClinux cramfs-tools      Sat Mar  3 22:16:33 EST 2007
*** Installing uClinux cramfs-tools Sat Mar  3 22:16:34 EST 2007
*** Building uClinux ldr-utils      Sat Mar  3 22:16:34 EST 2007
*** Cleaning uClinux ldr-utils      Sat Mar  3 22:16:34 EST 2007
*** Make uClinux ldr-utils          Sat Mar  3 22:16:34 EST 2007
*** Installing uClinux ldr-utils    Sat Mar  3 22:16:35 EST 2007
*** Building U-Boot to get Tools   Sat Mar  3 22:16:35 EST 2007
*** Cleaning U-Boot                Sat Mar  3 22:16:35 EST 2007
*** Make U-Boot                    Sat Mar  3 22:16:35 EST 2007
*** Copying U-Boot Tools           Sat Mar  3 22:16:36 EST 2007
*** Cleaning U-Boot                Sat Mar  3 22:16:36 EST 2007
*** Building target libbfd (flat)  Sat Mar  3 22:16:37 EST 2007
*** Installing target libbfd       Sat Mar  3 22:18:10 EST 2007
*** Building target libbfd (fdpic) Sat Mar  3 22:18:11 EST 2007
*** Installing target libbfd       Sat Mar  3 22:19:44 EST 2007
*** Done                           Sat Mar  3 22:19:45 EST 2007

Ahhh… the pleasant feel of a clean compile. Thanks blackfin.uclinux.org developers!

If things didn't work for you look here for help : http://docs.blackfin.uclinux.org/doku.php?id=toolchain_build_script

Making a BF561 UART version of u-boot

Now to boot the board from UART0 using a UART compatible version of u-boot. To accomplish this we go into the u-boot source root directory and modify a file underneath this directory. Specifically, in the include/configs directory modify the file bf537.h or bf537-stamp.h in the following way :

to C files
//#define BFIN_BOOT_MODE          BF537_BYPASS_BOOT
#define BFIN_BOOT_MODE          BF537_UART_BOOT

Then execute the following commands from a shell

| Making u-boot UART loader
bash$>make mrproper
bash$>make bf537-stamp_config
bash$>make

If you run into trouble see the information here : http://docs.blackfin.uclinux.org/doku.php?id=compiling_u-boot

Once u-boot has compiled, a boot file u-boot.ldr will be created in the root of the u-boot source directory.

Booting your BF561 from UART (Finally)

- Turn the board ON 
- Issue the following command
| Loading u-boot from UART
~/bf537/u-boot/u-boot-1.1.6$ bfin-uclinux-ldr -l u-boot.ldr /dev/ttyS0 && minicom
Loading LDR u-boot.ldr ... 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 ... [1/2] [2/2] OK!
Sending blocks of DXE 2 ... [1/5] [2/5] [3/5] [4/5] [5/5] OK!
You may want to run minicom or kermit now
Quick tip: run 'ldrviewer <ldr> <tty> && minicom'
Connecting to /dev/ttyS0, 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
## Error: "ramboot" not defined
bf537>version
 
U-Boot 1.1.6-svn614 (ADI-2007R1-pre) (Mar  3 2007 - 22:41:36)
 
bf537>

If you run into trouble look here : http://docs.blackfin.uclinux.org/doku.php?id=loading_u-boot

Otherwise things must have worked. Great! Now we are running something on the board. But what are we doing? Now that we can boot the BF561-EZLITE board we really should run something useful on it. How about linux?

Setting up the ucLinux Distribution for your Target

We need to tell uclinux what type of board you have so that the system can be changed appropriately to your target. In this regard there are 5 files within the uclinux-dist source that need to be copied to strategic locations.

  • ./uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.arch ⇔ ./uClinux-dist/config.arch
  • ./uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.device ⇔ ./uClinux-dist/.config
  • ./uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.linux-2.6.x ⇔ ./uClinux-dist/linux-2.6.x/.config
  • ./uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.uClibc ⇔ ./uClinux-dist/uClibc/.config
  • ./uClinux-dist/vendors/AnalogDevices/BF537-STAMP/config.vendor-2.6.x ⇔ ./uClinux-dist/config/.config

Move these files into these locations to make your uclinux-dist customized for the BF537 target. More details on this are available here : http://docs.blackfin.uclinux.org/doku.php?id=managing_kernel_upgrades

Once these files have been moved make a backup copy of the directory.

  1. go to the uclinux-dist directory
  2. generate a symbolic link (similar to a shortcut) to the linux kernel source using the command ln -s ../linux-kernel linux-2.6.x
  3. go to the subdirectory vendors/AnalogDevices
  4. make a copy of the BF537-STAMP directory to BF537-STAMP-JFFS2 using the cp -R BF537-STAMP BF537-STAMP-JFFS2 command.
  5. cd BF537-STAMP-JFFS2
  6. cp config.arch ../../../config.arch
  7. cp config.device ../../../.config
  8. cp config.linux-2.6.x ../../../linux-2.6.x/.config
  9. cp config.vendor ../../../config/.config

I could not find a config.uClibc file initially in this directory. It may be automatically generated.

  • go to the uclinux-dist root directory
  • make menuconfig
  • Vendor Product Selection ⇒ Analog Devices Products ⇒ BF537-STAMP-JFFS2
  • Kernel/Library/Defaults Selection ⇒ Libc Version ⇒uClibc
  • Exit and save your changes
  • Make the system.

I have received the following error : bfin-uclinux-genext2fs: couldn't allocate a block (no free space) this occurs when you have run out of free space on your system. This means your kernel is too big. However, you can circumvent this problem for compilation, say if you want to boot from trivial ftp, by changing the BLOCKS variable in the file Makefile located in the vendors/AnalogDevices/BF537-STAMP-JFFS2 directory. For more information see : http://docs.blackfin.uclinux.org/doku.php?id=FAQ#i_get_errors_about_no_free_space

The built files are placed in the images subdirectory. These need to be moved into the TFTP directory to be downloaded to the host.

| copying linux images to the tftp directory
bash$> cp images/linux ../tftpboot/linux-bf537-1.00
bash$> cp images/uImage ../tftpboot/uImage-bf537-1.00
bash$> cd ../tftpboot; ln -s uImage-bf537-1.00 uImage

Flashing u-boot to the Board

Ok… now we go back to the u-boot files. Go to the u-boot/u-boot-1.1.6 directory. Now edit the file include/configs/bf537-stamp.h to be similar to this :

| bf537-stamp.h
#define BFIN_BOOT_MODE                BF537_BYPASS_BOOT
//#define BFIN_BOOT_MODE          BF537_PARA_BOOT
//#define BFIN_BOOT_MODE                BF537_UART_BOOT
//#define BFIN_BOOT_MODE                BF537_SPI_MASTER_BOOT

Also, save your previously built version of u-boot.ldr so you can use it to boot from serial whenever you need to.

| backup u-boot.ldr
bash$ cp u-boot.ldr u-boot-uart.ldr

Now rebuild a version of u-boot that will boot from a parallel (8-bit or 16-bit) flash as follows :

| build flash u-boot
bash$ make mrproper
bash$ make bf537-stamp_config
bash$ make

This time you want to use the u-boot.bin file. Take this file and place it in your tftp download directory.

| Copy the binary to the tftp directory
bash$ cp u-boot.bin /home/drew/bf537/tftpboot/u-boot.bypass.bin

Another path is to just download the u-boot compiled version u-boot_stamp537.bin available here http://blackfin.uclinux.org/gf/project/u-boot/frs

| Flashing with a precompiled uboot
bf537> version
 
U-Boot-1.1.3-ADI-R06R2 (Sep 21 2006 - 15:10:36)
 
bf537> setenv ethaddr 192.168.0.15
bf537> tftp 0x1000000 u-boot.bypass.bin
Using MAC Address 92:68:00:15:00:00
TFTP from server 192.168.0.2; our IP address is 192.168.0.15
Filename 'u-boot.bypass.bin'.
Load address: 0x1000000
Loading: ########################
done
Bytes transferred = 118912 (1d080 hex)
bf537> go 0x1000000
## Starting application at 0x01000000 ...
U-Boot 1.1.6-svn614 (ADI-2007R1-pre) (Mar  4 2007 - 16:57:11)
 
CPU:   ADSP BF537 Rev.: 0.2
Board: ADI BF537 stamp board
       Support: http://blackfin.uclinux.org/
Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz
SDRAM: 64 MB
FLASH:   4 MB
In:    serial
Out:   serial
Err:   serial
Net:    BF537 ETHERNET
I2C:   ready
Hit any key to stop autoboot:  0
bf537> version
 
U-Boot 1.1.6-svn614 (ADI-2007R1-pre) (Mar  4 2007 - 16:57:11)
 
bf537> protect off all
Un-Protect Flash Bank # 1
bf537> erase all
Erase Flash Bank # 1
Erasing Flash locations, Please Wait
.......................................................................
bf537> cp.b 0x1000000 0x20000000 0x1d080
Copy to Flash... .done
bf537> cmp.b 0x1000000 0x20000000 0x1d080
Total of 118912 bytes were the same

A victory! U-boot is now written to the flash! VERY IMPORTANT You no longer need to use the UART to boot. Put switch 16 (SW16) into position 0 to boot from your new u-boot based flash.

Now press the board reset button or cycle power to the board. You should see the board boot on its own with output from the serial port now. If so, congratulations, you now are booting from u-boot resident on the board flash memory, i.e., you have flashed your board.

Running Linux on your board

We will start by running linux through tftp. In this case we need to download the kernel image using tftp to the board memory and then execute the image. Here's an example :

Running Linux
bf537> setenv ethaddr 192.168.0.15
bf537> tftp 0x1000000 linux-bf537-stamp
Using MAC Address 92:68:00:15:00:00
TFTP from server 192.168.0.2; our IP address is 192.168.0.15
Filename 'linux-bf537-stamp'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #########################################
done
Bytes transferred = 10190745 (9b7f99 hex)
bf537> bootelf
Loading .text @ 0x00001000 (1114456 bytes)
Loading .init @ 0x00111158 (60980 bytes)
Loading .text_l1 @ 0xffa00000 (1572 bytes)
sh_addr: FFA00000, p_paddr: 0011FF8C
Loading from: 01120000 to 0011FF8C, size: 1572
Loading .data @ 0x001205b0 (201552 bytes)
Clearing .bss @ 0x00151900 (58952 bytes)
Loading .romfs @ 0x0015ff48 (8388608 bytes)
## Starting application at 0x00001000 ...
Linux version 2.6.16.27-ADI-2006R2 (root@sevens) (gcc version 4.1.1 (ADI 06R2)) #1 Tue Oct 31 11:03:40 6Blackfin support (C) 2004-2006 Analog Devices, Inc.
Compiled for ADSP-BF537 Rev. 0.2
Blackfin uClinux support by http://blackfin.uclinux.org/
Processor Speed: 500 MHz core clock and 100 Mhz System Clock
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
  text      = 0x00001000-0x00111158
  init      = 0x00112000-0x0011ff8c
  data      = 0x001205b0-0x00151900
  stack     = 0x00122000-0x00124000
  bss       = 0x00151900-0x0015ff48
  available = 0x0015ff48-0x03700000
  rootfs    = 0x03700000-0x03f00000
  DMA Zone  = 0x03f00000-0x04000000
Instruction Cache Enabled
Data Cache Enabled (write-through)
Hardware Trace Enabled
Built 1 zonelists
Kernel command line: root=/dev/mtdblock0 rw ip=192.168.0.15:192.168.0.2:192.168.0.1:255.255.255.0:BF537fConfiguring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 4096 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Physical pages: 3700
Memory available: 54400k/64382k RAM, (55k init code, 1088k kernel code, 57k data, 1024k dma)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin DATA_A SRAM: 16 KB
Blackfin DATA_B SRAM: 16 KB
Blackfin Instruction SRAM: 48 KB
Security Framework v1.0.0 initialized
Capability LSM initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin DMA Controller
stamp_init(): registering device resources
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
Real Time Clock Driver v1.10e
Dynamic Power Management Controller Driver v0.1: major=10, minor = 254
Blackfin BF5xx serial driver version 2.00 (DMA mode)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Blackfin mac net device registered
uclinux[mtd]: RAM probe address=0x3700000 size=0x800000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00800000 : "ROMfs"
uclinux[mtd]: set ROMfs:EXT2  to be root filesystem
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
IP-Config: Complete:
      device=eth0, addr=192.168.0.15, mask=255.255.255.0, gw=192.168.0.1,
     host=BF537, domain=, nis-domain=(none),
     bootserver=192.168.0.2, rootserver=192.168.0.2, rootpath=
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 52k freed (0x112000 - 0x11e000)
dma_alloc_init: dma_page @ 0x0011b000 - 256 pages at 0x03f00000
 
Welcome to:
       ____ _  _
      /  __| ||_|             _  _
 _   _| |  | | _ ____  _   _ \ \/ /
| | | | |  | || |  _ \| | | | \  /
| |_| | |__| || | | | | |_| | /  \
|  ___\____|_||_|_| |_|\____|/_/\_\
|_|
 
For further information see:
http://www.uclinux.org/
http://blackfin.uclinux.org/
 
 
 
BusyBox v1.00 (2006.10.30-05:34+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
 
root:~>

Ahhh… finally a linux prompt!

Modifying boot startup parameters

Now let's configure our boot environment to be compatible with our setup rather than typing things into u-boot constantly in order to get things loading. My first step is to set the ethernet ip address of the board.

| Setting the board IP address
bf537> setenv ethaddr 192.168.0.15
bf537> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
Erasing Flash locations, Please Wait
.
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
bf537>

Now setup u-boot to boot from the uncompressed tftp image on the host.

| Setting up automatic tftp boot
bf537> setenv boot-linux-stamp 'tftp 0x1000000 linux-bf537-stamp;bootelf'
bf537> setenv bootcmd run boot-linux-stamp
bf537> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
Erasing Flash locations, Please Wait
.
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
bf537> reset
U-Boot-1.1.3-ADI-R06R2 (Sep 21 2006 - 15:10:36)
 
CPU:   ADSP BF537 Rev.: 0.2
Board: ADI BF537 stamp board
       Support: http://blackfin.uclinux.org/
Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz
SDRAM: 64 MB
FLASH:   4 MB
In:    serial
Out:   serial
Err:   serial
Using MAC Address 92:68:00:15:00:00
Net:    ADI BF537 EMAC
I2C:   ready
Hit any key to stop autoboot:  0
Using MAC Address 92:68:00:15:00:00
TFTP from server 192.168.0.2; our IP address is 192.168.0.15
Filename 'linux-bf537-stamp'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #########################################
done
Bytes transferred = 10190745 (9b7f99 hex)
Loading .text @ 0x00001000 (1114456 bytes)
Loading .init @ 0x00111158 (60980 bytes)
Loading .text_l1 @ 0xffa00000 (1572 bytes)
sh_addr: FFA00000, p_paddr: 0011FF8C
Loading from: 01120000 to 0011FF8C, size: 1572
Loading .data @ 0x001205b0 (201552 bytes)
Clearing .bss @ 0x00151900 (58952 bytes)
Loading .romfs @ 0x0015ff48 (8388608 bytes)
## Starting application at 0x00001000 ...
Linux version 2.6.16.27-ADI-2006R2 (root@sevens) (gcc version 4.1.1 (ADI 06R2)) #1 Tue Oct 31 11:03:40 6Blackfin support (C) 2004-2006 Analog Devices, Inc.
Compiled for ADSP-BF537 Rev. 0.2
Blackfin uClinux support by http://blackfin.uclinux.org/
Processor Speed: 500 MHz core clock and 100 Mhz System Clock
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
  text      = 0x00001000-0x00111158
  init      = 0x00112000-0x0011ff8c
  data      = 0x001205b0-0x00151900
  stack     = 0x00122000-0x00124000
  bss       = 0x00151900-0x0015ff48
  available = 0x0015ff48-0x03700000
  rootfs    = 0x03700000-0x03f00000
  DMA Zone  = 0x03f00000-0x04000000
Instruction Cache Enabled
Data Cache Enabled (write-through)
Hardware Trace Enabled
Built 1 zonelists
Kernel command line: root=/dev/mtdblock0 rw
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 4096 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Physical pages: 3700
Memory available: 54400k/64382k RAM, (55k init code, 1088k kernel code, 57k data, 1024k dma)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin DATA_A SRAM: 16 KB
Blackfin DATA_B SRAM: 16 KB
Blackfin Instruction SRAM: 48 KB
Security Framework v1.0.0 initialized
Capability LSM initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin DMA Controller
stamp_init(): registering device resources
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
Real Time Clock Driver v1.10e
Dynamic Power Management Controller Driver v0.1: major=10, minor = 254
Blackfin BF5xx serial driver version 2.00 (DMA mode)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
Blackfin mac net device registered
uclinux[mtd]: RAM probe address=0x3700000 size=0x800000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00800000 : "ROMfs"
uclinux[mtd]: set ROMfs:EXT2  to be root filesystem
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 52k freed (0x112000 - 0x11e000)
dma_alloc_init: dma_page @ 0x0011b000 - 256 pages at 0x03f00000
 
Welcome to:
       ____ _  _
      /  __| ||_|             _  _
 _   _| |  | | _ ____  _   _ \ \/ /
| | | | |  | || |  _ \| | | | \  /
| |_| | |__| || | | | | |_| | /  \
|  ___\____|_||_|_| |_|\____|/_/\_\
|_|
 
For further information see:
http://www.uclinux.org/
http://blackfin.uclinux.org/
 
 
 
BusyBox v1.00 (2006.10.30-05:34+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
 
root:~>

Success. We now have a board which will boot to linux automagically! Now lets use tftp to boot from a compressed image.

| tftp boot linux from compressed image
bf537> setenv boot-linux-uImage 'tftp 0x1000000 uImage;bootm 0x1000000'
bf537> setenv bootcmd 'run boot-linux-uImage'
bf537> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
Erasing Flash locations, Please Wait
.
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors

Now our board will boot from a compressed image which is much smaller (3.2MB) than the uncompressed kernel image (~9MB). The boot process takes longer since the kernel image must be uncompressed into computer memory before being executed. If we are able to compress the kernel image to be small enough, we can also put the compressed kernel image in the flash. If this is accomplished, the board can boot ucLinux without any attached host, i.e., no tftp transfer to boot!

Some docs on this are here : http://docs.blackfin.uclinux.org/doku.php?id=loading_a_compressed_kernel_image

Some things I plan to work on in the future:

Frame Capture Device Notes

Running java on the blackfin

Blackfin Add-on Cards and JTAG systems

uCLinux Blackfin Projects

Advanced Topics on the Linux Kernel

This commentary is sort of old and at the time I didn't understand exactly how the system was built. However this is still here so that I can expand on this topic at a later time. One may test compilation of the kernel alone in this context apart from compiling the whole uclinux distribution so there is merit to having a separate kernel-related section.

My downloaded version of the linux kernel did not immediately compile. Instead, I needed to configure the kernel options that are appropriate for the BF537. The .config file in the linux-kernel directory determines the configuration options for the kernel. As I am not familiar with which options need to be set, I got the large majority of these settings from a previous configuration file provided as part of the uclinux-dist package. To get these settings go to the linux-kernel directory and issue the following command.

| Copy linux kernel configuration for the BF537
bash$ cp ../uclinux-dist/vendors/AnalogDevices/BF537-STAMP/config.linux-2.6.x .config

Note that this command was issued when I was in the root of the kernel source directory and a relative path to uclinux-dist directory was provided. Your paths may be different.

Go to the linux-kernel directory and configure your kernel to your desires.

| Configure the linux kernel
bash$> make clean
bash$> make 

When you provide the make command some additional prompts may come up. These are kernel options not specified within the configuration file. It is safest initially to just press Enter to adopt the default decision on these options.

The kernel will take some time to compile. Once it finishes compiling your output images are in the arch/blackfin/boot subdirectory. Below is commands to move these files to a trivial ftp directory to be placed on the target system.

| Copying the images to TFTP
bash$> cp arch/blackfin/boot/vmlinux.bin ../tftpboot/linux-bf537-1.00
bash$> cp arch/blackfin/boot/vmImage ../tftpboot/uImage-bf537-1.00

You will need this information for later : The default username for the Blackfin login is root and the password is uClinux.

If you want to change the config you can do this in several possible ways :

  • make config (most basic)
  • make menuconfig (better you need ncurses for this I think)
  • make xconfig (best – must have libqt2 I think)

Within these menus one may completely customize the kernel to add or remove functionality as is appropriate to their task at hand. The most important thing here is to ensure the target system is correctly set in the kernel configuration as is discussed here : http://docs.blackfin.uclinux.org/doku.php?id=basic_compilation.

Go to Blackfin Processor OptionsCPUBF537. This will make sure the kernel is compiled for the correct target. The default at the time of this build was the BF533. This being now done, you can make a simple kernel with no fancy customizations. You will probably re-do this step when you want to customize your application.

An Introduction to uClinux commands and memory structure for the Blackfin

Nano-X : An X-Windows-like Environment for embedded systems

blackfin/uclinux_bf561setup.txt · Last modified: 2009/10/07 17:57 (external edit)