Commit 392edd76 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

EDISOFT requires specific instructions (due to FPU issues)

parent 6dcc07df
Introduction
============
This folder contains the EDISOFT RTEMS scaffold. It showcases
how to:
* support both debug and release compilations
* support compilation for native and emulated FPU usage
* support targetting Leon2 and Leon3 CPUs
* enable/disable showing compilation commands
Application sources
-------------------
Due to [FPU register corruption issues that are caused by a GCC bug](https://devel.rtems.org/wiki/TBR/UserManual/Floating_Point_Support), the building of RTEMS EDISOFT applications must be done
with separate compilation for non-FPU tasks (i.e. with -msoft-float)
The sources of your project must therefore be set inside the Makefile in two
sets: in the FPU_SRC and NONFPU_SRC variables. The VPATH can then be used
to automatically locate them in your source tree:
VPATH=src:Library/foo:Library/bar:...
NONFPU_SRC= \
init.c \
tasking.c \
...
FPU_SRC= \
gnc.c \
compute_pi.c
As their names suggest, you add a file in the FPU_SRC list if you want it
to be compiled for native FPU use (i.e. without `-msoft-float`).
Whether native or emulated FPU compilation is actually performed on the FPU_SRC,
is selected during build time by the `FPU` Makefile parameter (see below)
# Compilation options
## Debug/Release mode
Using the `CFG` Makefile parameter, you can select debug or release
compilation:
$ make CFG=debug
...
$ ls -l bin.debug.NONFPU.leon3/
-rwxr-xr-x 1 user user 645273 Mar 16 17:43 fputest
$ make CFG=release
...
$ ls -l bin.release.NONFPU.leon3/
-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
(* If no `CFG` option is provided, the default is `debug` compilation. *)
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.
- the output folder indicates that the NONFPU (i.e. `-msoft-float`
everywhere) and `Leon3` options were automatically selected.
These are the default options unless you select different
(see following sections)
## Native or emulated FPU compilation for the FPU_SRC source files
To use native FPU compilation for the FPU_SRC list of source files, use the
`FPU` Makefile parameter:
$ make CFG=debug FPU=1
To use emulation (default, if `FPU` option is not provided), pass `FPU=0`:
$ make CFG=debug FPU=0
...or just don't mention `FPU` at all:
$ make CFG=debug
The `FPU` and `CFG` options are completely independent ; you can e.g.
compile a debug version that uses native FPU, and a release one that uses
emulation.
## Select Leon target
Use the `LEON` Makefile parameter to decide which target to build for
(currently, only `leon2` and `leon3` are supported):
$ make CFG=debug FPU=1 LEON=leon3
## Verbosity
Messages shown during compilation follow the semantics of the Linux kernel
compilation process, 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, use `V=1`:
$ touch src/task1.c
$ make CFG=debug FPU=0 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment