Mario Hüttel
963b1e106c
Updater RAM Code ---------------- * Ack running watchdog every 250 ms * Blink green LED every 250 ms Firmware -------- * Add RAM code loader * Reorganize initialization * Add update command to shell
63 lines
1.7 KiB
Makefile
63 lines
1.7 KiB
Makefile
RAM_CODE_TARGET = updater-ram-code
|
|
OBJDIR = obj
|
|
CFILES = main.c startup.c
|
|
LINKER_SCRIPT = ram-link.ld
|
|
MAPFILE = $(RAM_CODE_TARGET)
|
|
PREFIX = arm-none-eabi-
|
|
|
|
CC = $(PREFIX)gcc
|
|
OBJCOPY = $(PREFIX)objcopy
|
|
SIZE = $(PREFIX)size
|
|
|
|
ifneq ($(VERBOSE),true)
|
|
QUIET=@
|
|
else
|
|
QUIET=
|
|
endif
|
|
|
|
|
|
DEFINES = -DSTM32F407xx -DSTM32F4XX -DHSE_VALUE=8000000UL
|
|
INCLUDEPATH = -Iinclude
|
|
|
|
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
|
|
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
|
|
LFLAGS += -T$(LINKER_SCRIPT) -Wl,-Map=$(MAPFILE).map -Wl,--print-memory-usage -g3
|
|
|
|
CFLAGS = -c -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork -Os -g3
|
|
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
|
|
CFLAGS += -Wall -Wextra -Wold-style-declaration -Wuninitialized -Wmaybe-uninitialized -Wunused-parameter -Wimplicit-fallthrough=3 -Wsign-compare
|
|
|
|
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
|
|
|
|
default: $(RAM_CODE_TARGET).bin.c
|
|
|
|
all: $(RAM_CODE_TARGET).bin.c
|
|
|
|
%.bin.h: %.bin
|
|
@echo "[BIN2H] $@"
|
|
$(QUIET)python bin2carray.py $@ $^
|
|
|
|
$(RAM_CODE_TARGET).bin: $(RAM_CODE_TARGET).elf
|
|
@echo "[ELF2BIN] $@"
|
|
$(QUIET)$(OBJCOPY) -O binary $^ $@
|
|
|
|
$(RAM_CODE_TARGET).elf: $(OBJ) $(LINKER_SCRIPT)
|
|
@echo [LD] $@
|
|
$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $(OBJ) $(ASOBJ) $(LIBRARIES)
|
|
$(QUIET)$(SIZE) $@
|
|
|
|
$(OBJ):
|
|
@echo [CC] $@
|
|
$(eval OUTPATH=$(dir $@))
|
|
@mkdir -p $(OUTPATH)
|
|
$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.c.o=%.c)
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
@echo [CLEAN]
|
|
$(QUIET)rm -f $(OBJ) $(MAPFILE).map $(CFILES:%.c=$(OBJDIR)/%.c.d) $(RAM_CODE_TARGET).bin $(RAM_CODE_TARGET).elf $(RAM_CODE_TARGET).bin.c
|
|
|
|
-include $(CFILES:%.c=$(OBJDIR)/%.c.d)
|
|
|