Created
May 20, 2014 09:20
-
-
Save schmurfy/3f6f7cd9499234e9a509 to your computer and use it in GitHub Desktop.
parallella
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# awesome reference: | |
# http://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html | |
EPIPHANY_HOME=/opt/adapteva/esdk | |
# EPIPHANY_PLATFORM=emek3 | |
ESDK=${EPIPHANY_HOME} | |
ELIBS=${ESDK}/tools/host/lib | |
EINCS=${ESDK}/tools/host/include | |
# ELDF=${ESDK}/bsps/current/internal.ldf | |
ELDF=${ESDK}/bsps/current/fast.ldf | |
ECC=${ESDK}/tools/e-gnu.armv7l/bin/e-gcc | |
EXX=${ESDK}/tools/e-gnu.armv7l/bin/e-g++ | |
EOBJCOPY=${ESDK}/tools/e-gnu.armv7l/bin/e-objcopy | |
# all: bin/main bin/emain.srec | |
all: prepare bin/main bin/emain.srec | |
prepare: | |
mkdir -p bin | |
#### host rules | |
%.host.o : %.cpp | |
g++ -c $< -o $@ -I ${EINCS} -Isrc | |
%.host.o : %.c | |
gcc -c $< -o $@ -I ${EINCS} -Isrc | |
# Build HOST side application | |
bin/main: src/host/main.host.o | |
g++ $^ -o $@ -L ${ELIBS} -le-hal -lpng -ljpeg | |
#### device | |
DEADCODESTRIP=-Wl,-static -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s | |
# CFLAGS=-O2 -T ${ELDF} | |
CFLAGS=-flto -Os -T ${ELDF} -Isrc ${DEADCODESTRIP} | |
%.o: %.c | |
$(ECC) -c $(CFLAGS) $< -o $@ | |
%.o: %.cpp | |
$(EXX) -fpermissive -c $(CFLAGS) $< -o $@ | |
bin/emain.elf: src/device/emain.o src/device/pHash.o | |
$(EXX) $(CFLAGS) -fwhole-program $^ -o $@ -le-lib | |
# Build DEVICE side program | |
# bin/emain.elf: prepare src/emain.c src/pHash.cpp | |
# ${EXX} -O2 -T ${ELDF} src/emain.c src/pHash.cpp -o bin/emain.elf -le-lib | |
# Convert ebinary to SREC file | |
bin/emain.srec: bin/emain.elf | |
${EOBJCOPY} --srec-forceS3 --output-target srec bin/emain.elf bin/emain.srec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment