#!/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 -O0 -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