-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·71 lines (61 loc) · 2.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# path to STM32F103 standard peripheral library
STD_PERIPH_LIBS ?= ./STM32F4xx_DSP_StdPeriph_Lib_V1.9.0/Libraries/STM32F4xx_StdPeriph_Driver
STD_PERIPH_LIBS_CMSIS ?= ./STM32F4xx_DSP_StdPeriph_Lib_V1.9.0/Libraries/CMSIS
SRC ?= ./src
# list of source files
SOURCES = $(SRC)/main.c
SOURCES += $(SRC)/vect.c
SOURCES += $(SRC)/font.c
SOURCES += $(SRC)/adc.c
SOURCES += $(SRC)/databuf.c
SOURCES += $(SRC)/stm32_ub_vga_screen.c
SOURCES += $(STD_PERIPH_LIBS)/src/stm32f4xx_rcc.c
SOURCES += $(STD_PERIPH_LIBS)/src/stm32f4xx_gpio.c
SOURCES += $(STD_PERIPH_LIBS)/src/stm32f4xx_rcc.c
SOURCES += $(STD_PERIPH_LIBS)/src/stm32f4xx_tim.c
SOURCES += $(STD_PERIPH_LIBS)/src/misc.c
SOURCES += $(STD_PERIPH_LIBS)/src/stm32f4xx_dma.c
SOURCES += $(STD_PERIPH_LIBS)/src/stm32f4xx_adc.c
SOURCES += $(STD_PERIPH_LIBS_CMSIS)/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c
SOURCES += $(SRC)/startup_stm32f401xx.s
#SOURCES += $(STD_PERIPH_LIBS)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/TrueSTUDIO/startup_stm32f10x_md.s
# name for output binary files
PROJECT ?= vga
# compiler, objcopy (should be in PATH)
CC = arm-unknown-eabi-gcc
OBJCOPY = arm-unknown-eabi-objcopy
# path to st-flash (or should be specified in PATH)
ST_FLASH ?= st-flash
# specify compiler flags
CFLAGS = -g -O2 -Wall
#CFLAGS += -T$(STD_PERIPH_LIBS)/Project/STM32F10x_StdPeriph_Template/TrueSTUDIO/STM3210B-EVAL/stm32_flash.ld
#CFLAGS += -T$(STD_PERIPH_LIBS)/Project/STM32F4xx_StdPeriph_Templates/TrueSTUDIO/STM32F401xx/STM32F401VC_FLASH.ld
CFLAGS += -TSTM32F401CCUX_FLASH.ld
CFLAGS += -L/usr/lib/gcc/arm-unknown-eabi/12/../../../../arm-unknown-eabi/lib/thumb/v7e-m+fp/hard/
CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
#CFLAGS += -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER
CFLAGS += -DSTM32F401xx -DSTM32F401xC -DUSE_STDPERIPH_DRIVER
CFLAGS += -Wl,--gc-sections
CFLAGS += -I.
#CFLAGS += -I$(STD_PERIPH_LIBS)/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/
CFLAGS += -I$(STD_PERIPH_LIBS_CMSIS)/Device/ST/STM32F4xx/Include/
CFLAGS += -I$(STD_PERIPH_LIBS_CMSIS)/Include/
#CFLAGS += -I$(STD_PERIPH_LIBS)/Libraries/CMSIS/CM3/CoreSupport
CFLAGS += -I$(STD_PERIPH_LIBS)/inc
CFLAGS += -Iinc
CFLAGS += -g
CFLAGS += -fno-math-errno
OBJS = $(SOURCES:.c=.o)
all: $(PROJECT).elf
# compile
$(PROJECT).elf: $(SOURCES)
$(CC) $(CFLAGS) $^ -o $@ -lm -lc
#$(OBJCOPY) -O ihex $(PROJECT).elf $(PROJECT).hex
#$(OBJCOPY) -O binary $(PROJECT).elf $(PROJECT).bin
# remove binary files
clean:
rm -f *.o *.elf *.hex *.bin
# flash
burn:
sudo $(ST_FLASH) write $(PROJECT).bin 0x8000000