]> mj.ucw.cz Git - home-hw.git/blob - Makefile
048f2c7fa61f13a7b2d6b8be5b6101908eb7293d
[home-hw.git] / Makefile
1 ##########################################################################################################################
2 # File automatically-generated by tool: [projectgenerator] version: [2.27.0] date: [Sat May 26 12:54:44 CEST 2018] 
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 = test
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 # source path
32 SOURCES_DIR =  \
33 Drivers/STM32F0xx_HAL_Driver \
34 Application \
35 Application/User/Src/stm32f0xx_it.c \
36 Drivers/CMSIS \
37 Application/User/Src \
38 Application/User \
39 Application/User/Src/main.c \
40 Drivers
41
42 # firmware library path
43 PERIFLIB_PATH = 
44
45 # Build path
46 BUILD_DIR = build
47
48 ######################################
49 # source
50 ######################################
51 # C sources
52 C_SOURCES =  \
53 Src/main.c \
54 Src/main.c \
55 /Src/system_stm32f0xx.c \
56 Src/stm32f0xx_it.c \
57 Src/stm32f0xx_it.c \
58 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_exti.c \
59 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_usart.c \
60 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_gpio.c \
61 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_pwr.c \
62 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_utils.c \
63 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_rcc.c \
64 /aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_ll_dma.c
65
66 # ASM sources
67 ASM_SOURCES =  \
68 startup_stm32f030x8.s
69
70
71 ######################################
72 # firmware library
73 ######################################
74 PERIFLIB_SOURCES = 
75
76
77 #######################################
78 # binaries
79 #######################################
80 BINPATH = 
81 PREFIX = arm-none-eabi-
82 CC = $(BINPATH)/$(PREFIX)gcc
83 AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp
84 CP = $(BINPATH)/$(PREFIX)objcopy
85 AR = $(BINPATH)/$(PREFIX)ar
86 SZ = $(BINPATH)/$(PREFIX)size
87 HEX = $(CP) -O ihex
88 BIN = $(CP) -O binary -S
89  
90 #######################################
91 # CFLAGS
92 #######################################
93 # cpu
94 CPU = -mcpu=cortex-m0
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_FULL_LL_DRIVER \
112 -DSTM32F030x8
113
114
115 # AS includes
116 AS_INCLUDES = 
117
118 # C includes
119 C_INCLUDES =  \
120 -IInc \
121 -I/aux/misc/stm/F0-package/Drivers/STM32F0xx_HAL_Driver/Inc \
122 -I/aux/misc/stm/F0-package/Drivers/CMSIS/Device/ST/STM32F0xx/Include \
123 -I/aux/misc/stm/F0-package/Drivers/CMSIS/Include
124
125
126 # compile gcc flags
127 ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
128
129 CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
130
131 ifeq ($(DEBUG), 1)
132 CFLAGS += -g -gdwarf-2
133 endif
134
135
136 # Generate dependency information
137 CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
138
139
140 #######################################
141 # LDFLAGS
142 #######################################
143 # link script
144 LDSCRIPT = STM32F030R8Tx_FLASH.ld
145
146 # libraries
147 LIBS = -lc -lm -lnosys 
148 LIBDIR = 
149 LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
150
151 # default action: build all
152 all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
153
154
155 #######################################
156 # build the application
157 #######################################
158 # list of objects
159 OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
160 vpath %.c $(sort $(dir $(C_SOURCES)))
161 # list of ASM program objects
162 OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
163 vpath %.s $(sort $(dir $(ASM_SOURCES)))
164
165 $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
166         $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
167
168 $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
169         $(AS) -c $(CFLAGS) $< -o $@
170
171 $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
172         $(CC) $(OBJECTS) $(LDFLAGS) -o $@
173         $(SZ) $@
174
175 $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
176         $(HEX) $< $@
177         
178 $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
179         $(BIN) $< $@    
180         
181 $(BUILD_DIR):
182         mkdir $@                
183
184 #######################################
185 # clean up
186 #######################################
187 clean:
188         -rm -fR .dep $(BUILD_DIR)
189   
190 #######################################
191 # dependencies
192 #######################################
193 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
194
195 # *** EOF ***