2015-07-21 08:22:16 +02:00
|
|
|
TARGET=main
|
|
|
|
all: burn
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-08-05 10:41:18 +02:00
|
|
|
DEFS = -DSTM32F30X
|
2015-07-21 08:22:16 +02:00
|
|
|
STARTUP = lib/startup_stm32f30x.s
|
|
|
|
|
2015-07-22 15:12:21 +02:00
|
|
|
MCU = cortex-m4
|
2015-07-21 08:22:16 +02:00
|
|
|
MCFLAGS = -mcpu=$(MCU) -mthumb -mlittle-endian -mthumb-interwork
|
|
|
|
|
|
|
|
STM32_INCLUDES = -Ilib -I. -ISTM32F30x_StdPeriph_Driver/inc
|
|
|
|
|
2015-07-22 15:12:21 +02:00
|
|
|
OPTIMIZE = -Ofast -mfloat-abi=hard -mfpu=fpv4-sp-d16 -flto -ffunction-sections -fdata-sections -Wl,--relax
|
2015-07-21 08:22:16 +02:00
|
|
|
|
|
|
|
CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
|
|
|
|
-I. \
|
|
|
|
$(STM32_INCLUDES) \
|
|
|
|
-I../embeddedcommon \
|
|
|
|
-Wl,-T,lib/stm32f303.ld
|
2020-08-05 10:41:18 +02:00
|
|
|
|
2015-07-21 08:22:16 +02:00
|
|
|
CFLAGS+=-DDEBUG
|
2020-08-05 10:41:18 +02:00
|
|
|
|
2020-08-05 19:28:14 +02:00
|
|
|
#If you use a TQFP STM32F303. (x6, x8)
|
2020-08-05 10:41:18 +02:00
|
|
|
CFLAGS+=-I. -DTQFP32 -DHSE_VALUE=8000000
|
|
|
|
|
2020-08-05 19:28:14 +02:00
|
|
|
#From the nucleos(sp?) (STM32F303xB/xC)
|
2020-08-05 10:41:18 +02:00
|
|
|
#CFLAGS+=-I. -DHSE_VALUE=25000000
|
2015-07-21 08:22:16 +02:00
|
|
|
|
|
|
|
AFLAGS = $(MCFLAGS)
|
|
|
|
|
|
|
|
SRC = main.c \
|
|
|
|
spi2812.c \
|
|
|
|
stm32f30x_it.c \
|
|
|
|
lib/system_stm32f30x.c \
|
|
|
|
lib/systems.c \
|
|
|
|
adc.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_dma.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_spi.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_tim.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_adc.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_misc.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_rcc.c \
|
|
|
|
STM32F30x_StdPeriph_Driver/src/stm32f30x_gpio.c \
|
|
|
|
../embeddedcommon/DFT32.c \
|
|
|
|
../embeddedcommon/embeddednf.c \
|
|
|
|
../embeddedcommon/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)
|