summaryrefslogtreecommitdiffstats
path: root/app/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'app/Makefile')
-rw-r--r--app/Makefile35
1 files changed, 31 insertions, 4 deletions
diff --git a/app/Makefile b/app/Makefile
index f38aea4..4a007a6 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -17,15 +17,16 @@
## along with this library. If not, see <http://www.gnu.org/licenses/>.
##
-LDSCRIPT = ../arch_max.ld
CPROTO=cproto
-PROG=msf
+PROG=roofclock
+
+LDSCRIPT = ${PROG}.ld
V=1
default: ${PROG}.elf
-CSRCS=led.c ticker.c ring.c usart.c stdio.c lwip_glue.c steth.c msf.c abs.c pll.c main.c time_fn.c ntp.c dcf77.c util.c stats.c gps.c hexdump.c bits.c max7219.c report.c sysclk.c cdcacm.c usb.c
+CSRCS=led.c ticker.c ring.c usart.c stdio.c lwip_glue.c steth.c msf.c abs.c pll.c main.c time_fn.c ntp.c dcf77.c util.c stats.c gps.c hexdump.c bits.c max7219.c report.c sysclk.c cdcacm.c usb.c dfu.c
HSRCS= events.h gps.h project.h ring.h steth.h time_fn.h ubx.h
@@ -69,7 +70,7 @@ OBJS=${MYOBJS} ${LWIP_OBJS}
include ../Makefile.include
CFLAGS+=-Wno-redundant-decls -Wno-unused-parameter
-CPPFLAGS += -I../libopencm3-local -I${LWIP_PATH}/${LWIP}/src/include -Ilwip -I${LWIP_PATH}/${LWIP}/src/include/ipv4 -I${LWIP_LOCAL}/port/stm32f4x7 -I.
+CPPFLAGS += -I.. -I../libopencm3-local -I${LWIP_PATH}/${LWIP}/src/include -Ilwip -I${LWIP_PATH}/${LWIP}/src/include/ipv4 -I${LWIP_LOCAL}/port/stm32f4x7 -I.
LDLIBS+= -lm
@@ -90,9 +91,35 @@ reset:
-c shutdown
+
+test-dfu: ${PROG}.dfu
+ ../dfu-util/src/dfu-util -v -R -a 0 -d ${VID}:${DID} -s 0x08004000:leave -D $<
+ $(Q)$(OOCD) -f ../oocd/interface/$(OOCD_INTERFACE).cfg \
+ -f ../oocd/board/$(OOCD_BOARD).cfg \
+ -c "init" -c "dump_image readback.img 0x8004000 0x7c000" \
+ -c shutdown
+
+ hexdump -C ${PROG}.dfu > a
+ hexdump -C readback.img> b
+ diff -uN a b > c
+
+
fl: ${PROG}.hex
ssh ${HOST} flash_stm32 < ${PROG}.hex
+
+DID=$(shell printf '\#include "id.h"\nID_PRODUCT' | ${CC} -I.. -E - | grep -v ^\# )
+VID=$(shell printf '\#include "id.h"\nID_VENDOR' | ${CC} -I.. -E - | grep -v ^\# )
+
+
+%.dfu: %.elf
+ @#printf " OBJCOPY $(*).dfu\n"
+ $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).dfu
+
+dfu:${PROG}.dfu
+ dfu-util -R -a 0 -d ${VID}:${DID} -s 0x08004000:leave -D $<
+
+
program: ${PROG}.hex
scp $< ${HOST}:/tmp/img.hex
echo init | nc -t ${HOST} 4444