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]

No comments: