refactored code, moved user-relevant defines to config.h

This commit is contained in:
Niklas Fauth
2018-02-09 08:53:25 +01:00
parent 86c6106fb7
commit 94907b91cf
9 changed files with 1099 additions and 250 deletions

View File

@@ -37,6 +37,8 @@ Src/system_stm32f1xx.c \
Src/setup.c \
Src/stm32f1xx_it.c \
Src/main.c \
Src/bldc.c \
Src/comms.c \
# ASM sources
ASM_SOURCES = \
@@ -53,7 +55,7 @@ AR = $(PREFIX)ar
SZ = $(PREFIX)size
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
#######################################
# CFLAGS
#######################################
@@ -71,7 +73,7 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
AS_DEFS =
# C defines
C_DEFS = \
@@ -80,7 +82,7 @@ C_DEFS = \
# AS includes
AS_INCLUDES =
AS_INCLUDES =
# C includes
C_INCLUDES = \
@@ -130,7 +132,7 @@ vpath %.c $(sort $(dir $(C_SOURCES)))
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
@@ -142,12 +144,12 @@ $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@
$(BIN) $< $@
$(BUILD_DIR):
mkdir $@
mkdir $@
format:
find Src/ Inc/ -iname '*.h' -o -iname '*.c' | xargs clang-format -i
@@ -156,10 +158,10 @@ format:
#######################################
clean:
-rm -fR .dep $(BUILD_DIR)
#######################################
# dependencies
#######################################
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***
# *** EOF ***