Showing posts with label eCos. Show all posts
Showing posts with label eCos. Show all posts

Tuesday, March 23, 2010

How to build eCos 2.x applications for ARM platform

In Fedora Core 8, Fedora Core 9

Install toolchain for eCos
[ ]# /opt/gnutools/

Build eCos complete process

  1. select template
  2. adding package
  3. editing configuration
  4. build tree
  5. build library
  6. build application 

Compile ecosconfig
[ ]# cd /home/eCos/ecos-starsemi    ; ECOS_ROOT_DIR = /home/eCos/ecos-starsemi
[ ]# mkdir -p ecos-host
[ ]# cd ecos-host

[ ]# CC=gcc CXX=g++ ../ecos-2.0/configure --with-tcl=/usr/bin/tclsh --prefix=/usr/lib --host=i686-linux-gnu --with-tcl-version=8.5
[ ]# make CFLAGS="-march=i686" CXXFLAGS="-march=i686"


Compile eCos
[ ]# source ecosenv.sh    ; set some environment variables for eCos
[ ]# ecosconfig list    ; support list

[ ]# cd $ECOS_ROOT_DIR
[ ]# mkdir ecos-build
[ ]# cd ecos-build

[ ]# ecosconfig new str81xx
[ ]# ecosconfig resolve
[ ]# ecosconfig check
[ ]# ecosconfig tree
[ ]# make

Compile eCos Application - Hello World
[ ]# cd $ECOS_ROOT_DIR    ; ECOS_ROOT_DIR = /home/eCos/ecos-starsemi
[ ]# mkdir hello_kernel
[ ]# cd hello_kernel

[ ]# ecosconfig new str81xx
[ ]# ecosconfig tree    ;ecos.ecc
[ ]# make    ; install/lib/target.ld

[ ]# cd $ECOS_ROOT_DIR    ; ECOS_ROOT_DIR = /home/eCos/ecos-starsemi
[ ]# mkdir hello_application
[ ]# cd hello_application
[ ]# cp /home/eCos/ecos-starsemi/ecos-2.0/examples/hello.c .
[ ]# cp /home/eCos/ecos-starsemi/ecos-2.0/examples/build_Makefile .
[ ]# cp /home/eCos/ecos-starsemi/ecos-2.0/examples/build_Make.params .
[ ]# chmod +x build_Makefile build_Make.params
[ ]# SRCS=hello.c DST=hello ./build_Makefile ../hello_kernel
[ ]# make
[ ]# arm-elf-objcopy -O srec hello hello.srec
[ ]# arm-elf-objcopy -O binary hello hello.bin


Compile eCos Application - HTTP Server
[ ]# cd $ECOS_ROOT_DIR    ; ECOS_ROOT_DIR = /home/eCos/ecos-starsemi
[ ]# mkdir httpd_kernel
[ ]# cd httpd_kernel

[ ]# ecosconfig new str81xx net
[ ]# ecosconfig add CYGPKG_HTTPD    ; add HTTP server
[ ]# ecosconfig tree    ; ecos.ecc
[ ]# make    ; install/lib/target.ld

[ ]# cd $ECOS_ROOT_DIR    ; ECOS_ROOT_DIR = /home/eCos/ecos-starsemi
[ ]# mkdir httpd_application
[ ]# cd httpd_application
[ ]# cp /home/eCos/ecos-starsemi/ecos-2.0/packages/net/httpd/current/tests/httpd1.c httpd_apps.c
[ ]# cp /home/eCos/ecos-starsemi/ecos-2.0/examples/build_Makefile .
[ ]# cp /home/eCos/ecos-starsemi/ecos-2.0/examples/build_Make.params .
[ ]# chmod +x build_Makefile build_Make.params
[ ]# SRCS=httpd_apps.c DST=httpd_apps ./build_Makefile ../httpd_kernel
[ ]# make
[ ]# arm-elf-objcopy -O srec httpd_apps httpd_apps.srec
[ ]# arm-elf-objcopy -O binary httpd_apps httpd_apps.bin

-----------------------------------------------------------
-rwxr-xr-x 1 root root 2085682 2008-06-17 httpd_apps
-rwxr-xr-x 1 root root  742694 2008-06-17 httpd_apps.srec
-rwxr-xr-x 1 root root  258304 2008-06-17 httpd_apps.bin
-----------------------------------------------------------
The size of the image is pretty small.

Compile eCos Application - OpenSSL Server
[ ]# ecosconfig add CYGPKG_OPENSSL    ; add openssl support

Compile eCos Application - BitTorrent Server
To be continue...

Compile eCos Application - Samba Server
To be continue...

Current Status:

  • Hello World ! [Console]
  • HTTP Server [Ethernet, TCP/IP]
  • OpenSSL Server [Ethernet, TCP/IP]
  • BitTorrent Client [ToDo] 
  • Sambe Server [ToDo]

Friday, July 4, 2008

eCos Notes

Some notes about eCos.

Compare with Linux.

Tuesday, June 24, 2008

eCos Software Diagram



Compare with Linux

Tuesday, June 10, 2008

How to build eCos 2.x toolchain for ARM platform

In Fedora Core 8, Fedora Core 9

* binutils-2.15
* gcc-3.4.3
* newlib-1.12.0
* insight-6.6

1. Pre-Configuration
BASE_DIR=`pwd`
TARGET=arm-elf

2. Download source code
[ ]# wget -P $BASE_DIR/src http://www.gnuarm.com/binutils-2.15.tar.bz2
[ ]# wget -P $BASE_DIR/src http://www.gnuarm.com/gcc-3.4.3.tar.bz2
[ ]# wget -P $BASE_DIR/src http://www.gnuarm.com/newlib-1.12.0.tar.gz
[ ]# wget -P $BASE_DIR/src ftp://sourceware.org/pub/insight/releases/insight-6.6.tar.bz2

3. Pre-Build
[ ]# mkdir -p /opt/gnutools
[ ]# bunzip2 < $BASE_DIR/src/binutils-2.15.tar.bz2 | tar xvf -
[ ]# bunzip2 < $BASE_DIR/src/gcc-3.4.3.tar.bz2 | tar xvf -
[ ]# gunzip < $BASE_DIR/src/newlib-1.12.0.tar.gz | tar xvf -
[ ]# bunzip2 < $BASE_DIR/src/insight-6.6.tar.bz2 | tar xvf -
[ ]# cp -rf newlib-1.12.0/newlib gcc-3.4.3/
[ ]# cp -rf newlib-1.12.0/libgloss gcc-3.4.3/

4. Binutils
[ ]# mkdir -p /tmp/build/binutils
[ ]# cd /tmp/build/binutils
[ ]# $BASE_DIR/binutils-2.15/configure --target=$TARGET --prefix=/opt/gnutools \
-v 2>&1 | tee configure.out
[ ]# make -w all install 2>&1 | tee make.out

5. GCC
[ ]# PATH=/opt/gnutools/bin:$PATH ; export PATH
[ ]# mkdir -p /tmp/build/gcc
[ ]# cd /tmp/build/gcc
[ ]# $BASE_DIR/gcc-3.4.3/configure --target=$TARGET --prefix=/opt/gnutools \
--enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib \
--with-gxx-include-dir=/opt/gnutools/$TARGET/include \
-v 2>&1 | tee configure.out
[ ]# make -w all install 2>&1 | tee make.out

6. GDB
[ ]# mkdir -p /tmp/build/gdb
[ ]# cd /tmp/build/gdb
[ ]# $BASE_DIR/insight-6.6/configure --target=$TARGET --prefix=/opt/gnutools \
-v 2>&1 | tee configure.out
[ ]# make -w all install 2>&1 | tee make.out

7. Post-Build
* Clean
[ ]# rm -rf /tmp/build/

* Change PATH environment variable (Edit /root/.bash_profile file)
PATH=$PATH:$HOME/bin
# Toolchain for ARM-eCos platform
PATH=/opt/gnutools/bin:$PATH
export PATH

* Effect the change

That's all. Here is the script file. Enjoy!
You can also download the complete source tarball (84MB).

Friday, June 6, 2008

eCos

eCos
Changelog
1998.11 - eCos 1.1, Cygnus Solutions
1999.05 - eCos 1.2
1999.11 - Cygnus Solutions was acquired by Red Hat
2000.03 - eCos 1.3, Red Hat
2003.05 - eCos 2.0, eCosCentric Original members of eCos team formed eCosCentric Limited in Cambridge.

2004 - I first met eCos
2008 - I second met eCos. Next assigned task is porting the eCos to a new ARM9 processor.

Tuesday, June 3, 2008

eCos books


1. Embedded Software Development with eCos

Download PDF
Download Source Code
2. Programming Embedded Systems: With C and GNU Development Tools, 2nd Edition

Monday, June 2, 2008