-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
32 lines (26 loc) · 850 Bytes
/
build.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
#!/bin/bash
set -e # exits immediately if exit 0 somewhere
ESDK=${EPIPHANY_HOME}
ELIBS="-L ${ESDK}/tools/host/lib"
EINCS="-I ${ESDK}/tools/host/include"
ELDF=${ESDK}/bsps/current/internal.ldf
HOST_FILES="src/game.c src/game.h src/main.c"
CROSS_PREFIX=
case $(uname -p) in
arm*)
# Use native arm compiler (no cross prefix)
CROSS_PREFIX=
;;
*)
# Use cross compiler
CROSS_PREFIX="arm-linux-gnueabihf-"
;;
esac
[ ! -d './build' ] && mkdir ./build
# Build HOST side application
${CROSS_PREFIX}gcc ${HOST_FILES} -o ./build/main.elf -std=c99 ${EINCS} ${ELIBS} -le-hal -le-loader -lpthread -ggdb
# Build DEVICE side program
# -T specifies the linker file
# -O0 reduce compilation time, specifies optimization level
OPT=0
e-gcc -T ${ELDF} -O${OPT} ./src/emain.c -o ./build/emain.elf -le-lib