summaryrefslogtreecommitdiff
path: root/supervisor/supervisor.mk
blob: 56ad8a3ba60dd3aafb5761c8ae737381853fcd40 (plain)
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
SRC_SUPERVISOR = \
	main.c \
	supervisor/port.c \
	supervisor/shared/autoreload.c \
	supervisor/shared/filesystem.c \
	supervisor/shared/flash.c \
	supervisor/shared/micropython.c \
	supervisor/shared/rgb_led_status.c \
	supervisor/shared/safe_mode.c \
	supervisor/shared/stack.c \
	supervisor/shared/status_leds.c \
	supervisor/shared/translate.c

ifndef $(NO_USB)
NO_USB = $(wildcard supervisor/usb.c)
endif


# Choose which flash filesystem impl to use.
# (Right now INTERNAL_FLASH_FILESYSTEM and SPI_FLASH_FILESYSTEM are mutually exclusive.
# But that might not be true in the future.)
ifdef EXTERNAL_FLASH_DEVICES
	CFLAGS += -DEXTERNAL_FLASH_DEVICES=$(EXTERNAL_FLASH_DEVICES) \
				-DEXTERNAL_FLASH_DEVICE_COUNT=$(EXTERNAL_FLASH_DEVICE_COUNT)

	SRC_SUPERVISOR += supervisor/shared/external_flash/external_flash.c
	ifeq ($(SPI_FLASH_FILESYSTEM),1)
		CFLAGS += -DSPI_FLASH_FILESYSTEM
		SRC_SUPERVISOR += supervisor/shared/external_flash/spi_flash.c
	endif
	ifeq ($(QSPI_FLASH_FILESYSTEM),1)
		CFLAGS += -DQSPI_FLASH_FILESYSTEM
		SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c
	endif
else
	SRC_SUPERVISOR += supervisor/internal_flash.c
endif

ifeq ($(USB),FALSE)
	ifeq ($(wildcard supervisor/serial.c),)
		SRC_SUPERVISOR += supervisor/stub/serial.c
	else
		SRC_SUPERVISOR += supervisor/serial.c
	endif
else
	SRC_SUPERVISOR += lib/tinyusb/src/common/tusb_fifo.c \
					  lib/tinyusb/src/device/usbd.c \
					  lib/tinyusb/src/device/usbd_control.c \
					  lib/tinyusb/src/class/msc/msc_device.c \
					  lib/tinyusb/src/class/cdc/cdc_device.c \
					  lib/tinyusb/src/class/hid/hid_device.c \
					  lib/tinyusb/src/tusb.c \
					  supervisor/shared/serial.c \
					  supervisor/usb.c \
					  supervisor/shared/usb/usb_desc.c \
					  supervisor/shared/usb/usb.c \
					  supervisor/shared/usb/usb_msc_flash.c \
					  shared-bindings/usb_hid/__init__.c \
					  shared-bindings/usb_hid/Device.c \
					  shared-module/usb_hid/__init__.c \
					  shared-module/usb_hid/Device.c \
					  $(BUILD)/autogen_usb_descriptor.c
	CFLAGS += -DUSB_AVAILABLE
endif

SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o))

$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h

$(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate

.INTERMEDIATE: autogen_usb_descriptor.intermediate

autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile | $(HEADER_BUILD)
	$(STEPECHO) "GEN $@"
	$(Q)install -d $(BUILD)/genhdr
	$(Q)$(PYTHON3) ../../tools/gen_usb_descriptor.py \
		--manufacturer $(USB_MANUFACTURER)\
		--product $(USB_PRODUCT)\
		--vid $(USB_VID)\
		--pid $(USB_PID)\
		--serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\
		--output_c_file $(BUILD)/autogen_usb_descriptor.c\
		--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h