Subversion Repositories CharLCD

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
##########################################################################################################################
2
# File automatically-generated by tool: [projectgenerator] version: [3.16.0] date: [Tue Aug 23 14:55:22 BST 2022] 
3
##########################################################################################################################
4
 
5
# ------------------------------------------------
6
# Generic Makefile (based on gcc)
7
#
8
# ChangeLog :
9
#	2017-02-10 - Several enhancements + project update mode
10
#   2015-07-22 - first version
11
# ------------------------------------------------
12
 
13
######################################
14
# target
15
######################################
16
TARGET = CharLCD
17
 
18
 
19
######################################
20
# building variables
21
######################################
22
# debug build?
23
DEBUG = 1
24
# optimization
25
OPT = -Og
26
 
27
 
28
#######################################
29
# paths
30
#######################################
31
# Build path
32
BUILD_DIR = build
33
 
34
######################################
35
# source
36
######################################
37
# C sources
38
C_SOURCES =  \
39
Core/Src/main.c \
40
Core/Src/stm32f1xx_it.c \
41
Core/Src/stm32f1xx_hal_msp.c \
42
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
43
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
44
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
45
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
46
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
47
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
48
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
49
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
50
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
51
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
52
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
53
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
54
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
55
Core/Src/system_stm32f1xx.c
56
 
57
# ASM sources
58
ASM_SOURCES =  \
59
startup_stm32f103x6.s
60
 
61
# User added 
62
CPP_SOURCES = \
63
Core/Src/runner.cpp
64
 
65
 
66
#######################################
67
# binaries
68
#######################################
69
PREFIX = arm-none-eabi-
70
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
71
# either it can be added to the PATH environment variable.
72
ifdef GCC_PATH
73
CC = $(GCC_PATH)/$(PREFIX)gcc
74
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
75
CP = $(GCC_PATH)/$(PREFIX)objcopy
76
SZ = $(GCC_PATH)/$(PREFIX)size
77
## User added 
78
CXX = $(GCC_PATH)/$(PREFIX)g++
79
else
80
CC = $(PREFIX)gcc
81
AS = $(PREFIX)gcc -x assembler-with-cpp
82
CP = $(PREFIX)objcopy
83
SZ = $(PREFIX)size
84
## User added
85
CXX = $(PREFIX)g++
86
endif
87
HEX = $(CP) -O ihex
88
BIN = $(CP) -O binary -S
89
 
90
#######################################
91
# CFLAGS
92
#######################################
93
# cpu
94
CPU = -mcpu=cortex-m3
95
 
96
# fpu
97
# NONE for Cortex-M0/M0+/M3
98
 
99
# float-abi
100
 
101
 
102
# mcu
103
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
104
 
105
# macros for gcc
106
# AS defines
107
AS_DEFS = 
108
 
109
# C defines
110
C_DEFS =  \
111
-DUSE_HAL_DRIVER \
112
-DSTM32F103x6
113
 
114
 
115
# AS includes
116
AS_INCLUDES = 
117
 
118
# C includes
119
C_INCLUDES =  \
120
-ICore/Inc \
121
-IDrivers/STM32F1xx_HAL_Driver/Inc \
122
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
123
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
124
-IDrivers/CMSIS/Include
125
 
126
#############################################
127
## User added
128
##Add libraries
129
LIBCHARLCD = ../libCharLCD
130
include $(LIBCHARLCD)/libCharLCD.mk
131
 
132
 
133
# compile gcc flags
134
ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
135
 
136
CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
137
 
138
ifeq ($(DEBUG), 1)
139
CFLAGS += -g -gdwarf-2
140
endif
141
 
142
 
143
# Generate dependency information
144
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
145
 
146
## User added
147
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
148
 
149
 
150
#######################################
151
# LDFLAGS
152
#######################################
153
# link script
154
LDSCRIPT = STM32F103C6Tx_FLASH.ld
155
 
156
# libraries
157
LIBS = -lc -lm -lnosys 
158
LIBDIR = 
159
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
160
 
161
# default action: build all
162
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
163
 
164
 
165
#######################################
166
# build the application
167
#######################################
168
# list of objects
169
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
170
vpath %.c $(sort $(dir $(C_SOURCES)))
171
# list of ASM program objects
172
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
173
vpath %.s $(sort $(dir $(ASM_SOURCES)))
174
 
175
## User added List of C++ compiled objects 
176
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
177
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))
178
 
179
## User added C++ compilation rule
180
$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR) 
181
	$(CXX) -c $(CXXFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
182
 
183
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
184
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
185
 
186
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
187
	$(AS) -c $(CFLAGS) $< -o $@
188
 
189
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
190
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
191
	$(SZ) $@
192
 
193
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
194
	$(HEX) $< $@
195
 
196
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
197
	$(BIN) $< $@	
198
 
199
$(BUILD_DIR):
200
	mkdir $@		
201
 
202
#######################################
203
# clean up
204
#######################################
205
clean:
206
	-rm -fR $(BUILD_DIR)
207
 
208
#######################################
209
# dependencies
210
#######################################
211
-include $(wildcard $(BUILD_DIR)/*.d)
212
 
213
# *** EOF ***