Werner's Miscellanea
Sign in or create your account | Project List | Help
Werner's Miscellanea Git Source Tree
Root/
| 1 | # |
| 2 | # labsw/Makefile - Makefile for the Lab Switch firmware |
| 3 | # |
| 4 | # Written 2011 by Werner Almesberger |
| 5 | # Copyright 2011 Werner Almesberger |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | |
| 13 | |
| 14 | MAIN = labsw |
| 15 | OBJS = $(MAIN) usb descr version ep0 |
| 16 | |
| 17 | F32XBASE = ../../../f32xbase |
| 18 | |
| 19 | include $(F32XBASE)/fw/common/Makefile.system |
| 20 | include $(F32XBASE)/fw/common/Makefile.common |
| 21 | |
| 22 | CFLAGS += -Iinclude |
| 23 | LDFLAGS += --code-size $(PAYLOAD_SIZE) --code-loc $(PAYLOAD_START) |
| 24 | |
| 25 | USB_ID = $(shell \ |
| 26 | ( echo '\#include "usb-id.h"'; echo USB_VENDOR:USB_PRODUCT; ) | \ |
| 27 | cpp | sed '/^ *$$/d;/^\#/d' ) |
| 28 | |
| 29 | .PHONY: dfu |
| 30 | |
| 31 | all: $(MAIN) |
| 32 | |
| 33 | $(MAIN).rel: io-parts.h |
| 34 | |
| 35 | io-parts.h: io.h Makefile |
| 36 | cpp -dD $< | \ |
| 37 | sed '1,/IO_H/d' | \ |
| 38 | awk \ |
| 39 | 'BEGIN { print "/* MACHINE-GENERATED. DO NOT EDIT ! */"; \ |
| 40 | print "#ifndef IO_PARTS_H"; \ |
| 41 | print "#define IO_PARTS_H"; } \ |
| 42 | /#define/ && $$3 != "" { \ |
| 43 | split($$3, a, "_"); \ |
| 44 | print $$1, $$2 "_PORT", a[1]; \ |
| 45 | print $$1, $$2 "_MODE", a[1] "MDOUT"; \ |
| 46 | print $$1, $$2 "_BIT", a[2]; } \ |
| 47 | END { print "#endif" }' >$@ || \ |
| 48 | { rm -f $@; exit 1; } |
| 49 | |
| 50 | clean:: |
| 51 | rm -f io-parts.h |
| 52 | |
| 53 | # hack: for now, we just reuse the boot loader from cntr |
| 54 | USB_ID = 20b7:cb72 |
| 55 | |
| 56 | dfu: |
| 57 | dfu-util -d $(USB_ID) -D $(MAIN).bin |
| 58 |
Branches:
master
