forked from parallella/parallella-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_multi.sh
executable file
·80 lines (67 loc) · 1.99 KB
/
build_multi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
ESDK=${EPIPHANY_HOME}
ELIBS=${ESDK}/tools/host/lib
EINCS=${ESDK}/tools/host/include
ELDF="src/matmul_internal_multi.ldf"
PARAM=$1
if [ $# -lt 1 ]
then
PARAM="s"
fi
echo -e "Mode: "$PARAM"\n"
if [ "$PARAM" = "s" ]
then
LIB_SRC_NAME="matmul_assembly"
LIB_SRC_EXTN=".S"
fi
LIB_SRC_FILE="${LIB_SRC_NAME}${LIB_SRC_EXTN}"
LIB_OBJ_FILE="${LIB_SRC_NAME}.o"
OPT_FLAG="-O3 -std=c99 -mlong-calls -mfp-mode=round-nearest -ffp-contract=fast -ffast-math -funroll-loops"
if [ "${LIB_SRC_EXTN}" = ".S" ]
then
ASM_FLAG="-DASM"
fi
echo -e "\nBuild HOST side application"
COMMAND="gcc ${DEFINE_FLAG} src/host_multi.c -o Debug/host_multi.elf -I ${EINCS} -L ${ELIBS} -le-hal -le-loader"
echo ${COMMAND}
eval ${COMMAND}
echo -e "\nBuild DEVICE side program"
COMMAND="e-gcc -O0 -c ${DEFINE_FLAG} ${ASM_FLAG} src/matmul_multi.c -o Debug/matmul_multi.o -le-lib"
echo ${COMMAND}
eval ${COMMAND}
if [ "${LIB_SRC_EXTN}" = ".c" ]
then
COMMAND="e-gcc -c -Wall ${OPT_FLAG} -o Debug/${LIB_OBJ_FILE} src/${LIB_SRC_FILE} -le-lib"
else
COMMAND="e-gcc -c src/${LIB_SRC_FILE} -o Debug/${LIB_OBJ_FILE}"
fi
echo ${COMMAND}
eval ${COMMAND}
echo -e "\nLinking"
COMMAND="e-gcc -T ${ELDF} Debug/matmul_multi.o Debug/${LIB_OBJ_FILE} -o Debug/matmul_multi.elf -le-lib"
echo ${COMMAND}
eval ${COMMAND}
echo -e "\nBuild complete\n"
#echo -e "\nGenerating assembly...."
#if [ "${LIB_SRC_EXTN}" = ".c" ]
#then
# COMMAND="e-gcc -S -fverbose-asm -g ${OPT_FLAG} src/${LIB_SRC_FILE} -o Assembly/${LIB_SRC_NAME}.s -le-lib"
# echo ${COMMAND}
# eval ${COMMAND}
#
# COMMAND="e-as -alhnd Assembly/${LIB_SRC_NAME}.s > Assembly/${LIB_SRC_NAME}_as.s"
# echo ${COMMAND}
# eval ${COMMAND}
#
# rm a.out
#fi
#
#COMMAND="e-objdump -d -S Debug/${LIB_OBJ_FILE} > Assembly/${LIB_SRC_NAME}_objdump.s"
#echo ${COMMAND}
#eval ${COMMAND}
#exit
#echo -e "\n\nExecuting program"
#COMMAND="./run_multi.sh"
#echo ${COMMAND}
#eval ${COMMAND}