aboutsummaryrefslogtreecommitdiff
path: root/driver_fw/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'driver_fw/Makefile')
-rw-r--r--driver_fw/Makefile19
1 files changed, 13 insertions, 6 deletions
diff --git a/driver_fw/Makefile b/driver_fw/Makefile
index c9393bf..8ae65b2 100644
--- a/driver_fw/Makefile
+++ b/driver_fw/Makefile
@@ -30,7 +30,7 @@ DEVICE := STM32G070RB
ASM_SOURCES := startup.s
-C_SOURCES := src/main.c
+C_SOURCES := src/main.c $(BUILDDIR)/generated/waveform_tables.c
CPP_SOURCES := # - none -
@@ -93,6 +93,8 @@ COMMON_CFLAGS += -O$(OPT) -std=gnu2x -g
COMMON_CFLAGS += $(DEVICE_DEFINES)
COMMON_CFLAGS += -DDEBUG=$(DEBUG)
+GEN_HEADERS := $(BUILDDIR)/generated/waveform_tables.h
+
HOST_CFLAGS += $(COMMON_CFLAGS)
# for musl
@@ -152,7 +154,7 @@ $(BUILDDIR)/src/%.o: src/%.s
mkdir -p $(@D)
$(CC) $(COMMON_CFLAGS) $(CFLAGS) $(INT_CFLAGS) -o $@ -c $<
-$(BUILDDIR)/src/%.o: src/%.c
+$(BUILDDIR)/src/%.o: src/%.c $(GEN_HEADERS)
mkdir -p $(@D)
$(CC) $(COMMON_CFLAGS) $(CFLAGS) $(INT_CFLAGS) -o $@ -c $<
@@ -168,21 +170,26 @@ $(BUILDDIR)/%.o: %.s
mkdir -p $(@D)
$(CC) $(COMMON_CFLAGS) $(CFLAGS) $(EXT_CFLAGS) -o $@ -c $<
+$(BUILDDIR)/generated/waveform_tables.c: tools/template_wave_tables.py $(BUILDDIR)/generated/waveform_tables.h
+ mkdir -p $(@D)
+ python $< $@
+
+$(BUILDDIR)/generated/waveform_tables.h: tools/template_wave_tables.py
+ mkdir -p $(@D)
+ python $< --header $@
+
venv:
test -d venv || python3 -m venv --system-site-packages venv
source venv/bin/activate && pip install cxxfilt pyelftools libarchive matplotlib
clean:
rm -rf $(BUILDDIR)/src
+ rm -rf $(BUILDDIR)/generated
rm -f $(BUILDDIR)/**.o
rm -f $(BUILDDIR)/$(BINARY)
rm -f $(BUILDDIR)/$(BINARY:.elf=.map)
rm -f $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.dot)
rm -f $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.pdf)
- rm -f $(BUILDDIR)/crc32_test
- rm -f $(BUILDDIR)/microcobs_test_sg
- rm -f $(BUILDDIR)/microcobs_test
- rm -f $(BUILDDIR)/microcobs_decode_test
mrproper: clean
rm -rf build