cross compilation fix
authorChenchi Luo <a0282871@ti.com>
Tue, 19 May 2015 14:53:06 +0000 (09:53 -0500)
committerChenchi Luo <a0282871@ti.com>
Tue, 19 May 2015 14:53:06 +0000 (09:53 -0500)
28 files changed:
build/makefile [changed mode: 0644->0755]
src/app/cnn/.testignore [new file with mode: 0644]
src/app/cnn/class/.testignore [new file with mode: 0644]
src/app/cnn/class/cifar10/.Testing.testcfg [new file with mode: 0644]
src/app/cnn/class/imagenet/.testignore [new file with mode: 0644]
src/app/cnn/class/mnist/.testignore [new file with mode: 0644]
src/app/cnn/convert/.testignore [new file with mode: 0644]
src/app/cnn/convert/imagenet/.testignore [new file with mode: 0644]
src/app/cnn/convert/sbd/.testignore [new file with mode: 0644]
src/app/cnn/interop/.testignore [new file with mode: 0644]
src/app/cnn/interop/caffe/.testignore [new file with mode: 0644]
src/app/cnn/scene/.testignore [new file with mode: 0644]
src/app/cnn/scene/sbd/.testignore [new file with mode: 0644]
src/app/makefile [changed mode: 0644->0755]
src/database/cifar10/.testignore [new file with mode: 0644]
src/database/imagenet/.testignore [new file with mode: 0644]
src/database/mnist/.testignore [new file with mode: 0644]
src/database/model/.testignore [new file with mode: 0644]
src/database/model/alexnet/.testignore [new file with mode: 0644]
src/database/model/caffenet/.testignore [new file with mode: 0644]
src/database/model/cifar10/.testignore [new file with mode: 0644]
src/database/model/mnist/.testignore [new file with mode: 0644]
src/database/model/sbd/.testignore [new file with mode: 0644]
src/database/model/vggnet/.testignore [new file with mode: 0644]
src/database/sbd/.testignore [new file with mode: 0644]
src/database/test/.testignore [new file with mode: 0644]
src/database/test/cnn/.testignore [new file with mode: 0644]
src/database/test/util/.testignore [new file with mode: 0644]

old mode 100644 (file)
new mode 100755 (executable)
index a5860eb..0253dfe
 ################################################################################\r
 \r
 #check os\r
-UNAME = $(shell uname -s)\r
-ifeq ($(UNMAE), Linux)\r
-       LINUX := 1\r
-else\r
-       OSX := 1\r
-endif\r
+UNAME_M :=$(shell uname -m)\r
 \r
 BIN_DIR := ../bin\r
 BUILD_DIR := build\r
@@ -57,10 +52,21 @@ COMMON_LIB_CFILES = $(shell find $(COMMON_LIB_SRC_DIR) -name "*.c")
 COMMON_LIB_HFILES = $(shell find $(COMMON_LIB_SRC_DIR) -name "*.h")\r
 COMMON_LIB_OBJS = $(patsubst %.c, %.o, $(COMMON_LIB_CFILES))\r
 \r
+\r
+\r
+ifneq (,$(findstring 86, $(UNAME_M)))\r
+CC = arm-linux-gnueabihf-gcc\r
+AR =  arm-linux-gnueabihf-ar\r
+else\r
+CC = gcc\r
+AR=ar\r
+endif\r
+\r
+\r
+\r
 C_INCLUDE_PATH = $(SRC_DIR)/common/api $(SRC_DIR)/common/cnn $(SRC_DIR)/common/util \\r
-/usr/include\r
+$(TARGET_ROOT)/usr/include\r
 C_INCLUDE_FLAG = $(foreach d, $(C_INCLUDE_PATH), -I$d)\r
-CC = gcc\r
 CFLAGS += -g -O3 -fopenmp\r
 AR = @ar\r
 ARFLAGS = -rcs\r
diff --git a/src/app/cnn/.testignore b/src/app/cnn/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/class/.testignore b/src/app/cnn/class/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/class/cifar10/.Testing.testcfg b/src/app/cnn/class/cifar10/.Testing.testcfg
new file mode 100644 (file)
index 0000000..08755e8
--- /dev/null
@@ -0,0 +1 @@
+EXE=appCNNClassCIFAR10Testing.bin
diff --git a/src/app/cnn/class/imagenet/.testignore b/src/app/cnn/class/imagenet/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/class/mnist/.testignore b/src/app/cnn/class/mnist/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/convert/.testignore b/src/app/cnn/convert/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/convert/imagenet/.testignore b/src/app/cnn/convert/imagenet/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/convert/sbd/.testignore b/src/app/cnn/convert/sbd/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/interop/.testignore b/src/app/cnn/interop/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/interop/caffe/.testignore b/src/app/cnn/interop/caffe/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/scene/.testignore b/src/app/cnn/scene/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/app/cnn/scene/sbd/.testignore b/src/app/cnn/scene/sbd/.testignore
new file mode 100644 (file)
index 0000000..e69de29
old mode 100644 (file)
new mode 100755 (executable)
index 7bafae2..a914ca9
 #
 ################################################################################
 
+UNAME_M :=$(shell uname -m)
+ifneq (,$(findstring 86, $(UNAME_M)))
+    # In a cross compile environment we are assuming that the EVM file system
+    # is located on the build host and necessary ARM libraries are installed
+    # on that file system.
+    ifneq ($(MAKECMDGOALS),clean)
+       ifeq ($(TARGET_ROOTDIR),)
+         $(error Environment variable TARGET_ROOTDIR must be defined. Set it to point at the EVM root file system)
+       endif
+    endif
+
+    # gcc ARM cross compiler will not, by default, search the host's
+    # /usr/include.  Explicitly specify here to find dependent vendor headers
+CC = arm-linux-gnueabihf-gcc
+CPPC =  arm-linux-gnueabihf-g++
+AR = arm-linux-gnueabihf-ar
+else
+CC = gcc
+CPPC = g++
+AR = @ar
+endif
+
+
+
 C_INCLUDE_PATH = ../common/api ../common/cnn ../common/util \
-/usr/include
+$(TARGET_ROOTDIR)/usr/include
 C_INCLUDE_PATH_FLAG = $(foreach d, $(C_INCLUDE_PATH), -I$d)
 C_LIB = timl cblas_armplusdsp blis OpenCL stdc++ rt jpeg m
 C_LIB_FLAG = $(foreach d, $(C_LIB), -l$d)
-C_LIB_PATH = /usr/lib ../../bin
+C_LIB_PATH = $(TARGET_ROOTDIR)/usr/lib ../../bin
 C_LIB_PATH_FLAG = $(foreach d, $(C_LIB_PATH), -L$d)
-CC = gcc
 CFLAGS += -g -O3 -fopenmp
+LD_FLAGS=-L$(TARGET_ROOTDIR)/lib -L$(TARGET_ROOTDIR)/usr/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/lib -Wl,-rpath-link,$(TARGET_ROOTDIR)/usr/lib
 
-CPPC = g++
-
-
-AR = @ar
 ARFLAGS = -rcs
 RM = @rm
 RMFLAGS += -fr
@@ -110,53 +130,53 @@ clean:
 
 # appCNNClass bins
 $(APP_CNN_CLASS_BINS): %.bin: %.o
-       $(CC) $(CFLAGS) -o $@ $^ \
+       $(CC) $(CFLAGS) $(LD_FLAGS) -o $@ $^ \
        $(C_LIB_FLAG) $(C_LIB_PATH_FLAG)
        
 # appCNNClass objs
 $(APP_CNN_CLASS_BIN_OBJS): %.o: %.c $(APP_CNN_CLASS_HFILES)
-       $(CC) -c $(CFLAGS) -o $@ $< \
+       $(CC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \
        $(C_INCLUDE_PATH_FLAG)
        
 # appCNNScene bins
 $(APP_CNN_SL_BINS): %.bin: %.o $(APP_CNN_SL_AUX_OBJS)
-       $(CC) $(CFLAGS) -o $@ $^ \
+       $(CC) $(CFLAGS) $(LD_FLAGS) -o $@ $^ \
        $(C_LIB_FLAG) $(C_LIB_PATH_FLAG)
 
 # appCNNScene objs
 $(APP_CNN_SL_OBJS): %.o: %.c $(APP_CNN_SL_HFILES)
-       $(CC) -c $(CFLAGS) -o $@ $< \
+       $(CC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \
        $(C_INCLUDE_PATH_FLAG)
 
 # appCNNConvertImageNet bins 
 $(APP_CNN_CONVERT_IMAGENET_BINS): $(APP_CNN_CONVERT_IMAGENET_BIN_OBJS)
-       $(CPPC) $(CFLAGS) -o $(APP_CNN_CONVERT_IMAGENET_BINS) $^ \
+       $(CPPC) $(CFLAGS) $(LD_FLAGS) -o $(APP_CNN_CONVERT_IMAGENET_BINS) $^ \
        -lopencv_core -lopencv_highgui -lopencv_imgproc \
        $(C_LIB_PATH_FLAG)
        
 # appCNNConvertImageNet objs
 $(APP_CNN_CONVERT_IMAGENET_BIN_OBJS): %.o: %.cpp $(APP_CNN_CONVERT_IMAGENET_HFILES)
-       $(CPPC) -c $(CFLAGS) -o $@ $< \
+       $(CPPC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \
        $(C_INCLUDE_PATH_FLAG)
 
 # appCNNConvertSBD bins 
 $(APP_CNN_CONVERT_SBD_BINS): $(APP_CNN_CONVERT_SBD_BIN_OBJS)
-       $(CPPC) $(CPPFLAGS) -o $(APP_CNN_CONVERT_SBD_BINS) $^ \
+       $(CPPC) $(CPPFLAGS) $(LD_FLAGS) -o $(APP_CNN_CONVERT_SBD_BINS) $^ \
        -lopencv_core -lopencv_highgui -lopencv_imgproc \
        $(C_LIB_PATH_FLAG)
        
 # appCNNConvertSBD objs
 $(APP_CNN_CONVERT_SBD_BIN_OBJS): %.o: %.cpp $(APP_CNN_CONVERT_SBD_HFILES)
-       $(CPPC) -c $(CFLAGS) -o $@ $< \
+       $(CPPC) -c $(CFLAGS) $(LD_FLAGS) -o $@ $< \
        $(C_INCLUDE_PATH_FLAG)
 
 # appCNNInteropCaffe bins
 $(APP_CNN_INTEROP_CAFFE_BINS): $(APP_CNN_INTEROP_CAFFE_BIN_OBJS)
-       $(CPPC) $(CFLAGS) -o $(APP_CNN_INTEROP_CAFFE_BINS) $^ \
+       $(CPPC) $(CFLAGS) $(LD_FLAGS) -o   $(APP_CNN_INTEROP_CAFFE_BINS) $^ \
        -lprotobuf \
        $(C_LIB_FLAG) $(C_LIB_PATH_FLAG)
 
 # appCNNInteropCaffe objs
 $(APP_CNN_INTEROP_CAFFE_BIN_OBJS): %.o: %.cpp $(APP_CNN_INTEROP_CAFFE_HFILES)
-       $(CPPC) -c $(CFLAGS) -o $@ $< \
+       $(CPPC) -c $(CFLAGS) $(LD_FLAGS) -o $(LD_FLAGS)  $@ $< \
        $(C_INCLUDE_PATH_FLAG)
diff --git a/src/database/cifar10/.testignore b/src/database/cifar10/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/imagenet/.testignore b/src/database/imagenet/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/mnist/.testignore b/src/database/mnist/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/.testignore b/src/database/model/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/alexnet/.testignore b/src/database/model/alexnet/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/caffenet/.testignore b/src/database/model/caffenet/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/cifar10/.testignore b/src/database/model/cifar10/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/mnist/.testignore b/src/database/model/mnist/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/sbd/.testignore b/src/database/model/sbd/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/model/vggnet/.testignore b/src/database/model/vggnet/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/sbd/.testignore b/src/database/sbd/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/test/.testignore b/src/database/test/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/test/cnn/.testignore b/src/database/test/cnn/.testignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/database/test/util/.testignore b/src/database/test/util/.testignore
new file mode 100644 (file)
index 0000000..e69de29