diff options
author | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2020-02-27 15:02:12 +0100 |
---|---|---|
committer | jaseg <git-bigdata-wsl-arch@jaseg.de> | 2020-02-27 15:02:12 +0100 |
commit | 621f66ff6e60ad08788102ac336d9093f3c95fca (patch) | |
tree | 78a58afb28656a2179441d050863636bb2345254 /controller | |
parent | b489a1b12f2f574ed24237601b3797b58d302196 (diff) | |
download | master-thesis-621f66ff6e60ad08788102ac336d9093f3c95fca.tar.gz master-thesis-621f66ff6e60ad08788102ac336d9093f3c95fca.tar.bz2 master-thesis-621f66ff6e60ad08788102ac336d9093f3c95fca.zip |
MUSL experiments
Diffstat (limited to 'controller')
-rw-r--r-- | controller/fw/Makefile | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/controller/fw/Makefile b/controller/fw/Makefile index 9895c87..8b0dbd1 100644 --- a/controller/fw/Makefile +++ b/controller/fw/Makefile @@ -11,6 +11,7 @@ C_SOURCES += $(MSPDEBUG_DIR)/drivers/jtaglib.c C_SOURCES += $(CMSIS_DIR)/CMSIS/DSP/Source/TransformFunctions/arm_rfft_f32.c C_SOURCES += $(CMSIS_DIR)/CMSIS/DSP/Source/TransformFunctions/arm_bitreversal.c C_SOURCES += $(CMSIS_DIR)/CMSIS/DSP/Source/TransformFunctions/arm_cfft_radix4_f32.c +C_SOURCES += $(MUSL_DIR)/src/math/tanhf.c $(MUSL_DIR)/src/math/atanhf.c CXX_SOURCES += src/ldpc_wrapper.cpp @@ -31,21 +32,22 @@ OBJCOPY := $(PREFIX)objcopy OBJDUMP := $(PREFIX)objdump GDB := $(PREFIX)gdb -OPENCM3_DIR := $(abspath $(OPENCM3_DIR)) -CMSIS_DIR := $(abspath $(CMSIS_DIR)) -MSPDEBUG_DIR := $(abspath $(MSPDEBUG_DIR)) -LIBSODIUM_DIR := $(abspath $(LIBSODIUM_DIR)) -TINYAES_DIR := $(abspath $(TINYAES_DIR)) -MUSL_DIR := $(abspath $(MUSL_DIR)) +OPENCM3_DIR_ABS := $(abspath $(OPENCM3_DIR)) +CMSIS_DIR_ABS := $(abspath $(CMSIS_DIR)) +MSPDEBUG_DIR_ABS := $(abspath $(MSPDEBUG_DIR)) +LIBSODIUM_DIR_ABS := $(abspath $(LIBSODIUM_DIR)) +TINYAES_DIR_ABS := $(abspath $(TINYAES_DIR)) +MUSL_DIR_ABS := $(abspath $(MUSL_DIR)) -CFLAGS += -I$(OPENCM3_DIR)/include -Imspdebug/util -Imspdebug/drivers -CFLAGS += -I$(CMSIS_DIR)/CMSIS/DSP/Include -I$(CMSIS_DIR)/CMSIS/Core/Include +CFLAGS += -I$(OPENCM3_DIR_ABS)/include -Imspdebug/util -Imspdebug/drivers +CFLAGS += -I$(CMSIS_DIR_ABS)/CMSIS/DSP/Include -I$(CMSIS_DIR_ABS)/CMSIS/Core/Include CFLAGS += -Os -std=gnu11 -g -DSTM32F4 # Note: libopencm3 requires some standard libc definitions from stdint.h and stdbool.h, so we don't pass -nostdinc here. CFLAGS += -nostdlib -ffreestanding CFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 CFLAGS += -fno-common -ffunction-sections -fdata-sections +CFLAGS += -I$(MUSL_DIR_ABS)/src/internal -I$(MUSL_DIR_ABS)/include -I$(BUILDDIR)/musl/obj/include -I$(MUSL_DIR_ABS)/arch/arm -I$(MUSL_DIR_ABS)/arch/generic INT_CFLAGS += -Wextra -Wshadow -Wimplicit-function-declaration -Wundef INT_CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes @@ -63,14 +65,13 @@ LDFLAGS += -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -g LDFLAGS += -Wl,--cre #LDFLAGS += -Wl,--gc-sections LDFLAGS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -LDFLAGS += -L$(OPENCM3_DIR)/lib -l$(OPENCM3_LIB) $(shell $(CC) -print-libgcc-file-name) +LDFLAGS += -L$(OPENCM3_DIR_ABS)/lib -l$(OPENCM3_LIB) $(shell $(CC) -print-libgcc-file-name) all: $(BUILDDIR)/$(BINARY).elf OBJS := $(addprefix $(BUILDDIR)/,$(C_SOURCES:.c=.o) $(CXX_SOURCES:.cpp=.o)) - -$(BUILDDIR)/%.elf: $(OBJS) $(LDSCRIPT) $(OPENCM3_DIR)/lib/lib$(OPENCM3_LIB).a $(BUILDDIR)/libsodium/src/libsodium/.libs/libsodium.a $(BUILDDIR)/tinyaes/aes.o $(BUILDDIR)/musl/lib/libc.a +$(BUILDDIR)/%.elf: $(OBJS) $(LDSCRIPT) $(OPENCM3_DIR)/lib/lib$(OPENCM3_LIB).a $(BUILDDIR)/libsodium/src/libsodium/.libs/libsodium.a $(BUILDDIR)/tinyaes/aes.o $(LD) $(OBJS) $(LDFLAGS) -o $@ -Wl,-Map=$(BUILDDIR)/src/$*.map $(BUILDDIR)/libsodium/src/libsodium/.libs/libsodium.a $(BUILDDIR)/tinyaes/aes.o $(BUILDDIR)/src/%.o: src/%.c @@ -89,12 +90,18 @@ $(OPENCM3_DIR)/lib/lib$(OPENCM3_LIB).a: $(MAKE) -C $(OPENCM3_DIR) -j $(shell nproc) $(BUILDDIR)/libsodium/src/libsodium/.libs/libsodium.a: - mkdir -p build/libsodium - cd build/libsodium && CFLAGS="$(CFLAGS) -DDEV_MODE=1" $(LIBSODIUM_DIR)/configure --host=arm-none-eabi && $(MAKE) -j $(shell nproc) + mkdir -p $(BUILDDIR)/libsodium + cd $(BUILDDIR)/libsodium && CFLAGS="$(CFLAGS) -DDEV_MODE=1" $(LIBSODIUM_DIR_ABS)/configure --host=arm-none-eabi && $(MAKE) -j $(shell nproc) + +$(BUILDDIR)/musl/obj/include/bits/alltypes.h: + mkdir -p $(BUILDDIR)/musl + cd $(BUILDDIR)/musl && CFLAGS="$(CFLAGS)" CC=$(CC) LD=$(LD) AR=$(AR) $(MUSL_DIR_ABS)/configure && $(MAKE) TARGET=arm-linux-musleabihf GCC_CONFIG="--with-arch=armv7-m --with-fpu=fpv4_sp_d16" -j $(shell nproc) obj/include/bits/alltypes.h + +$(BUILDDIR)/$(MUSL_DIR)/src/math/tanhf.o $(BUILDDIR)/$(MUSL_DIR)/src/math/atanhf.o: $(BUILDDIR)/musl/obj/include/bits/alltypes.h $(BUILDDIR)/tinyaes/aes.o: mkdir -p $(@D) - make -C $(@D) -f $(TINYAES_DIR)/Makefile VPATH=$(TINYAES_DIR) CFLAGS="$(CFLAGS) -c" CC=$(CC) LD=$(LD) AR=$(AR) aes.o + make -C $(@D) -f $(TINYAES_DIR_ABS)/Makefile VPATH=$(TINYAES_DIR_ABS) CFLAGS="$(CFLAGS) -c" CC=$(CC) LD=$(LD) AR=$(AR) aes.o clean: -rm -r $(BUILDDIR)/src |