This repository was archived by the owner on Oct 19, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmicropython.mk
More file actions
148 lines (127 loc) · 4.36 KB
/
Copy pathmicropython.mk
File metadata and controls
148 lines (127 loc) · 4.36 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# MicroPython user C module glue for displayif.
#
# Discovered via USER_C_MODULES pointing at the workspace directory that
# contains this repo (its parent), e.g. `make USER_C_MODULES=../../..`.
# Hardware interfaces (spibus, dotclockframebuffer, …) build only on MCU ports.
# Desktop SDL (`usdl2`) builds on unix and windows ports.
DISPLAYIF_MOD_DIR := $(USERMOD_DIR)
# CircuitPython (its py/ has circuitpy_mpconfig.h): usdl2 on the unix port,
# nothing else. Boards there have CircuitPython's own displayio, and displayif's
# display modules are not ported to it.
DISPLAYIF_CIRCUITPY := $(if $(wildcard $(TOP)/py/circuitpy_mpconfig.h),1,0)
ifeq ($(DISPLAYIF_CIRCUITPY),1)
ifeq ($(findstring /ports/unix,$(abspath $(CURDIR))),)
$(error displayif on CircuitPython is usdl2 on the unix port only; boards use CircuitPython's displayio)
endif
CFLAGS_USERMOD += -DDISPLAYIF_USER_C_MODULE=1
endif
PORT_DIR_ABS := $(abspath $(CURDIR))
DISPLAYIF_PORT_ESP32 := $(findstring /ports/esp32,$(PORT_DIR_ABS))
DISPLAYIF_PORT_MIMXRT := $(findstring /ports/mimxrt,$(PORT_DIR_ABS))
DISPLAYIF_PORT_SAMD := $(findstring /ports/samd,$(PORT_DIR_ABS))
DISPLAYIF_PORT_RP2 := $(findstring /ports/rp2,$(PORT_DIR_ABS))
DISPLAYIF_PORT_STM32 := $(findstring /ports/stm32,$(PORT_DIR_ABS))
DISPLAYIF_PORT_UNIX := $(findstring /ports/unix,$(PORT_DIR_ABS))
DISPLAYIF_PORT_WINDOWS := $(findstring /ports/windows,$(PORT_DIR_ABS))
ifeq ($(DISPLAYIF_PORT_ESP32),)
DISPLAYIF_PORT_ESP32 := 0
else
DISPLAYIF_PORT_ESP32 := 1
endif
ifeq ($(DISPLAYIF_PORT_MIMXRT),)
DISPLAYIF_PORT_MIMXRT := 0
else
DISPLAYIF_PORT_MIMXRT := 1
endif
ifeq ($(DISPLAYIF_PORT_SAMD),)
DISPLAYIF_PORT_SAMD := 0
else
DISPLAYIF_PORT_SAMD := 1
endif
ifeq ($(DISPLAYIF_PORT_RP2),)
DISPLAYIF_PORT_RP2 := 0
else
DISPLAYIF_PORT_RP2 := 1
endif
ifeq ($(DISPLAYIF_PORT_STM32),)
DISPLAYIF_PORT_STM32 := 0
else
DISPLAYIF_PORT_STM32 := 1
endif
ifeq ($(DISPLAYIF_PORT_UNIX),)
DISPLAYIF_PORT_UNIX := 0
else
DISPLAYIF_PORT_UNIX := 1
endif
ifeq ($(DISPLAYIF_PORT_WINDOWS),)
DISPLAYIF_PORT_WINDOWS := 0
else
DISPLAYIF_PORT_WINDOWS := 1
endif
DISPLAYIF_IS_MCU := 0
ifeq ($(DISPLAYIF_PORT_ESP32),1)
DISPLAYIF_IS_MCU := 1
endif
ifeq ($(DISPLAYIF_PORT_MIMXRT),1)
DISPLAYIF_IS_MCU := 1
endif
ifeq ($(DISPLAYIF_PORT_SAMD),1)
DISPLAYIF_IS_MCU := 1
endif
ifeq ($(DISPLAYIF_PORT_RP2),1)
DISPLAYIF_IS_MCU := 1
endif
ifeq ($(DISPLAYIF_PORT_STM32),1)
DISPLAYIF_IS_MCU := 1
endif
ifeq ($(DISPLAYIF_IS_MCU),1)
ifeq ($(DISPLAYIF_PORT_ESP32),1)
ifeq ($(IDF_TARGET),esp32s3)
DISPLAYIF_RGBMATRIX_USE_PROTOMATTER = 1
endif
endif
ifeq ($(DISPLAYIF_PORT_MIMXRT),1)
ifeq ($(MCU_SERIES),MIMXRT1062)
DISPLAYIF_RGBMATRIX_USE_PROTOMATTER = 1
endif
endif
ifeq ($(DISPLAYIF_PORT_SAMD),1)
ifeq ($(MCU_SERIES),SAMD51)
DISPLAYIF_RGBMATRIX_USE_PROTOMATTER = 1
endif
endif
ifeq ($(DISPLAYIF_PORT_RP2),1)
DISPLAYIF_RGBMATRIX_USE_PROTOMATTER = 1
endif
include $(DISPLAYIF_MOD_DIR)/src/ports/common/micropython.mk
endif
ifeq ($(DISPLAYIF_PORT_ESP32),1)
include $(DISPLAYIF_MOD_DIR)/src/ports/esp32/micropython.mk
endif
ifeq ($(DISPLAYIF_PORT_MIMXRT),1)
include $(DISPLAYIF_MOD_DIR)/src/ports/mimxrt/micropython.mk
endif
ifeq ($(DISPLAYIF_PORT_SAMD),1)
include $(DISPLAYIF_MOD_DIR)/src/ports/samd/micropython.mk
endif
ifeq ($(DISPLAYIF_PORT_RP2),1)
include $(DISPLAYIF_MOD_DIR)/src/ports/rp2/micropython.mk
endif
ifeq ($(DISPLAYIF_PORT_STM32),1)
include $(DISPLAYIF_MOD_DIR)/src/ports/stm32/micropython.mk
endif
# Desktop SDL bindings (`import usdl2`) for SDLDisplay / multimer.
ifneq ($(DISPLAYIF_PORT_UNIX)$(DISPLAYIF_PORT_WINDOWS),00)
include $(DISPLAYIF_MOD_DIR)/src/ports/desktop/usdl2/micropython.mk
endif
# The JPEG decoder, jpegio, moved to micropython-pydevices' modules/jpegio.
# displayif_revision_obj, read as <module>.__revision__ on every module here.
# src/include is on the path here, not only in ports/common/micropython.mk,
# because a port that builds no display module (webassembly) never includes that.
CFLAGS_USERMOD += -I$(DISPLAYIF_MOD_DIR)/src/include
SRC_USERMOD_C += $(DISPLAYIF_MOD_DIR)/src/ports/common/build.c
# --- which displayif this firmware was built from ---------------------------
# Computed at build time from this repo's own git, never stored; "unknown" when
# there is no git (a tarball). Read on a target as <module>.__revision__.
DISPLAYIF_REVISION := $(shell git -C $(DISPLAYIF_MOD_DIR) describe --always --dirty --abbrev=7 2>/dev/null || echo unknown)
CFLAGS_USERMOD += -DDISPLAYIF_REVISION='"$(DISPLAYIF_REVISION)"'