mirror of
https://github.com/aolofsson/oh.git
synced 2025-02-07 06:44:09 +08:00
34 lines
662 B
Bash
34 lines
662 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
ESDK=${EPIPHANY_HOME}
|
||
|
ELIBS="-L ${ESDK}/tools/host/lib"
|
||
|
EINCS="-I ${ESDK}/tools/host/include"
|
||
|
ELDF=${ESDK}/bsps/current/internal.ldf
|
||
|
|
||
|
# Create the binaries directory
|
||
|
mkdir -p bin/
|
||
|
|
||
|
if [ -z "${CROSS_COMPILE+xxx}" ]; then
|
||
|
case $(uname -p) in
|
||
|
arm*)
|
||
|
# Use native arm compiler (no cross prefix)
|
||
|
CROSS_COMPILE=
|
||
|
;;
|
||
|
*)
|
||
|
# Use cross compiler
|
||
|
CROSS_COMPILE="arm-linux-gnueabihf-"
|
||
|
;;
|
||
|
esac
|
||
|
fi
|
||
|
|
||
|
# Build HOST side application
|
||
|
${CROSS_COMPILE}gcc src/main.c -g -o bin/main.elf ${EINCS} ${ELIBS} -le-hal -le-loader -lpthread
|
||
|
|
||
|
# Build DEVICE side program
|
||
|
OPT=3
|
||
|
e-gcc -g -T ${ELDF} -O${OPT} src/emain.c src/etest.S -o bin/emain.elf -le-lib
|
||
|
|
||
|
|