-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcu.mk
67 lines (54 loc) · 1.72 KB
/
mcu.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
# Define library paths
STMFW_PATH := third_party/STM32F0-Discovery_FW_V1.0.0
STMLIB_PATH := $(STMFW_PATH)/Libraries
STMPROJ_PATH := $(STMFW_PATH)/Project
STMUTILS_PATH := $(STMFW_PATH)/Utilities
DRIVER_PATH := $(STMLIB_PATH)/STM32F0xx_StdPeriph_Driver
DEMO_PATH := $(STMPROJ_PATH)/Demonstration
PERIPH_EX_PATH := $(STMPROJ_PATH)/Peripheral_Examples
CMSIS_PATH := $(STMLIB_PATH)/CMSIS
# Define files that will get compiled
LINKER_SCRIPT := $(DEMO_PATH)/TrueSTUDIO/STM32F0-Discovery_Demo/stm32_flash.ld
_DRIVER_SRC := stm32f0xx_adc.c \
stm32f0xx_cec.c \
stm32f0xx_comp.c \
stm32f0xx_crc.c \
stm32f0xx_dac.c \
stm32f0xx_dbgmcu.c \
stm32f0xx_dma.c \
stm32f0xx_exti.c \
stm32f0xx_flash.c \
stm32f0xx_gpio.c \
stm32f0xx_i2c.c \
stm32f0xx_iwdg.c \
stm32f0xx_misc.c \
stm32f0xx_pwr.c \
stm32f0xx_rcc.c \
stm32f0xx_rtc.c \
stm32f0xx_spi.c \
stm32f0xx_syscfg.c \
stm32f0xx_tim.c \
stm32f0xx_usart.c \
stm32f0xx_wwdg.c
DRIVER_SRC := $(patsubst %,$(DRIVER_PATH)/src/%,$(_DRIVER_SRC))
_DISC_SRC := stm32f0_discovery.c
DISC_SRC := $(patsubst %,$(STMUTILS_PATH)/STM32F0-Discovery/%,$(_DISC_SRC))
MCU:=cortex-m0
# Include (arm headers, stm32f0xx headers, Discovery specific headers)
INCLUDE_FLAGS := -I$(CMSIS_PATH)/Include \
-I$(CMSIS_PATH)/ST/STM32F0xx/Include \
-I$(STMUTILS_PATH)/STM32F0-Discovery \
-I$(DRIVER_PATH)/inc \
GENERIC_MCU_FLAGS := -mcpu=$(MCU) \
-mthumb
# Externally used variables
MCU_STARTUP := $(CMSIS_PATH)/ST/STM32F0xx/Source/Templates/gcc_ride7/startup_stm32f0xx.s
MCU_CFLAGS := $(INCLUDE_FLAGS) \
-fomit-frame-pointer \
-DRUN_FROM_FLASH=1 \
$(GENERIC_MCU_FLAGS)
MCU_LDFLAGS := -nostartfiles \
-T$(LINKER_SCRIPT) \
$(GENERIC_MCU_FLAGS)
MCU_ASFLAGS := $(GENERIC_MCU_FLAGS)
MCU_SRC := $(DRIVER_SRC) $(DISC_SRC)