1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-22 18:09:42 +02:00
wernermisc/labsw/fw/Makefile

58 lines
1.4 KiB
Makefile
Raw Normal View History

#
# labsw/Makefile - Makefile for the Lab Switch firmware
#
# Written 2011 by Werner Almesberger
# Copyright 2011 Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
MAIN = labsw
OBJS = $(MAIN) usb descr version ep0
F32XBASE = ../../../f32xbase
include $(F32XBASE)/fw/common/Makefile.system
include $(F32XBASE)/fw/common/Makefile.common
CFLAGS += -Iinclude
LDFLAGS += --code-size $(PAYLOAD_SIZE) --code-loc $(PAYLOAD_START)
USB_ID = $(shell \
( echo '\#include "usb-id.h"'; echo USB_VENDOR:USB_PRODUCT; ) | \
cpp | sed '/^ *$$/d;/^\#/d' )
.PHONY: dfu
all: $(MAIN)
$(MAIN).rel: io-parts.h
io-parts.h: io.h Makefile
cpp -dD $< | \
sed '1,/IO_H/d' | \
awk \
'BEGIN { print "/* MACHINE-GENERATED. DO NOT EDIT ! */"; \
print "#ifndef IO_PARTS_H"; \
print "#define IO_PARTS_H"; } \
/#define/ && $$3 != "" { \
split($$3, a, "_"); \
print $$1, $$2 "_PORT", a[1]; \
print $$1, $$2 "_MODE", a[1] "MDOUT"; \
print $$1, $$2 "_BIT", a[2]; } \
END { print "#endif" }' >$@ || \
{ rm -f $@; exit 1; }
clean::
rm -f io-parts.h
# hack: for now, we just reuse the boot loader from cntr
USB_ID = 20b7:cb72
dfu:
dfu-util -d $(USB_ID) -D $(MAIN).bin