Search code examples
clinuxecos

eCos : Compile and Run sample application on Linux


I have installed eCos OS on a linux system (Ubuntu 13.02). After installation, the eCos files are located in opt/ecos.

As I read the eCos tutorial, I see hello.c is stored in opt/ecos/ecos-3.0/examples/hello.c (And I notice that maybe all main eCos system files store in the ecos-3.0 directory).

I have followed the eCos tutorial found on the official website, but I still cannot successfully compile hello.c.

More detail. When I try to run :

$ export INSTALL_DIR=BASE_DIR/ecos-work/arm_install 
$ TARGET-gcc -g -IBASE_DIR/ecos-work/install/include hello.c \
    -LBASE_DIR/ecos-work/install/lib -Ttarget.ld -nostdlib

I get the error : TARGET-gcc : command not found

I have tried some other tutorials, but I'm still having issues (too messy to list here).

I am looking for step-by-step instruction on compiling hello.c in eCos system. I see the eCos manual lacking in this area.

Thanks :)


Solution

  • It appears that you've missed a subtle convention in the eCos documentation. Items in italics are provided by you! They are variables.

    The documentation mentions this here:

    Note: Remember that when this manual shows TARGET-gcc you should use 
    the full name of the cross compiler, e.g. i386-elf-gcc, arm-elf-gcc, 
    or sh-elf-gcc. When compiling for the synthetic Linux target, use the
    native gcc which must have the features required by eCos.
    

    Replace TARGET with the appropriate value and BASE_DIR with (I think, in your case) /opt/ecos. You should verify the include directory before moving forward:

    $ ls -l /opt/ecos/ecos-work/install/include
    

    If that doesn't list directory contents, then you simply need to locate ecos-work

    The Ecosconfig on Windows and Linux Quick Start section of the docs has you create the BASE_DIR directory (below is a snippet that I am quoting ... italics will not display).

    $ mkdir BASE_DIR/ecos-work
    $ cd BASE_DIR/ecos-work
    

    So, this could be the correct invocation.

    $ export INSTALL_DIR=/opt/ecos/ecos-work/arm_install 
    $ arm-elf-gcc -g -I/opt/ecos/ecos-work/install/include hello.c \
        -L/opt/ecos/ecos-work/install/lib -Ttarget.ld -nostdlib