Using eCos FAQ

Questions on building eCos or on using eCos to build applications.

Linking tests produces the error "section .FOO is not within region ram"

You get this when linking the eCos tests (or your application) and it happens because the defined memory layout for your target indicates that the program image will not fit!

This commonly happens with trying to squeeze the net stack, which is quite big, on RAM constrained targets.

Verify the memory layout to check it does fit your hardware, and generate a linker map to see where the memory is going. This can be done using the option -Wl,-Map,mapfile on the gcc link line to create a file called "mapfile" in the current directory of the build at that point. Note that if you add this to CYGBLD_GLOBAL_LDFLAGS in your ecos.ecc file, then for the eCos tests, the linker map file will be generated in the build tree subdirectory corresponding to the package.

Certainly, many configuration options can reduce the memory usage, including removing entire packages. The linker map gives a better guide as to where the memory is being used. In the case of the net stack for example, it is very wise to try to reduce the size of the buffers, i.e. the CYGPKG_NET_MEM_USAGE option.

back to top

How do I create an application using eCos?

An eCos application is built in two steps.

The first step is quite fully documented elsewhere. The problem comes with the second step, since it will be unfamiliar to most users. Some additional command line arguments for the C compiler will be necessary in order to link your application with the eCos kernel. The simplest way to set an example up is by using the "build_Makefile" script, which you will find alongside the eCos sample programs.

Assume that the eCos kernel was created in the directory "ECOS" and that the application is in the directory "APP".

This script will build a simple Makefile template, using the appropriate eCos tools setup used for building the eCos kernel. This Makefile can then be modified as necessary to handle the actual application code setup.

It uses the default eCos compilation flags. This may include some flags that the application does not require or desire such as warning options. Obviously those flags can just be deleted by editting the generated makefile. Consult the GCC manual to see what the various flags do if you don't already know.

If you are using the graphical configuration tools, these lay out the build directory structure in a slightly different way from the command line ecosconfig tool. This should be fixed eventually, but for the moment it can be worked around. If you created a configuration called example, then when saved there will be:

So enter the example_build directory and type:

build_Makefile can then be used as before.

Note: build_Makefile is only a starting point. Most applications will require modifications to the resulting Makefile in order to be complete.

back to top

Send any queries about the contents of this FAQ to the ecos-discuss mailing list mailto:ecos-discuss@ecos.sourceware.org

None: UsingEcosFaq (last edited 2008-01-10 19:46:50 by localhost)