summaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-03 18:05:45 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-03-03 18:05:45 +0100
commit4d80111cad6891cd0e1d5da59e83222d39933e41 (patch)
tree497a09e8c8fc0e776fb2b7d3f07dfd07334f527b /controller
parent33e99ed37ff6b30e633dd536d84837f582109bb4 (diff)
downloadmaster-thesis-4d80111cad6891cd0e1d5da59e83222d39933e41.tar.gz
master-thesis-4d80111cad6891cd0e1d5da59e83222d39933e41.tar.bz2
master-thesis-4d80111cad6891cd0e1d5da59e83222d39933e41.zip
wip
Diffstat (limited to 'controller')
-rw-r--r--controller/fw/Makefile38
1 files changed, 24 insertions, 14 deletions
diff --git a/controller/fw/Makefile b/controller/fw/Makefile
index ba22571..a4b8a66 100644
--- a/controller/fw/Makefile
+++ b/controller/fw/Makefile
@@ -49,14 +49,23 @@ FMEAS_FFT_WINDOW ?= gaussian
FMEAS_FFT_WINDOW_SIGMA ?= 8.0
-CC := $(PREFIX)gcc
-CXX := $(PREFIX)g++
-LD := $(PREFIX)gcc
-AR := $(PREFIX)ar
-AS := $(PREFIX)as
-OBJCOPY := $(PREFIX)objcopy
-OBJDUMP := $(PREFIX)objdump
-GDB := $(PREFIX)gdb
+CC ?= $(PREFIX)gcc
+CXX ?= $(PREFIX)g++
+LD ?= $(PREFIX)gcc
+AR ?= $(PREFIX)ar
+AS ?= $(PREFIX)as
+OBJCOPY ?= $(PREFIX)objcopy
+OBJDUMP ?= $(PREFIX)objdump
+GDB ?= $(PREFIX)gdb
+
+HOST_CC ?= $(HOST_PREFIX)gcc
+HOST_CXX ?= $(HOST_PREFIX)g++
+HOST_LD ?= $(HOST_PREFIX)gcc
+HOST_AR ?= $(HOST_PREFIX)ar
+HOST_AS ?= $(HOST_PREFIX)as
+HOST_OBJCOPY ?= $(HOST_PREFIX)objcopy
+HOST_OBJDUMP ?= $(HOST_PREFIX)objdump
+
PYTHON3 ?= python3
OPENCM3_DIR_ABS := $(abspath $(OPENCM3_DIR))
@@ -72,9 +81,9 @@ COMMON_CFLAGS += -I$(abspath musl_include_shims) -Ilevmarq
COMMON_CFLAGS += -Os -std=gnu11 -g -DSTM32F4
CFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
-SIM_CFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=soft
+#SIM_CFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=soft
# Note: libopencm3 requires some standard libc definitions from stdint.h and stdbool.h, so we don't pass -nostdinc here.
-COMMON_CFLAGS += -nostdlib -ffreestanding
+CFLAGS += -nostdlib -ffreestanding
CFLAGS += -fno-common -ffunction-sections -fdata-sections
COMMON_CFLAGS += -DGOLD_CODE_NBITS=$(GOLD_CODE_NBITS) -DFMEAS_FFT_LEN=$(FMEAS_FFT_LEN) -DFMEAS_ADC_MAX=$(FMEAS_ADC_MAX)
COMMON_CFLAGS += -DFMEAS_ADC_SAMPLING_RATE=$(FMEAS_ADC_SAMPLING_RATE)
@@ -95,7 +104,7 @@ CXXFLAGS += -Wall -Wextra -Wshadow -Wundef -Wredundant-decls
CXXFLAGS += -I.
COMMON_LDFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g
-COMMON_LDFLAGS += --static -nostartfiles
+LDFLAGS += --static -nostartfiles
LDFLAGS += -Wl,--cre
#LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
@@ -103,7 +112,7 @@ LDFLAGS += -L$(OPENCM3_DIR_ABS)/lib -l$(OPENCM3_LIB) $(shell $(CC) -print-libg
all: $(BUILDDIR)/$(BINARY)
-tests: tools/freq_meas_test.elf
+tests: $(BUILDDIR)/tools/freq_meas_test.elf
OBJS := $(addprefix $(BUILDDIR)/,$(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o))
@@ -118,8 +127,9 @@ ALL_OBJS += $(BUILDDIR)/generated/fmeas_fft_window.o
$(BUILDDIR)/$(BINARY): $(ALL_OBJS)
$(LD) -T$(LDSCRIPT) $(COMMON_LDFLAGS) $(LDFLAGS) -o $@ -Wl,-Map=$(BUILDDIR)/src/$*.map $^
-tools/freq_meas_test.elf: tools/freq_meas_test.c src/freq_meas.c $(CMSIS_SOURCES) $(BUILDDIR)/musl/lib/libc.a
- $(CC) $(COMMON_CFLAGS) $(SIM_CFLAGS) -lm -lgcc -lnosys -o $@ $^
+$(BUILDDIR)/tools/freq_meas_test.elf: tools/freq_meas_test.c src/freq_meas.c levmarq/levmarq.c $(BUILDDIR)/generated/fmeas_fft_window.c $(CMSIS_SOURCES)
+ mkdir -p $(@D)
+ $(HOST_CC) $(COMMON_CFLAGS) $(SIM_CFLAGS) -o $@ $^
$(BUILDDIR)/src/%.o: src/%.c
mkdir -p $(@D)