Address: http://linuxgazette.net/123/jesslyn.html
Intel and Analog Devices Inc. (ADI) jointly developed the micro signal architecture (MSA) core and introduced it in decemberof 2000. adi's Blackfin Processor functions as a DSP and a microcontroller. this device is currently
Used for multimedia applications.
This article provides an introduction to programming the BF533 stamp Board and is intended for readers with some experience in Linux as well as with embedded devices. It contains a basic description of using the board for embedded
Programming as I have done without any problem.
BF533 stamp
The stamp board features:
- ADSP-BF533 500 MHz Blackfin Processor
- 128 MB SDRAM
- 4 MB flash memory
- 10/100 Ethernet controller
- RS232 serial interface
- JTAG interface for debugging and flash Programming
- I/O connectors for Blackfin peripherals:
- PPI
- Sport0 & sport1
- SPI
- Timers
- IRDA
- Twi
The BF533 stamp runs uClinux-a Linux port for embedded devices. It has soft real-time capabilities, meaning that it cannot guarantee a specific interrupt or schedlatlatency.
The stamp board has been specifically designed to support the development and porting of Open Source uClinux applications and between des the full complement of memoryalong
With serial and network interfaces. the stamp uClinux kernel board support package (BSP) between des a CD with a recent copy of the open source development tools, the uClinux kernel, and the documentation. for more details visithttp: // blackfin.uclinux.org.
UClinux
The uClinux kernel provides a hardware action layer. The uClinux application programming interface (API) is identical for all processors which support uClinux, allowing code to be easily ported to a different processor core.
When porting an application to a new platform, programmers only need to address the areas specific to a particle processor-normally, this means only the device drivers.
Getting started
We have to note the following components of our development board:
- An Ethernet controller (with an RJ45 Ethernet Jack)
- A serial port (DB9 serial connector-female)
- A power Jack
The development workstation is essential a Linux box which shold have
- An available serial port
- Terminal emulator Software
- An Ethernet Card
There are two potential interconnections between the workstation and the target:
- The 10 Mbps Ethernet connection
- The RS232 serial interface
Connecting the hardware
- Connect the serial port to your host computer from the stamp Board
- Connect the ethernet cable to your network card of your Linux box (use a straight cable with no cross connections)
- Start the terminal emulation program. minicom is an example of such a program, and is supported in most Linux distributions. At the bash prompt type the following command as root:
bash# minicom -m -s /dev/ttyS0
From the configuration menu within minicom, set the serial port connection
- 57600 baud
- 8 data bits
- Parity none
- 1 stop bit
- H/W flow control off
Now save the configuration and choose exit.
- Connect the DC power cord and power up the board
- After the stamp board powers up, You shoshould see a u-boot start-up screen in your terminal window. at this stage, if you allow the boot timer to count down, the Board will load the uClinux kernel from flash memory and boot it,
Finally resulting in a command prompt.
GNU/Linux tool chain for the Blackfin Devices
Install the binutils and the GCC tools on your machine:
[Note: 'rp' is RedHat-specific. use the appropriate package manager for your distribution to install the latest 'bfin-GCC 'version; if your distribution does not have one, use the 'alien' utility to convert
This RPM to your required format. -- Ben]
bash# rpm -ivh bfin-gcc-3.4-4.1.i386.rpm
You may not find the same version of GCC tools on the CD. I had to download the latest version since the one provided with CD did not contain the required tools (e.g ., the C compiler for building programs on uClinux .) you may
Download the RPM from here. Or you can visit the blackfinwebsite
To download the toolchain yourself.
In user mode, export the path for the tools:
bash# export PATH=/opt/uClinux/bfin-elf/bin:/opt/uClinux/bfin-uclinux/bin:$PATH
Installing the uClinux kernel
- Copy the kernel source from the CD to your work directory
- Uncompress the kernel source
bash# bunzip2 uClinux-dist.tar.bz2
tar -xvf uClinux-dist.tar
Now that the kernel is uncompressed in the work directory, you are ready to start building your own uClinux kernel for the Blackfin Processor.
Simple 'Hello world' Application
Traditionally, development environments and programming versions have always begun with the 'hello world' program; we'll follow the precedent.
Copy the following into a file called 'hello. C ':
#include<stdio.h>int main() {printf("Hello, Welcome to Blackfin uClinux!!\n");return 0;}
The next step is to compile 'hello. c' on you host PC:
bash# bfin-uclinux-gcc -Wl,elf2flt hello.c -o hello
The resulting executable is namedHello.
Note thatBfin-uClinux-gccCompiler is used; this compiler is used to compile programs that run on the uCLinux operating system. It automatically links our program with the uClinux run time libraries, which
In turn call the uCLinux operating system when required (for example) to print to the console. The Compiler Collection for the Blackfin Processor also has des another compiler,Bfin-elf-gcc, Which is used to compile the actual uCLinux operating
System and uses a different set of libraries. If you want to try porting other rtoss to Blackfin, you will have to useBfin-elf-gcc.
Now we need to set up the Ethernet port on the Linux box; we'll set its IP address to 192.168.0.2. after booting the uClinux kernel on the stamp board, you will have to configure its Ethernet interface as well; At the bash prompt
Of the stamp, type the following:
root:~># ifconfig eth0 192.168.0.15 up
At this point, the Ethernet link should be up. we can use ftp to upload the 'hello' program from the host to the board. at the bash shell prompt of the Linux workstation type the following:
bash# ftp 192.168.0.15
Give the username and passwordRootAndUClinux. Send the 'hello' executable to the stamp board.
Now modify the permissions and run:
root:~> chown 777 helloroot:~> ./helloHello, Welcome to Blackfin uClinux!!
Segmentation faults
The Blackfin Processor does not have an MMU, and does not provide any memory protection for programs. This can be demonstrated with a simple program:
// test.cint main (){int *p;*p=5;}
Compile 'test. c' using our native C compiler. Try to run the resulting executable, and you'll end up with a segmentation fault.
Now, compile the program using 'bfin-uClinux-GCC 'as I described above. Send the executable to the stamp board using FTP, change the file permissions, and run it.
This time, it shoshould run without a segmentation fault. due to this, an unprivileged process can cause an address error, can upload upt kernel code, and result is obvious. this is not a limitation of the Blackfin architecture,
Simply demonstrates that uClinux is designed to support devices without an MMU.
End of Part I
This is all I know well about uClinux on Blackfin. I have to look deeper into uClinux and I shall try to include more next time!
References
For more information, please visit http://blackfin.uclinux.org.