world leader in high performance signal processing
Trace: » boa

ADSP-BF548 EZ-KIT Quick Start: Peripheral Demos: boa


What is boa

This demo is a cgi application that can be run by the built-in Boa web server. Boa is a light weight httpd server that can run on uClinux. This demo will use that web server and have it run a simple cgi hello world script that will let you see how the Blackfins networking support allows it to host dynamic web pages. Later in the tutorial sections there is a TCP Server application that can demonstrate how the Blackfin has standard inet support.

Note that the kernel option 'Device Drivers > Network device support > Ethernet (10 or 100Mbit) > SMSC LAN911x/LAN921x families embedded ethernet support' must be enabled for this to work.

The application option 'Network Applications > boa' must be enabled.

Download boa

The demo comes with the customised Ubuntu ISO and can be found in the folder /home/Blackfin/demos. Alternatively it is already installed on the demo uClinux image (demo-uclinux.img) that you can get on ADSP-BF548 EZ-KIT Quick Start: Booting uClinux.

If you just want to download the demos on their own and get their source code you can download the compressed archive (demos-R1.tar.gz) here bf548-quick-start .

How to run the boa program

  • Copy /demos/web/hello.cgi to /home/httpd/cgi-bin/hello.cgi

    cp /demos/web/hello.cgi /home/httpd/cgi-bin/hello.cgi
  • Make sure your board has a network connection and an IP address. To enable a connection direct to your development machine (static IP) use the following command where is the IP address you want to give the board and is the subnet mask:

    root:/> ifconfig eth0 netmask up

    If you do this, make sure to manually set an IP address for your host PC as well.

    If you are connecting directly to a router and want to use DHCP to get an IP address (preferable), use the following command:

    root:/> dhcpcd &

    The wiki page setting_up_the_network shows further configuration options.

  • Check the IP address is set correctly by running ifconfig eth0

    root:/> ifconfig eth0
  • Once that is done, use the following to copy the hello world script to the cgi-bin of Boa and to boot Boa with its default configuration located in /etc.

    root:/> cp /demos/web/hello.cgi /home/httpd/cgi-bin/hello.cgi
    root:/> chmod +x /home/httpd/cgi-bin/hello.cgi
    root:/> boa -c /etc
    root:/> [02/Jan/1970:03:08:36 +0000] boa: server version Boa/0.94.14rc21
    [02/Jan/1970:03:08:36 +0000] boa: server built Nov 29 2012 at 12:10:16.
    [02/Jan/1970:03:08:36 +0000] boa: starting server pid=514, port 80

If you are having trouble setting up the network connection, visit this page setting_up_the_network to get further tips and debug information.

How the boa webserver demo works

The boa web server is just an application built in by default into uClinux. We use this web server to host our demo cgi application. This cgi application will print out a web page and a random number in the content.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void) 
  int r = 0;

  // Print HTTP header
  printf("Content-Type: text/html;charset=us-ascii\n\n");

  // Generate a random number to demonstrate this is live
  r = rand();

  // Print page content
  printf("<title>Hello World Page!</title>\n");
  printf("Hello World! %d\n", r);

  return 0;

This is just a very basic cgi script, using C. You can port microperl and php across to uClinux if you need to (note that the full verison of perl that is in the uClinux configuration gui under Miscellaneous Applications > Perl is not able to be run on Blackfin uClinux) build fancier cgi applications. This script just shows it is possible to run live programs as cgi with boa.

The configuration file for boa is /etc/boa.conf and each configuration option is self explanatory (there are options even to allow cgi applications to execute from anywhere).

Compiling cgitest demo

Make sure your vendor staging install is complete (ADSP-BF548 EZ-KIT Quick Start: Compiling uClinux).

root:/> make vendor_staging_install

Run the following compile command in the same directory as the source code:

root:/> bfin-linux-uclibc-gcc -O2 hello.c -o hello.cgi

What this compile command is doing is it is calling the uclibc cross compiler that is set up from the Blackfin toolchains to compile our application.

The final parameters match up to standard gcc compiling, “hello.c” is the source file and ”-o hello.cgi” indicates the output file is “hello.cgi”.

A standard make file is accompanies this demo and you can run that by simply calling

root:/> make cgitest

Further Reading

If you are having trouble setting up the network connection, visit this page setting_up_the_network to get further tips and debug information.

Running a web server isn't the only networking application possible on the BF548 EZ-KIT. It can perform any networking application that standard Linux can perform, including TCP servers/clients, UDP servers/clients and any inet functions. More on this in the cross compiling tutorials.

There is a page in the wiki demonstrating even using shell scripts to run a cgi application with boa: cgi_hello_world

A port for PHP has been done previously, although it is not a full version of PHP, information can be found here

If you are interested in the network drivers themselves, the wiki page Network Device Drivers discusses them.