Thursday, January 31, 2008

Compiling the Kernel for BF537

BF537 STAMP board has buttons and LEDs provided to be accessed by software for testing purpose. In order to do that is required to have customized kernel image. Default image for BF537 has no driver for such operations.

Source code for uClinux kernel could be downloaded from blackfin site. There are an easy way to uncompress it by just right click on a file in SUSE File Browser and selecting Extract Here. Lets open this folder and configure blackfin toolkit used for kernel compilation. Details on how to do that is provided in previous post.

Next command in terminal window will invoke kernel configuration utility.

make menuconfig

Choosing BF537-STAMP in Vendor/Product Selection will produce kernel for BF537. It is important to do that, otherwise kernel image will halt on boot up execution.



Ability to add required driver is provided with selection of Customize Kernel Settings (NEW):

Kernel/Library/Defaults Selection.
Device Drivers --->
Character devices --->
[*] Blackfin BF53x Programmable Flags Driver


Exit and saving configuration will bring back the terminal console. Executing next commands will reset cached objects and make a new kernel image:

make clean
make

The compilation process will take time and could last for about 30 minutes. BF537 U-Boot loader has a nice feature of loading kernel from a network over tftp. SUSE YaST in a few steps allows to configure TFTP server and then copy kernel image into server folder with File Browser.

Now let’s jump to Windows XP host environment and start HyperTerminal application.


For tftp command to work is necessary to configure BF537 U-Boot environment with ipaddress for tftp server and BF537. Saving environment settings into flash memory is an optional step. After that is loading kernel image to memory and booting uClinux.

BF537> setenv ipaddr x.y.z.n
BF537> setenv serverip x.y.z.m
BF537> saveenv
BF537> tftp 0x1000000 linux
BF537> bootelf 0x1000000

Now everything is ready to run test application on a custom kernel image. Source code for button test application could be found in user\blkfin-test\pflags-test subfolder where kernel was compiled. Check my previous post on how to compile and download application into BF537.

Wednesday, January 23, 2008

Hello World under uClinux

Let's test Hello World application compiled in previous post under uClinux. There are many ways how to copy application file into BF537 board and one of them with help of wget command by downloading file over HTTP protocol.

This command will communicate with web server installed on development platform. Ethernet connection between board and computer is necessary.

YaST allow an easy way to verify that HTTP server is enabled and take a look on my previous post on how to configure Linux SUSE to be development platform for BF537.

Then application file has to be placed into web server working folder. That could be done from command line as well by using Cut and Paste file operation.

cp ./hello /srv/www/htdocs/hello

The natural way of running BF537 under Windows XP is with use of HyperTerminal application and serial cable. Connection setting could be found on support site. After powering up board next text will be shown in terminal window:

With DHCP server available board's network settings could be configured by:

root> dhcpcd &

Next commands will do switch to tmp folder as preferable place for this application, download file from web site, permission modification that allows program to be executed and finally now is possible to execute Hello World application

root:~> cd /tmp
root:/tmp> wget http://yourwebserver/hello
root:/tmp> chmod 777 hello
root:/tmp> ./hello

Wednesday, January 16, 2008

First program for BF537 STAMP board

BF537 STAMP board is possible to buy from Digi-Key. That is a nice board with a plenty of possibilities to create a handy functionality. I just recently got one as well. My board has newer version of software that could be found on companion CD which is dated as 2005 release, but everything could be downloaded from support web site. This wiki style site looks fresh and written for creative people, check remark about documentation.


Today’s laptops or PC are quite powerful devices and capable to run multiple OS at same time by using virtualizing software. This allows of choosing Linux as development platform even if main platform is Windows XP. Check my older post on how to install SUSE 10 on Virtual PC. One of advantage of this approach is to have less hardware on a desk and more time for development.

The STAMP board is a part of the Blackfin/uClinux open source project, and the good thing that schematics for the board available as well. Board could be accessed through serial cable by using terminal window. It has an Ethernet interface, six general-purpose LEDs and four general purpose push-buttons available for quick start hardware control programming.

To be ready for development is necessary to verify number of tools to be installed on development platform. Full list of applications could be found on support site and one of them is gcc compiler. These applications are part of a standard SUSE 10 distribution. Next in a list is latest blackfin-toolchain-07r1.1-3.i386.rpm package from Blackfin support site. Double clicking an RPM file will bring up a graphical front end for installing RPM's. Under SuSE Linux 10 this front-end is provided through YaST2.



After installing the Blackfin tool chain the environment variable PATH must be modified to include the directory where the Blackfin tool chain is installed. It could be done in File Browser by selecting File->Open In Terminal and typing next command line:

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

At this point everything is ready for a hello world application:

#include <stdio.h>

int main() {
      printf("Hello, World\n");
      return 0;
}

Next command line will compile this file:

bfin-uclinux-gcc -Wl,-elf2flt hello.c -o hello

The output executable is 'hello' file in flat format, also it creates a file “hello.gdb” which is used for debugging. Check my next post for details on how to run this program on BF537 board.

Wednesday, January 9, 2008

SUSE Linux Desktop on Virtual PC


Jump from Windows into Linux world right away could be a big challenge. To make this smooth as possible is better to have somewhere Linux environment to play. For this task Virtual PC is a handy tool. Virtual PC 2004 SP1 is a free virtualization suite available for download from Microsoft. It runs on Windows 2000 and XP. Virtual PC 2007 is available for Windows Vista.

First step is to install Virtual PC.

Next step is to grab Linux distribution. Lets go to Novell Downloads and select SUSE Linux Enterprise Desktop 10. It is available as DVD or set of 5 CDs.

"SUSE Linux Enterprise Desktop is the most interoperable Linux desktop available today. It works seamlessly with Novell GroupWise® and Microsoft Exchange collaboration servers, and it will connect to Lotus Notes and IBM* Notes plug-in for Workplace client technology. It is also fully compatible with Microsoft Active Directory* and other networking and directory standards."

Now is possible to create a virtual machine. Following wizard select “Other” as Operating System, adjust RAM to 256 MB, and create a new virtual hard drive.

Then start this virtual machine. Under CD menu select Capture ISO image and browse for SUSE Linux Enterprise Desktop ISO image.

Complete installation procedure and start using Linux SUSE Desktop. As additional optional step I do recommend to change Display settings and use for monitor 1280x1024 and for resolution 1152x864.