Monday, January 21, 2008

Blackfin Processors

Blackfin processors from Analog Devices provide microcontroller(MCU) and signal processing functionality in the same architecture. So, it is something which can act like a microcontroller or DSP or can utilize the advantages of both. It can act as 100% Microcontroller or 100% DSP. Blackfin integrates 32-bit RISC instruction set( For MCU) and 8-bit video instruction set( For DSP applications) with 16-bit MAC units. MAC stands fro Multiplier And Accumulator. The basic action going on in any DSP applications is Multiply some signal samples( audio , video..) with calculated coefficients and Add all that results to get the output signal.

Blackfin features include high-speed memory and high-speed peripherals including 100 Mbps Serial Ports, parallel peripheral interface (PPI) , UART with IrDA support, SPI port , JTAG interfaceand an external memory interface. We can select one of the blackfin processors/boards from the selection table of analog.

Blackfin selection table is available here : http://www.analog.com/processors/blackfin/overview/IST.html

The BF537 STAMP board is the easiest way to get started with Blackfin processors. But it is not available in Arrow Electronics( Distributor of Analog Device parts), India. It cost around 200$.
Have to check with one of these distributors in India.

http://www.analog.com/salesdir/countries.asp?regionID=2&countryID=95

Two Good tutorials for getting started with Blackfin are

1. http://my.analog.com/onlinetraining/Static/BOLDList.html
2. http://docs.blackfin.uclinux.org/doku.php?id=introduction

uclinux is the most popular OS used with Blackfin. The simple reason is Blackfin processor does not have MMU and uclinux is a Linux version for processors without MMU. Linux can be used as the development environment for the Blackfin.The basic tool chain and the kernel compilation procedures are available from http://docs.blackfin.uclinux.org/doku.php?id=introduction

The procedure for Downloading the uclinux kernel to the board and some simple examples are well explained in http://linuxgazette.net/125/pramode.html

Building a cross compiler for AVR Microcontrollers

Why we need a cross -compiler? Cross-compilers enable us to develop on one platform( host) while actually building for another platform( target). For building this what we need is a compiler that knows how to write machine code for our target.

Giving a basic introduction about what compiler does, what are the components of a compiler it will be easy to understand the build process. The basic goal of a compiler is to produce the bytecode for target CPU or microcontroller. The main components of a compiler are

parser: converts the language source code (eg: C, C++) into the target assembly langauge. So, Parser needs to know the target assembly langauage.

Assembler: converts the assembly language code into the bytecode (object file) that the CPU executes.

Linker: combines the object files into an executable application. Different operating system and CPu combinations generally use different encapsulation mechanism.
Eg: Executable Link Format(ELF) - usually used by PowerPC processors.

Standard C Library: If we are using functions from the C library( eg, printf) , we have to use some standard C library. Newlib and Glibc are the most common one. Newlib was developed by redhat and Glibc is GNU C library.

So, we need to build three components from the GNU tools available.

1. Binutils - includes the basic binary utilities such as the assembler, the linker, the strip utility etc..Strip utility is used for removing the unwanted information from object file and executable such as symbol table, debugging information.

2. GCC - have C preprocessor and assembly translator.

3. glibc or newlibc

Now, we can start building the cross compiler for AVR. For that first we have to create an installation folder in our linux system. We can use /usr/local/AVR

Now go to this link : http://www.nongnu.org/avr-libc/user-manual/install_tools.html

Downlaod the Binutils source, GCC source and AVR Libc source(Three Zip files )from the links provided there to /usr/local/AVR folder. Untar that Zip in the same folders. Now you will get 3 folders inside the /usr/local/AVR

binutils-x.xx
gcc-x.x.x
avr-libc-x.x.x

I used the following versions:
binutils-2.15, gcc-2.7.3, avr-libc-1.0.5. Now build the three components as explained below.

Build the Binutils:

Execute the following commands in the shell prompt to install the Bintuils for AVR.
configure -
Configure the build for AVR and specify the bin directory or install directory.
make - compile the code.
make install - Install in /usr/local/AVR/bin


$ cd binutils-2.15
$ ./configure --prefix=/usr/loca/AVR --target=avr
$ make
$ make install

The /usr/local/AVR/bin directory now contains AVR versions of ld, as, ar and the other binutils executables. Add the /usr/local/AVR/bin directory to your PATH now. You can apply the modification system-wide by adding:

PATH="$PATH:/usr/local/AVR/bin" to the /etc/profile file.

Build the GCC:

$ cd gcc-2.7.3
$ ./configure --prefix=/usr/loca/AVR --target=avr --enable-languages="c,c++" --disbale-nls
$ make
$ make install

Build the AVR Libc:

$ cd avr-libc-1.0.5
$ export PREFIX=/usr/local/AVR
$ sh ./doconf
$ ./domake
$ cd build
$ make install
So, we have installed the avr-gcc cross compiler for the AVR series microcontrollers succesfully..!!

Now after verifying that the PATH variable"/usr/local/AVR/bin" is set system wide( means from anyfolder we can use the avr-gcc and binutils tools), we can start compiling C and C++ files for the AVR.

Sunday, January 20, 2008

On Target : Embedded system , DSP and Linux

I am starting this blog
. To write about basics of Embedded system, DSP and Linux.
. To share good readings in these fields.
. To write about advanced developments in 3 fields.
. For my own reference of Infomation and related links.
. To share my experiences with embedded boards, hobby circuits and different Simulators.

I am not an expert in these fields. But i am a regular reader of these subjects and i like to do something interesting in these fields. Writing a technical blog need some research compared to writing personal blog. So, it is a good way to learn new stuffs.

Expecting valuable and thoughtful comments from all the readers.