Compare commits
3 Commits
b73f79b53f
...
6b557384f3
Author | SHA1 | Date | |
---|---|---|---|
6b557384f3 | |||
58d3af6632 | |||
6d3afeb075 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
project.elf
|
||||
*.lss
|
||||
*.o
|
||||
*.map
|
||||
*.bin
|
||||
@ -7,3 +8,4 @@ project.elf
|
||||
*.user
|
||||
*.user*
|
||||
*.user.*
|
||||
obj/*
|
||||
|
66
Makefile
66
Makefile
@ -7,8 +7,9 @@ CFILES = main.c syscalls/syscalls.c setup/system_init.c startup/startup_stm32f7
|
||||
ASFILES =
|
||||
INCLUDEPATH = -Iinclude
|
||||
|
||||
OBJDIR := obj
|
||||
|
||||
target = project
|
||||
TARGET = project
|
||||
LIBRARYPATH = -Lstartup -Ldsp
|
||||
LIBRARIES = -larm_cortexM7lfsp_math -lm
|
||||
|
||||
@ -29,56 +30,59 @@ SIZE=arm-none-eabi-size
|
||||
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m7 -mthumb-interwork
|
||||
LFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
||||
LFLAGS += -Tstm32f746zgt-axim.ld -Wl,-Map=$(mapfile).map -Wl,--gc-sections
|
||||
LFLAGS += -Wl,--print-memory-usage
|
||||
|
||||
CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m7 -mthumb-interwork
|
||||
CFLAGS = -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m7 -mthumb-interwork
|
||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv5-sp-d16 -nostartfiles -Wall
|
||||
|
||||
####################################################################################
|
||||
|
||||
OBJ = $(CFILES:%.c=%.c.o)
|
||||
ASOBJ = $(ASFILES:%.S=%.S.o)
|
||||
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
||||
ASOBJ = $(ASFILES:%.S=$(OBJDIR)/%.S.o)
|
||||
|
||||
default: $(target).elf
|
||||
DEPENDENCY_FILES = $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
|
||||
|
||||
binary: $(target).bin $(target).hex
|
||||
default: $(TARGET).elf
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $^ $@
|
||||
@echo [BIN] $@
|
||||
@$(OBJCOPY) -O binary $^ $@
|
||||
%.hex: %.elf
|
||||
$(OBJCOPY) -O ihex $^ $@
|
||||
@echo [HEX] $@
|
||||
@$(OBJCOPY) -O ihex $^ $@
|
||||
|
||||
#Linking
|
||||
$(target).elf: $(OBJ) $(ASOBJ)
|
||||
$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
|
||||
$(SIZE) $@
|
||||
$(TARGET).elf: $(OBJ) $(ASOBJ)
|
||||
@$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
|
||||
@$(SIZE) $@
|
||||
|
||||
#Compiling
|
||||
%.c.o: %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDEPATH) $(DEFINES) -o $@ $<
|
||||
$(OBJ):
|
||||
@echo [CC] $@
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ -c $(@:$(OBJDIR)/%.c.o=%.c)
|
||||
|
||||
%.S.o: %.S
|
||||
$(CC) $(CFLAGS) $(INCLUDEPATH) $(DEFINES) -o $@ $<
|
||||
$(ASOBJ):
|
||||
@echo [AS] $@
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ -c $(@:$(OBJDIR)/%.S.o=%.S)
|
||||
|
||||
.PHONY: qtproject clean mrproper objcopy disassemble
|
||||
.PHONY: clean mrproper objcopy disassemble binary
|
||||
|
||||
disassemble: $(target).elf
|
||||
$(OBJDUMP) -D -s $< > $(target).lss
|
||||
binary: $(TARGET).bin $(TARGET).hex
|
||||
|
||||
objcopy: $(target).bin $(target).hex
|
||||
disassemble: $(TARGET).elf
|
||||
$(OBJDUMP) -D -s $< > $(TARGET).lss
|
||||
|
||||
objcopy: $(TARGET).bin $(TARGET).hex
|
||||
|
||||
mrproper:
|
||||
rm -f $(target).pro
|
||||
rm -f $(TARGET).pro
|
||||
|
||||
clean:
|
||||
rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map $(target).lss
|
||||
qtproject:
|
||||
echo -e "TEMPLATE = app\nCONFIG -= console app_bundle qt" > $(target).pro
|
||||
echo -e "SOURCES += $(CFILES) $(ASFILES)" >> $(target).pro
|
||||
echo -ne "INCLUDEPATH += " >> $(target).pro
|
||||
echo "$(INCLUDEPATH)" | sed "s!-I!./!g" >> $(target).pro
|
||||
echo -ne "HEADERS += " >> $(target).pro
|
||||
find -name "*.h" | tr "\\n" " " >> $(target).pro
|
||||
echo -ne "\nDEFINES += " >> $(target).pro
|
||||
echo "$(DEFINES)" | sed "s/-D//g" >> $(target).pro
|
||||
|
||||
@echo [RM] in $(OBJDIR)
|
||||
@rm -f $(TARGET).elf $(TARGET).bin $(TARGET).hex $(OBJ) $(ASOBJ) $(mapfile).map $(TARGET).lss $(DEPENDENCY_FILES)
|
||||
@rm -rf $(OBJDIR)/*
|
||||
|
||||
# Include dependency files, if available
|
||||
-include $(DEPENDENCY_FILES)
|
||||
|
Loading…
Reference in New Issue
Block a user