add initial stm32 project

This commit is contained in:
j3d1 2023-02-11 03:01:45 +01:00
parent 60cf251dcb
commit 8247927af7
7 changed files with 100 additions and 3 deletions

View file

@ -0,0 +1,3 @@
build/
compile_commands.json
.idea/

View file

@ -96,6 +96,8 @@ SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S
VERSIONCMD = ../../../firmware/build_version_object.sh
#######################################
# CFLAGS
@ -179,8 +181,13 @@ $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(VERSIONCMD)
$(V)mkdir -p $(dir $@)
$(V)$(eval VERSION_OBJECT = $(shell mktemp /tmp/fiatlux_version_object.XXXXXX.o))
$(V)$(VERSIONCMD) $(notdir $@) $(VERSION_OBJECT) $(CC) $(CPPFLAGS) $(CXXFLAGS)
@echo link $@
$(V)$(CC) $(OBJECTS) $(VERSION_OBJECT) $(LDFLAGS) -o $@
$(V)rm $(VERSION_OBJECT)
$(SZ) $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
@ -203,4 +210,4 @@ clean:
#######################################
-include $(wildcard $(BUILD_DIR)/*.d)
# *** EOF ***
# *** EOF ***