-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
108 lines (79 loc) · 2.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# The Cypress FX2 is a programmable USB interface chip found on the Atlys and
# Opsis board (and many other devices out there).
#
# The IC is an 8051 core with a hardware support for the USB protocol. Firmware
# for the FX2 is developed using the fx2lib library and compiled with the SDCC
# compiler.
#
# The firmware can be loaded via USB using a number of tools such as fxload or
# fpgalink. Loading new firmware will cause the FX2 to disconnect and then
# reconnect to the USB bus, often causing it to change USB IDs and device
# files.
#
# Being a programmable device, the FX2 can emulate many other USB devices. We
# use it to emulate a USB UVC Webcam and a USB CDC-ACM serial port.
#
MODESWITCH_CMD = hdmi2usb-mode-switch
FX2LIBDIR = ./third_party/fx2lib
TARGETS += fx2
help-fx2:
@echo " make load-fx2"
@echo " make view"
gateware-generate-fx2:
@true
gateware-build-fx2:
cp gateware/streamer/vhdl/header.hex $(MSCDIR)/build/header.hex
# Firmware for the Cypress FX2
firmware-fx2: hdmi2usb/hdmi2usb.hex
@true
embed-fx2: firmware/lm32/fx2_fw_hdmi2usb.c
@true
load-fx2: hdmi2usb/hdmi2usb.hex
$(MODESWITCH_CMD) --load-fx2-firmware hdmi2usb/hdmi2usb.hex
flash-fx2:
@true
clean-fx2:
$(MAKE) -C hdmi2usb clean
hdmi2usb/hdmi2usb.hex:
$(MAKE) -C hdmi2usb
firmware/lm32/fx2_fw_hdmi2usb.c: microload/generate_2nd_stage.py hdmi2usb/hdmi2usb.hex
microload/generate_2nd_stage.py hdmi2usb/hdmi2usb.hex > firmware/lm32/fx2_fw_hdmi2usb.c
# Audio firmware for the Cypress FX2
firmware-audio-fx2: audio/audio.hex
@true
load-audio-fx2: audio/audio.hex
$(MODESWITCH_CMD) --load-fx2-firmware audio/audio.hex
clean-audio-fx2:
$(MAKE) -C audio clean
audio/audio.hex:
$(MAKE) -C audio
# Default USB VID/PID for the FX2
flash-unconfigured:
$(MAKE) -C eeprom-unconfigured flash
firmware-unconfigured:
$(MAKE) -C eeprom-unconfigured hdmi2usb_unconfigured.iic
clean-unconfigured:
$(MAKE) -C eeprom-unconfigured clean
# Microload
microload: fifo-microload fifo-i2c
fifo-microload:
$(MAKE) -C microload fifo
i2c-microload:
$(MAKE) -C microload i2c
clean-microload:
$(MAKE) -C microload clean
# Utility functions
view:
./scripts/view-hdmi2usb.sh
docs: export PROJECT_NUMBER:=$(shell git describe --always --dirty --long)
docs:
doxygen docs/docs.conf
clean-docs:
rm -fr docs/html docs/latex
# We depend on the .git file inside the directory as git creates an empty dir
# for us.
$(FX2LIBDIR)/.git: .gitmodules
git submodule sync --recursive -- $$(dirname $@)
git submodule update --recursive --init $$(dirname $@)
touch $@ -r .gitmodules
.PHONY: docs clean-docs help-fx2 gateware-fx2 firmware-fx2 load-fx2 clean-fx2 view