forked from sakitume/SilverLite-FC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstm32cubemx.mk
102 lines (95 loc) · 3.78 KB
/
stm32cubemx.mk
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#-------------------------------------------------------------------------------
# STM32CubeMX generated/provided startup file
#-------------------------------------------------------------------------------
ifneq ($(filter $(TARGET),NOX MATEKF411RX),)
SOURCES += \
$(BASE_DIR)/startup_stm32f411xe.s
else ifneq ($(filter $(TARGET),OMNIBUS CRAZYBEEF3FS),)
SOURCES += \
$(BASE_DIR)/startup_stm32f303cctx.s
else ifeq ($(TARGET),OMNIBUSF4)
SOURCES += \
$(BASE_DIR)/startup_stm32f405xx.s
else
$(error TARGET must be in: $(F4_TARGETS) $(F3_TARGETS))
endif
ifeq ($(IS_F4_TARGET), 1)
#-- F4 targets are expected to have these STM32CubeMX generated source files
SOURCES += \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/main.c \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/stm32f4xx_it.c \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/stm32f4xx_hal_msp.c \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/system_stm32f4xx.c
else
#-- F3 targets are expected to have these STM32CubeMX generated source files
SOURCES += \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/main.c \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/stm32f3xx_it.c \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/stm32f3xx_hal_msp.c \
$(BASE_DIR)/Targets/$(TARGET)/Core/Src/system_stm32f3xx.c
endif
#-------------------------------------------------------------------------------
# STM32CubeMX generated includes
#-------------------------------------------------------------------------------
INCLUDE_DIRS += \
$(BASE_DIR)/Targets/$(TARGET)/Core/Inc \
#-------------------------------------------------------------------------------
# STM32 sources
#-------------------------------------------------------------------------------
ifeq ($(IS_F4_TARGET), 1)
#-- F4 targets are expected to use these STM32CubeMX provided source files
SOURCES += $(wildcard $(BASE_DIR)/Drivers/STM32F4xx_HAL_Driver/Src/*.c)
else
#-- F3 targets are expected to use these STM32CubeMX provided source files
SOURCES += $(wildcard $(BASE_DIR)/Drivers/STM32F3xx_HAL_Driver/Src/*.c)
endif
#-------------------------------------------------------------------------------
# STM32 Defines
#-------------------------------------------------------------------------------
DEFINES += \
USE_HAL_DRIVER \
ifeq ($(TARGET),OMNIBUSF4)
DEFINES += \
STM32F405xx \
STM32F4
else ifneq ($(filter $(TARGET),NOX MATEKF411RX),)
DEFINES += \
STM32F411xE \
STM32F4
else ifneq ($(filter $(TARGET),OMNIBUS CRAZYBEEF3FS),)
DEFINES += \
STM32F303xC \
STM32F3
else
$(error TARGET must be in: $(F4_TARGETS) $(F3_TARGETS))
endif
#-------------------------------------------------------------------------------
# STM32 Include directories
#-------------------------------------------------------------------------------
ifeq ($(IS_F4_TARGET), 1)
#-- F4 targets are expected to use these folders
INCLUDE_DIRS += \
$(BASE_DIR)/Drivers/STM32F4xx_HAL_Driver/Inc \
$(BASE_DIR)/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy \
$(BASE_DIR)/Drivers/CMSIS/Device/ST/STM32F4xx/Include
else
#-- F3 targets are expected to use these folders
INCLUDE_DIRS += \
$(BASE_DIR)/Drivers/STM32F3xx_HAL_Driver/Inc \
$(BASE_DIR)/Drivers/STM32F3xx_HAL_Driver/Inc/Legacy \
$(BASE_DIR)/Drivers/CMSIS/Device/ST/STM32F3xx/Include
endif
INCLUDE_DIRS += \
$(BASE_DIR)/Drivers/CMSIS/Include
#-------------------------------------------------------------------------------
# STM32 link script
#-------------------------------------------------------------------------------
ifeq ($(TARGET),OMNIBUSF4)
LDSCRIPT = $(BASE_DIR)/STM32F405RGTx_FLASH.ld
else ifneq ($(filter $(TARGET),NOX MATEKF411RX),)
LDSCRIPT = $(BASE_DIR)/STM32F411CEUx_FLASH.ld
else ifneq ($(filter $(TARGET),OMNIBUS CRAZYBEEF3FS),)
LDSCRIPT = $(BASE_DIR)/STM32F303CCTX_FLASH.ld
else
$(error TARGET must be in: $(F4_TARGETS) $(F3_TARGETS))
endif