This document should greatly aid you in getting ucLinux for the Blackfin BF537-EZLITE evaluation board up and running. This document proposes using the latest versions of the developed sources for both booting and running the board which usually means that the most recent drivers and other enhancements will be available. It also means that this wiki is likely to lapse in and out of verbatim accuracy as the latest versions of the software change. This wiki was last updated on March 5, 2007. Below are the steps which I needed to perform to get ucLinux running on my desktop Debian system. Results for you will vary, especially in terms of programs that you may have currently installed. So without further discussion, let's begin. — arwillis 2007/03/05 05:39
That's it, only three things to run uclinux. It is also a victory that we don't require a JTAG connector which is typically the case in programming embedded systems. I'm not a huge fan of the old and nearly defunct 9-pin serial cable. There is another way, 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.
Other things you will need
Good luck.
Go to blackfin.uclinux.org and register to the uclinux blackfin community.
I needed to install minicom, setserial and ckermit to talk to the BF537 through the serial port.
rootbash$> sudo apt-get install minicom setserial ckermit
I prefer minicom to ckermit so I set it up to communicate over the Blackfin serial port. This is done by running minicom and configuring the connection.
minicom
Ctrl-A
, lift your hands off the keyboard, then press Z
.A
to change the initialization and delete all the contents and press enter. Hit enter again to return to the configuration menu.A
and change the device name to the serial port you have connected to the Blackfin. This is typically /dev/ttyS0
or /dev/ttyS1
.E
to change the connection speed and protocol settings.H
to select 57600 bpsQ
to select 8-N-1 F
and G
(if necessary) to make sure hardware and software flow control are off
.Save setup a dfl
to preserve your changes as the default minicom setup.exit
If you have trouble running minicom. In debian the user accessing the serial port will need to be a member of the dialout group. You can make sure this is the case as follows (make sure you are root to do this) :
rootbash$> adduser drew dialout
UPDATE
You may want to use gtkterm for accessing the board. It seems to be more updated and, in particular, will work with USB→serial connectors as mentioned above. I had difficulties getting minicom and kermit working with a USB→serial cable.
rootbash$> sudo apt-get install gtkterm
My username is drew. Your username will likely be something different. Substitute appropriately through the entirety of this wiki.
After getting mostly through an initial configuration of this board, I found that I need the program bfin-uclinux-ldr to load u-boot, the bootloader, onto the BF537-EZLITE board. Yet, this program as of March 2, 2007 is only available in the latest versions of the toolchain which are only served from the source upon which the development team is currently working. To get it, I needed to install subversion.
rootbash$> sudo apt-get install subversion
Once you have obtained subversion, you can download the latest and greatest versions of all things relating to the Blackfin. This can be done using the following commands: The following commands get
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.
bash$> svn checkout http://www.visionlab.uncc.edu/svn/toolchain/trunk toolchain bash$> svn checkout http://www.visionlab.uncc.edu/svn/uclinux-dist/trunk uclinux-dist bash$> svn checkout http://www.visionlab.uncc.edu/svn/linux-kernel/trunk linux-kernel bash$> svn checkout http://www.visionlab.uncc.edu/svn/u-boot/trunk u-boot
If for some reason you can't get the sources locally from visionlab.uncc.edu, try the following commands :
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
At the time I did this I got the following versions :
“toolchain version 1488”
“uclinux-dist version 4995”
“linux kernel version 2793”
“u-boot version 614”
Getting the source this way takes ages (hours and hours), I will be setting up a mirror to help serve these files.
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.
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.
arwillis@visionlab03-pc:~/toolchain/buildscript$ ./BuildToolChain -p Check http://gcc.gnu.org/install/prerequisites.html for more information Can not find autoconf Can not find automake Can not find bison Can not find flex 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 Can not find m4 GNU Make 3.81 Can not find makeinfo Can not find msgfmt 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 /bin/sh: Illegal option -- Can not find runtest /bin/bash
Looks like I am missing a couple of needed tools to compile the blackfin tools. I install them the debian way below. I also need to install some C development pacakages as indicated in the blackfin uclinux wiki : http://docs.blackfin.uclinux.org/doku.php?id=installing_linux.
bashroot$> sudo apt-get install autoconf automake bison flex m4 texinfo dejagnu gettext gawk bashroot$> sudo apt-get install zlib1g-dev linux-libc-dev libc6-dev binutils-dev libqt3-mt-dev bashroot$> sudo apt-get install libncurses5-dev libgmp3-dev libgmp3c2 xvfb
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. This command will take about one hour (and 10 mins) to complete if successful.
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
Once you have built the toolchain you have a new set of binary programs to compile Blackfin specific programs. The programs are available in cvsoutput-uclinux, cvsoutput-elf, cvsoutput-linux-uclibc. You will need to add these programs to the system path such that when we try to execute programs such as “bfin-uclinux-gcc” (the Blackfin C compiler) this program will be found as available to run by the operating system.
bash$> vi ~/.bashrc Add the following line to this file export PATH=$PATH:$HOME/cvsoutput-elf/bin:$HOME/cvsoutput-linux-uclibc/bin:$HOME/cvsoutput-uclinux/bin
This will add the toolchain programs to the shell path each time a shell is created. You must now exit your running shell and perform the following test to ensure your modification was successful.
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 :
//#define BFIN_BOOT_MODE BF537_BYPASS_BOOT #define BFIN_BOOT_MODE BF537_UART_BOOT
Then execute the following commands from a shell
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.
~/bf537/u-boot/u-boot-1.1.6$ bfin-uclinux-ldr -l u-boot.ldr /dev/ttyUSB0 && gtkterm 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 I suggest you use gtkterm to operate the board, that will make life a lot more easier. when gtkterm pops up go to configuration look for port(it is the first one), click it and set port to /dev/ttyUSB0 set speed to 57600 and then click ok green button. go back to configuration find save configuration, click it and name it as default,then you are all set.
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 BF537-STAMP board we really should run something useful on it. How about linux?
Ok, now we want to run linux. To start, we will boot using u-boot and load the linux kernel from the host computer (your desktop). Some directions on this are here : http://docs.blackfin.uclinux.org/doku.php?id=setting_up_a_tftp_server. I had to deviate from these directions significantly to get this working in debian please find my deviations below.
Note that you want to start with this command to install your programs :
rootbash$> sudo apt-get install tftpd tftp openbsd-inetd
Getting tftpd to run right in ubuntu can be a bit tricky. Edit the file /etc/inetd.conf (root# sudo vi /etc/inetd.conf) and insert the following entry into the file:
tftp dgram udp wait root /usr/sbin/tcpd in.tftpd -s /tftpboot
Where /tftpboot is the location I plan on putting my kernel image file. This directory needs to be assigned special access privileges which may be set as follows :
bash$> sudo /etc/init.d/openbsd-inetd restart bash$> ps aux | grep inetd root 1898 0.0 0.0 1872 588 ? Ss 10:09 0:00 /usr/sbin/inetd arwillis 2270 0.0 0.0 2976 760 pts/0 S+ 10:11 0:00 grep inetd bash$> cd / bash$> sudo mkdir /tftpboot bash$> sudo chmod 777 /tftpboot bash$> sudo chown nobody /tftpboot
Then check it's runnning and working as specified here : http://docs.blackfin.uclinux.org/doku.php?id=setting_up_a_tftp_server See the parts that run commands similar to those below.
bash$ netstat -l -u Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 *:32768 *:* udp 0 0 *:32769 *:* udp 0 0 *:bootpc *:* udp 0 0 *:tftp *:* udp 0 0 *:sunrpc *:* udp 0 0 *:ipp *:* udp 0 0 *:1016 *:* bash$ cat 'adkkfjasdlf' > /tftpboot/foo bash$ tftp -v localhost tftp> get foo tftp> quit :~/bf537$ ls -al foo -rw-r--r-- 1 drew drew 11 2007-03-04 00:05 foo
Ok, everything looks good for the TFTP server now this will be used more later.
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.
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.
ln -s ../linux-kernel linux-2.6.x
I could not find a config.uClibc file initially in this directory. It may be automatically generated.
make menuconfig
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.
bash$> cp images/linux ../bf537/tftpboot/linux-bf537-1.00 bash$> cp images/uImage ../bf537/tftpboot/uImage-bf537-1.00 bash$> cd ../bf537/tftpboot; ln -s uImage-bf537-1.00 uImage
Connect to the Blackfin board again through the serial cable. Now set some environment variables by executing the following commands on the board :
bf537> setenv bootcmd run tftp_boot bf537> setenv ethaddr 192.168.0.15 bf537> setenv tftp_boot 'tftp 0x1000000 uImage;bootm 0x1000000; echo' bf537> setenv stdin serial bf537> setenv stdout serial bf537> setenv stderr serial
Where 192.168.0.15 is the address of my host or desktop machine on the local network and I have plugged the ethernet cable into a router.
I then take a compiled linux kernel and place it in the TFTP server file directory (where I had created foo). I then attempt to boot. However, I believe I have not set a filename environment variable to boot from. Hence, the default file name is assumed to be “C0A8000F.img”. Hence, I create a symbolic link (for now) from my file to this filename.
arwillis@ece-vision1-pc:~/bf537/tftpboot$ ls C0A8000F.img linux-bf537-1.00 uImage uImage-bf537-1.00 vmlinux drew@hendrix:~/bf537/tftpboot$ ln uImage C0A8000F.img
Now the image may be downloaded.
bf537> setenv ethaddr 192.168.0.15 bf537> tftp 0x1000000 uImage Using BF537 ETHERNET 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 = 3403458 (33eec2 hex) bf537> bootm 0x1000000 ## Booting image at 01000000 ... Image Name: uClinux Kernel and ext2 Image Type: Blackfin Linux Kernel Image (gzip compressed) Data Size: 3403394 Bytes = 3.2 MB Load Address: 00001000 Entry Point: 00001000 Verifying Checksum ... OK Uncompressing Kernel Image ...
Great. Now we have a boot loader and have a host⇒client transfer of the linux kernel image from the desktop to the board configured. Now lets try a delicate part. Flashing the boot loader to the board memory.
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 :
#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.
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 :
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.
bash$ cp u-boot.bin /home/arwillis/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
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)(---size of the file) 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 (0x1d080 is the size of file u-boot.bypass.bin, yours may be different, you can find it) 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.
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 :
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!
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.
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.
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.
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:
A web link on frame capture. http://docs.blackfin.uclinux.org/doku.php?id=frame_capture_device More info here : http://www.embedded.com/columns/showArticle.jhtml?articleID=185300537
Add links to these here.
Compact Flash Purchase Location :http://www.schmartboard.com/index.asp?page=products_analog&id=99
Driver Documentation : http://docs.blackfin.uclinux.org/doku.php?id=compactflash_ide_ata_nand_flash_-_interface_card
JTAG http://docs.blackfin.uclinux.org/doku.php?id=debuggers#debugging_via_jtag_gdbproxy Work on the FPGA-EZExtender kit http://docs.blackfin.uclinux.org/doku.php?id=fpga_ez-lite_kit
There is a good list here : http://docs.blackfin.uclinux.org/doku.php?id=projects
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.
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.
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.
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 Options
⇒ CPU
⇒ BF537
. 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.
http://docs.blackfin.uclinux.org/doku.php?id=microwindows&s=windows
Well, one may also download pre-compiled kernels available here : https://blackfin.uclinux.org/gf/project/uclinux-dist/frs
follow the webiste instructions http://docs.blackfin.uclinux.org/doku.php?id=mmc_driver&s=mmc
remember to change mmc to spi_mmc remove other drivers when building kernel which may effect the spi mmc card driver
running a filesystem in mmc following this website instruction http://www.vpx.nu/dokuwiki/doku.php?id=mmc_sd_configuration some important modifications
filesize star add and end add are important 24 01 minor number has to be changed, need copy vmlinux instead of uImage
finally env looks like that
bootdelay=5 baudrate=57600 loads_echo=1 autoload=no rootpath=/romfs hostname=BF537 loadaddr=0x1000000 ramargs=setenv bootargs root=/dev/mtdblock0 rw console=ttyBF0,57600 nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) console=ttyBF0,57600 addip=setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):eth0:off ramboot=tftpboot $(loadaddr) linux;run ramargs;run addip;bootelf nfsboot=tftpboot $(loadaddr) linux;run nfsargs;run addip;bootelf update=tftpboot $(loadaddr) u-boot.bin;protect off 0x20000000 0x2007FFFF;erase 0x20000000 0x2007FFFF;cp.b 0x1000000 0x20000000 $(filesize) ethact=BF537 ETHERNET ethaddr=192.168.0.15 boot-linux-uImage=tftp 0x1000000 uImage;bootm 0x1000000 mmcboot=tftpboot 0x01000000 vmlinux; run mmcargs; run addip; bootelf mmcargs=setenv bootargs root=2402 rw bootcmd=run flashboot flashboot=run mmcargs; run addip; bootelf 0x20040000 filesize=1f2de7 fileaddr=1000000 gatewayip=192.168.0.1 netmask=255.255.255.0 ipaddr=192.168.0.15 serverip=192.168.0.2 bootargs=root=2402 rw ip=192.168.0.15:192.168.0.2:192.168.0.1:255.255.255.0:BF537:eth0:off stdin=serial stdout=serial stderr=serial