summaryrefslogtreecommitdiffstats
path: root/software/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'software/Makefile')
-rw-r--r--software/Makefile60
1 files changed, 60 insertions, 0 deletions
diff --git a/software/Makefile b/software/Makefile
new file mode 100644
index 0000000..13116c7
--- /dev/null
+++ b/software/Makefile
@@ -0,0 +1,60 @@
+#
+#
+
+ELFDIR=../software/pong3
+BSPDIR=../software/pong3_bsp
+ELF=pong3.elf
+
+SOPCINFO=../my_sys.sopcinfo
+SOF=../pong3.sof
+
+run: load_elf.stamp
+ ./wrap.sh nios2-terminal
+
+flash: load_sof.stamp sof.flash elf.flash ${BSPDIR}/system.h
+ BASE=` grep EPCS_FLASH_CONTROLLER_0_BASE ${BSPDIR}/system.h | awk '{print $$3}' ` && \
+ ./wrap.sh nios2-flash-programmer sof.flash --base=$${BASE} --epcs --accept-bad-sysid --device=1 --instance=0 --program --verbose && \
+ ./wrap.sh nios2-flash-programmer elf.flash --base=$${BASE} --epcs --accept-bad-sysid --device=1 --instance=0 --program --verbose -g
+
+sof.flash: ${SOF}
+ ./wrap.sh sof2flash --input=$< --output=$@ --epcs --verbose
+
+elf.flash: ${ELFDIR}/${ELF} sof.flash
+ ./wrap.sh elf2flash --input=${ELFDIR}/${ELF} --output=$@ --epcs --after=sof.flash --verbose
+
+
+
+
+
+
+
+load_elf.stamp:load_sof.stamp ${ELFDIR}/${ELF}
+ ./wrap.sh nios2-download ${ELFDIR}/${ELF} -g
+
+load_sof.stamp: ${SOF}
+ ./wrap.sh quartus_pgm -m JTAG -o 'p;../pong3.sof'
+
+${ELFDIR}/${ELF}: ${BSPDIR}/libhal_bsp.a
+ ./wrap.sh ${MAKE} -C ${ELFDIR}
+
+
+${BSPDIR}/libhal_bsp.a:${BSPDIR}/system.h
+ ./wrap.sh ${MAKE} -C ${BSPDIR}
+
+${BSPDIR}/system.h:${SOPCINFO}
+ rm -f $@
+ (cd ${BSPDIR} && ${PWD}/wrap.sh ./create-this-bsp )
+
+
+clean:
+ ./wrap.sh ${MAKE} -C ${BSPDIR} clean
+ ./wrap.sh ${MAKE} -C ${ELFDIR} clean
+ /bin/rm -f sof.flash elf.flash
+ /bin/rm -rf ${BSPDIR}/drivers ${BSPDIR}/HAL ${BSPDIR}/linker.h ${BSPDIR}/linker.x ${BSPDIR}/system.h ${BSPDIR}/summary.html ${BSPDIR}/public.mk ${BSPDIR}/mem_init.mk ${BSPDIR}/memory.gdb ${BSPDIR}/alt_sys_init.c
+
+
+
+
+
+
+