1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/elink/sw/mailbox_test/build.sh
2020-01-28 18:12:57 -05:00

37 lines
799 B
Bash
Executable File

#!/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
SCRIPT=$(readlink -f "$0")
EXEPATH=$(dirname "$SCRIPT")
cd $EXEPATH
# Create the binaries directory
mkdir -p bin/
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
# Build HOST side application
${CROSS_PREFIX}gcc src/e-main.c -o bin/e-main.elf ${EINCS} ${ELIBS} -le-hal -le-loader -lpthread
# Build DEVICE side program
e-gcc -Os -T ${ELDF} src/e-task.c -o bin/e-task.elf -le-lib -lm -ffast-math
# Convert ebinary to SREC file
e-objcopy --srec-forceS3 --output-target srec bin/e-task.elf bin/e-task.srec