Saturday, February 16, 2008

Install eCos on Ubuntu

Here are some steps to set up eCos on Ubuntu 7.10. I referred to the link of
http://psas.pdx.edu/CapstoneLV2bProjectReport/Software. But not every step
are followed exactly. Here is the steps that I tried out successfully.

1. Follow the instructions in the section of eCos of the following web page:
http://ecos.sourceware.org/getstart.html

2. Set up the environment by sourcing the bash script of ecosenv.sh.

3. Install two prerequisite packages of libpng3 and libtiff4. Otherwise, running the configtool of eCos will have the following errors:
configtool: error while loading shared libraries: libpng.so.2: cannot open shared object file: No such file or directory.
and
configtool: error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory

a. Run "sudo apt-get install libpng3" and "sudo ln -sf /usr/lib/libpng.so.3 /usr/lib/libpng.so.2" to eliminate the error related to libpng.so.2.
b. Run "sudo apt-get install libtiff4" and "sudo ln -sf /usr/lib/libtiff.so.4 /usr/lib/libtiff.so.3" to eliminate the error related to libtiff.so.3

4. Go to the directory where eCos-2.0 locates. Check out the latest eCos repository by:
cvs -z3 -d :pserver:anoncvs@ecos.sourceware.org:/cvs/ecos co -P ecos

5. Set the environment so that ECOS_REPOSITORY points to the packages of the CVS repository by running "export ECOS_REPOSITORY=$cvs-eCos/packages".

6. Get the patch with support for LPC2148 in this link http://sourceware.org/ml/ecos-patches/2005-11/msg00014.html
and patch it via "patch -p1 <>"Template" and select "Hobby-Robotics iH
1_proc_lpc_1 board" in the first drop down box in the pop-up dialog and click
"OK".

8. Get the software to run on lpc2148 via the link of lpc2148 ecos.tgz, and exact it. A directory of lpc2148_ecos will be created.

9. In the directory of gnutools/arm-elf/bin, create symbolic links of arm-linux-gnu-ar, arm-linux-gnu-as, arm-linux-gnu-gcc and arm-linux-gnu-objcopy
which links to arm-elf-ar, arm-elf-as, arm-gcc and arm-objcopy respectively. These
links will be used during step 10.

10. Go to the directory of lpc2148_ecos and run the tool of configtool. Open the file of lpc2148_rom.ecc. Click "Build"=>"Generate Build Tree". After it completes, click "Build"=>"Build Library" to compile the library.

11. In the directory of lpc2148_ecos, compile the eCos demo by
make INSTALL_DIR=$lpc2148_ecos_dir/lp2148_rom_install.
Blinky.hex will be generated.

12. Flash the Blinky.exe to the lpc2148 eval board + quick start board via lpc21isp, the leds corresponding to pin 0.10 and pin 0.11 will be on. The blinky.c
in the directory of lpc2148_ecos can be changed and recompiled to turn on other leds.