sabik-cpu/firmware/Makefile

77 lines
1.6 KiB
Makefile

TARGET=main
all: $(TARGET).bin
PREFIX=arm-none-eabi
CC=$(PREFIX)-gcc
LD=$(PREFIX)-gcc
AS=$(PREFIX)-as
CP=$(PREFIX)-objcopy
OD=$(PREFIX)-objdump
OBJCOPYFLAGS = -O binary
BIN=$(CP) -O ihex
CCBASE = colorchord/embeddedstm32f407
DEFS = -DSTM32F40_41xxx -DHSE_VALUE=8000000 -DREVISION=\"`git rev-parse HEAD`\"
STARTUP = $(CCBASE)/lib/startup_stm32f40_41xxx.s
STLIB = $(CCBASE)/STM32F4xx_StdPeriph_Driver
EMCOM = $(CCBASE)/../embeddedcommon
MCU = cortex-m3
MCFLAGS = -mcpu=$(MCU) -mthumb -mlittle-endian -mthumb-interwork
STM32_INCLUDES = -Ilib -I. -I$(STLIB)/inc -I$(CCBASE)/lib
OPTIMIZE = -Os
CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
-I. \
$(STM32_INCLUDES) \
-I$(EMCOM) \
-Wl,-T,lib/stm32f410.ld
CFLAGS+=-DDEBUG
CFLAGS+=-I.
AFLAGS = $(MCFLAGS)
SRC = main.c \
stm32f4xx_it.c \
lib/system_stm32f4xx.c \
lib/systems.c \
spi2812.c \
adc.c \
$(STLIB)/src/misc.c \
$(STLIB)/src/stm32f4xx_dma.c \
$(STLIB)/src/stm32f4xx_spi.c \
$(STLIB)/src/stm32f4xx_syscfg.c \
$(STLIB)/src/stm32f4xx_exti.c \
$(STLIB)/src/stm32f4xx_rcc.c \
$(STLIB)/src/stm32f4xx_gpio.c \
$(STLIB)/src/stm32f4xx_usart.c \
$(STLIB)/src/stm32f4xx_adc.c \
$(STLIB)/src/stm32f4xx_tim.c \
$(EMCOM)/DFT32.c \
$(EMCOM)/embeddednf.c \
$(EMCOM)/embeddedout.c
burn : $(TARGET).bin
openocd -f flash.cfg #-d3
terminal :
openocd -f terminal.cfg
$(TARGET).bin : $(TARGET).out
$(CP) $(OBJCOPYFLAGS) $< $@
$(TARGET).hex: $(EXECUTABLE)
$(CP) -O ihex $^ $@
$(TARGET).out : $(SRC) $(STARTUP)
$(CC) $(CFLAGS) $^ -lm -lc -lnosys -o $@
clean:
rm -f $(TARGET).lst $(TARGET).out $(TARGET).hex $(TARGET).bin $(TARGET).map $(EXECUTABLE)