README.md 3.63 KB
Newer Older
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
1 2 3 4 5
Introduction
============

This repository contains RTEMS scaffolds that cover the development workflows
required for ESA projects. The Makefiles and the example sources demonstrate
Thanassis Tsiodras's avatar
Layout  
Thanassis Tsiodras committed
6
how to:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
7 8 9 10 11 12 13

* support both debug and release compilations
* support compilation for native and emulated FPU usage

Application sources
-------------------
The sources of your project must be set inside the Makefile, in the FPU_SRC and
14 15 16
NONFPU_SRC variables. The VPATH can be used to automatically locate them in 
your source tree:

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
17 18
    VPATH=src:Library/foo:Library/bar:...

19 20
    NONFPU_SRC=          \
    	init.c           \
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
21 22
    	tasking.c        \
        ...
23
    
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
24 25 26
    FPU_SRC=             \
    	gnc.c            \
    	compute_pi.c
27 28
    
As their names suggest, you add a file in the FPU_SRC list
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
29
if you want it to be compiled for native FPU use (i.e. without `-msoft-float`).
30 31
Whether native or emulated FPU compilation is performed on it, is selected during 
build time ; by the FPU=1 Makefile parameter (see below)
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
32

Thanassis Tsiodras's avatar
Layout  
Thanassis Tsiodras committed
33
You can control 3 orthogonal options:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
34

Thanassis Tsiodras's avatar
Layout  
Thanassis Tsiodras committed
35
## Debug/Release mode:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
36

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
37 38
Use the `CFG` Makefile parameter:

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
39 40 41 42 43 44 45 46 47 48 49
    $ make CFG=debug
    ...
    $ ls -l bin.debug/
    -rwxr-xr-x 1 user user 645273 Mar 16 17:43 fputest

    $ make CFG=release
    ...
    $ ls -l bin.release/
    -rwxr-xr-x 1 root root  47860 Mar 16 17:48 fputest
    -rwxr-xr-x 1 root root 585178 Mar 16 17:48 fputest.debug

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
50 51
If no `CFG` option is passed, the default is Debug compilation.

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
52 53 54 55
Notice that in release compilation, the process creates a small binary (containing
only the executable code) and separately, the debug information - for loading
from inside GDB via the `file` command.

Thanassis Tsiodras's avatar
Layout  
Thanassis Tsiodras committed
56
## Native FPU usage for the FPU_SRC sources:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
57

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
58
To use native FPU compilation for the FPU_SRC list of source files, use the `FPU` Makefile parameter:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
59 60 61

    $ make CFG=release FPU=1

Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
62 63 64 65 66 67 68 69
To use emulation (default, if `FPU` option is not passed) pass 0:

    $ make CFG=release FPU=0

or just

    $ make CFG=release

Thanassis Tsiodras's avatar
Layout  
Thanassis Tsiodras committed
70
## Verbosity:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102

Compilation messages follow the semantics of the Linux kernel compilations,
emitting short messages by default (CC for compilation, LD for linking):

    $ touch src/task1.c
    $ make
    [CC] objs.debug/FPU_task1.o
    [LD] bin.debug/fputest

If you want to see the complete commands used, invoke `make` with V=1:

    $ touch src/task1.c
    $ make V=1
    sparc-rtems4.8-gcc -c -B/home/user/development/rtems/sparc-rtems4.8/leon3/lib \
        -specs bsp_specs -qrtems -nodefaultlibs -mcpu=cypress -DBSP_leon3  -g -Wall \
        -D_DEBUG -I/home/user/development/build/rtems-impr/testsuites/support/include \
        -I src -msoft-float -o objs.debug/FPU_task1.o src/task1.c
    sparc-rtems4.8-gcc -g -o bin.debug/fputest objs.debug/NONFPU_init.o \
        objs.debug/NONFPU_printk.o objs.debug/NONFPU_leon3.o objs.debug/FPU_task1.o \
        -msoft-float -B/home/user/development/rtems/sparc-rtems4.8/leon3/lib \
        -specs bsp_specs -qrtems -nodefaultlibs -mcpu=cypress -DBSP_leon3  \
        -nodefaultlibs -Wl,--wrap,_IO_Initialize_all_drivers \
        /home/user/development/rtems/sparc-rtems4.8/leon3/lib/libno_event.a \
        /home/user/development/rtems/sparc-rtems4.8/leon3/lib/libno_msg.a \
        /home/user/development/rtems/sparc-rtems4.8/leon3/lib/libno_sem.a \
        /home/user/development/rtems/sparc-rtems4.8/leon3/lib/libno_timer.a \
        /home/user/development/rtems/sparc-rtems4.8/leon3/lib/libno_rtmon.a \
        /home/user/development/rtems/sparc-rtems4.8/leon3/lib/libno_ext.a \
        -Wl,--start-group -lrtemscpu -lio -lno_event -lno_msg -lno_sem -lno_timer \
        -lno_rtmon -lno_ext -lrtemsbsp -llibc -lrtemscpu -Wl,--end-group \
        -Wl,--script=linkcmds -B/tmp/edilibtmp/edilib/library -lgcc