Root/atusb/fw2/Makefile

Source at commit ec21e4ba4756379934fc24635438040f66d2ab7c created 8 years 9 months ago.
By Werner Almesberger, atusb/fw2: support device -> host side of the ATUSB EP0 protocol
1NAME = atusb
2CFLAGS = -g -Wall -Wextra -Wshadow -Werror -Wno-unused \
3     -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes
4
5CHIP=atmega32u2
6CHIP_AVRDUDE=at90usb162 # @@@ fix this when support for the ATmega32U2 becomes
7            # available
8
9AVR_PREFIX = $(BIN_PATH) avr-
10CC = $(AVR_PREFIX)gcc
11OBJCOPY = $(AVR_PREFIX)objcopy
12#OBJDUMP = $(AVR_PREFIX)objdump
13
14FreakUSB = usb
15USB_OBJS = $(FreakUSB)/usb/usb.o $(FreakUSB)/usb/ctrl.o \
16  $(FreakUSB)/usb/usb_buf.o \
17  $(FreakUSB)/hw/at90usbxx2/ep.o $(FreakUSB)/hw/at90usbxx2/hw.o \
18  $(FreakUSB)/hw/at90usbxx2/isr.o
19OBJS = atusb.o spi.o descr.o ep0.o $(USB_OBJS)
20
21CFLAGS += -I../fw/include \
22      -I$(FreakUSB)/usb -I$(FreakUSB)/hw/at90usbxx2 \
23      -DNUM_EPS=1
24
25.PHONY: all clean upload prog
26
27all: $(NAME).bin
28
29%.o: %.c
30        $(CC) $(CFLAGS) -mmcu=$(CHIP) -Os -c $<
31
32$(NAME).elf: $(OBJS)
33        $(CC) $(CFLAGS) -mmcu=$(CHIP) -o $@ $(notdir $(OBJS))
34
35%.bin: %.elf
36        $(OBJCOPY) -j .text -j .data -O binary $< $@
37
38clean:
39        rm -f $(NAME).bin $(NAME).elf $(notdir $(OBJS))
40
41upload: $(NAME).bin
42        scp $(NAME).bin jlime:
43
44prog:
45        ssh jlime avrdude -F -p $(CHIP_AVRDUDE) -c nanonote_atusb -e \
46          -U flash:w:$(NAME).bin:r \
47          -U lfuse:w:0x60:m # external clock, slow start-up
48
49on:
50        ssh jlime poke 0x10010318 4
51
52off:
53        ssh jlime poke 0x10010314 4
54

Archive Download this file



interactive