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

Deal with EDISOFT FPU handling issue

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