Repository navigation
Expand file tree
/
Copy pathcircuitpython.mk
More file actions
73 lines (66 loc) · 3.33 KB
/
Copy pathcircuitpython.mk
File metadata and controls
73 lines (66 loc) · 3.33 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
# CircuitPython build glue for audiodsp, read through USER_C_MODULES.
#
# micropython.mk includes this file when the tree being built is CircuitPython,
# so one module directory serves both interpreters:
#
# make -C ports/unix USER_C_MODULES=/path/to/audiodsp
# make -C ports/espressif BOARD=... USER_C_MODULES=/path/to/audiodsp
#
# CircuitPython already has audiocore, synthio, audiomixer, audiomp3,
# audiofilters, audiodelays, audiofreeverb and audiospeed, and its audio
# outputs (audiobusio, audioio, audiopwmio) play anything that speaks its
# audiosample protocol. So this compiles only the modules CircuitPython lacks,
# written against that protocol (src/circuitpython_spike/), plus the
# runtime-neutral DSP they share with the MicroPython and CPython builds
# (src/shared/). CircuitPython's own audio modules stay CircuitPython's: a
# second audiocore under the same name would not link, and boards' audio
# outputs are built against theirs.
#
# Each binding registers its module with MP_REGISTER_MODULE, so nothing in
# CircuitPython's own tree is edited and no CIRCUITPY_* switch is needed for
# these modules. CircuitPython's audiocore is needed (CIRCUITPY_AUDIOCORE=1,
# the default wherever a board has an audio output, and on the unix port).
AUDIODSP_CP_DIR := $(USERMOD_DIR)
AUDIODSP_CP_SRC := $(AUDIODSP_CP_DIR)/src
AUDIODSP_CP_SPIKE := $(AUDIODSP_CP_SRC)/circuitpython_spike
# The bindings include "shared-bindings/<module>/..." and "shared-module/...",
# and the DSP "shared/audiodsp_*.h". CircuitPython's own -I$(TOP) comes first,
# so its audiocore and synthio headers are the ones these resolve to.
CFLAGS_USERMOD += -I$(AUDIODSP_CP_SPIKE) -I$(AUDIODSP_CP_SRC)
AUDIODSP_CP_MODULES := audiodynamics audioroute audiomath audioecho audioshaper \
audioladder audioconvolve audiobiquad audioverb audiomodal audiosampler \
audiovorbis
AUDIODSP_CP_SOURCES := \
$(foreach m,$(AUDIODSP_CP_MODULES),$(sort $(wildcard $(AUDIODSP_CP_SPIKE)/shared-bindings/$(m)/*.c))) \
$(foreach m,$(AUDIODSP_CP_MODULES),$(sort $(wildcard $(AUDIODSP_CP_SPIKE)/shared-module/$(m)/*.c)))
AUDIODSP_CP_SOURCES += $(addprefix $(AUDIODSP_CP_SRC)/shared/, \
audiodsp_dynamics.c \
audiodsp_splitter.c \
audiodsp_midside.c \
audiodsp_multiply.c \
audiodsp_suboctave.c \
audiodsp_feedback_delay.c \
audiodsp_shaper.c \
audiodsp_samplehold.c \
audiodsp_ladder.c \
audiodsp_trig.c \
audiodsp_fft.c \
audiodsp_convolve.c \
audiodsp_filter_f32.c \
audiodsp_tank.c \
audiodsp_modal.c \
audiodsp_sampler.c \
audiodsp_vorbis.c \
audiodsp_port.c \
)
SRC_USERMOD_C += $(AUDIODSP_CP_SOURCES)
# CircuitPython's board ports append -Werror=float-equal and
# -Werror=double-promotion (espressif, among others) after CFLAGS_USERMOD, so a
# module-wide -Wno-* would lose. The shared float kernels compare against exact
# zero on purpose (a tail that reaches exact zero is the point of several of
# them) and are byte-for-byte the code the MicroPython and CPython builds run,
# so they are built as they are, with the two warnings off for their objects
# only. py.mk puts a module's objects under $(BUILD)/<module directory name>/.
AUDIODSP_CP_OBJ_CFLAGS := -Wno-float-equal -Wno-double-promotion
$(foreach _s,$(filter $(AUDIODSP_CP_SRC)/shared/%,$(AUDIODSP_CP_SOURCES)),\
$(eval $(BUILD)/$(notdir $(AUDIODSP_CP_DIR))/$(patsubst $(AUDIODSP_CP_DIR)/%.c,%.o,$(_s)): CFLAGS += $(AUDIODSP_CP_OBJ_CFLAGS)))