Commit 6dcc07df authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Deal with EDISOFT FPU handling issue

parent 4cfe64aa
# Configuration section
#
# Use environment variables if found, otherwise fallback to sane defaults
#
# If not explicitely selected (with 'make FPU=1'), compile for FPU emulation
ifeq ($(FPU),)
FPU=0
......@@ -17,7 +17,8 @@ endif
# Build up our settings from our inputs and our environment
LEON ?= leon3
RTEMS_MAKEFILE_PATH = /opt/rtems-4.8/sparc-rtems4.8/${LEON}
RTEMS ?= /opt/rtems-4.8
RTEMS_MAKEFILE_PATH = ${RTEMS}/sparc-rtems4.8/${LEON}
RTEMS_LIB=${RTEMS_MAKEFILE_PATH}/lib
EDISOFT_SUPPORT_PATH ?= /root/development/build/rtems-impr/testsuites/support
CROSS_PREFIX=sparc-rtems4.8
......@@ -51,18 +52,22 @@ EDISOFT_SRC += ${LEON}.c
# VPATH will locate them...
#
# DEAR USER, YOU MUST EDIT THIS
SRC= \
NONFPU_SRC= \
init.c \
task1.c \
task2.c \
${EDISOFT_SRC}
FPU_SRC= \
task1.c \
SUFFIX=$(CFG).$(FPU_SUFFIX).$(LEON)
# Build a Dependency list and an Object list, by replacing the .c
# extension to .d for dependency files, and .o for object files.
DEP = $(patsubst %.c, deps.$(SUFFIX)/%.d, ${SRC})
OBJ = $(patsubst %.c, objs.$(SUFFIX)/%.o, ${SRC})
NONFPU_DEP = $(patsubst %.c, deps.$(SUFFIX)/NONFPU_%.d, ${NONFPU_SRC})
NONFPU_OBJ = $(patsubst %.c, objs.$(SUFFIX)/NONFPU_%.o, ${NONFPU_SRC})
FPU_DEP = $(patsubst %.c, deps.$(SUFFIX)/FPU_%.d, ${FPU_SRC})
FPU_OBJ = $(patsubst %.c, objs.$(SUFFIX)/FPU_%.o, ${FPU_SRC})
# Your final binary
#
......@@ -71,7 +76,7 @@ TARGET=fputest
# What compiler to use for generating dependencies:
# it will be invoked with -MM -MP
CC = ${CROSS_PREFIX}-gcc
CC = ${RTEMS}/bin/${CROSS_PREFIX}-gcc
CDEP = ${CC}
# What include flags to pass to the compiler
......@@ -88,9 +93,11 @@ else
CFLAGS += ${COMMON} -g -O2 -Wall ${INCLUDEFLAGS}
endif
# Should we generate emulated FPU instructions for the SRC?
# FPU section
CFLAGS_FPU = ${CFLAGS}
CFLAGS_NONFPU = ${CFLAGS} -msoft-float
ifeq ($(FPU),0)
CFLAGS += -msoft-float
CFLAGS_FPU += -msoft-float
LDFLAGS += -msoft-float
endif
......@@ -126,7 +133,7 @@ endif
endif
bin.$(SUFFIX)/${TARGET}: ${OBJ} | inform
bin.$(SUFFIX)/${TARGET}: ${NONFPU_OBJ} ${FPU_OBJ} | inform
@mkdir -p $(dir $@)
ifeq ($(V),1)
$(CC) -g -o $@ $^ ${LDFLAGS}
......@@ -140,20 +147,36 @@ ifeq ($(CFG),release)
endif
@echo Built with RTEMS at ${RTEMS_LIB} for ${LEON}.
objs.$(SUFFIX)/%.o: %.c
objs.$(SUFFIX)/NONFPU_%.o: %.c
@mkdir -p $(dir $@)
ifeq ($(V),1)
$(CC) -c $(CFLAGS_NONFPU) -o $@ $<
else
@echo [CC] $@
@$(CC) -c $(CFLAGS_NONFPU) -o $@ $<
endif
objs.$(SUFFIX)/FPU_%.o: %.c
@mkdir -p $(dir $@)
ifeq ($(V),1)
$(CC) -c $(CFLAGS) -o $@ $<
$(CC) -c $(CFLAGS_FPU) -o $@ $<
else
@echo [CC] $@
@$(CC) -c $(CFLAGS) -o $@ $<
@$(CC) -c $(CFLAGS_FPU) -o $@ $<
endif
deps.$(SUFFIX)/%.d: %.c
deps.$(SUFFIX)/NONFPU_%.d: %.c
@mkdir -p $(dir $@)
@echo Generating dependencies for $<
@set -e ; $(CDEP) -MM -MP $(INCLUDEFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,objs.$(SUFFIX)\/NONFPU_\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
deps.$(SUFFIX)/FPU_%.d: %.c
@mkdir -p $(dir $@)
@echo Generating dependencies for $<
@set -e ; $(CDEP) -MM -MP $(INCLUDEFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,objs.$(CFG)\/\1.o $@ : ,g' < $@.$$$$ > $@; \
sed 's,\($*\)\.o[ :]*,objs.$(SUFFIX)\/FPU_\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
......@@ -164,6 +187,7 @@ clean:
# (-include), since they will be missing in the first invocation!
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(CFG),)
-include ${DEP}
-include ${NONFPU_DEP}
-include ${FPU_DEP}
endif
endif
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