1+ # #########################################################################################################################
2+ # File automatically-generated by tool: [projectgenerator] version: [4.5.0-RC5] date: [Thu Aug 14 17:51:47 CDT 2025]
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 = vcu-firmware
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/gpio.c \
41+ Core/Src/tim.c \
42+ Core/Src/stm32g4xx_it.c \
43+ Core/Src/stm32g4xx_hal_msp.c \
44+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pwr_ex.c \
45+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_tim.c \
46+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_tim_ex.c \
47+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.c \
48+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_rcc.c \
49+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_rcc_ex.c \
50+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash.c \
51+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash_ex.c \
52+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_flash_ramfunc.c \
53+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_gpio.c \
54+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_exti.c \
55+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_dma.c \
56+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_dma_ex.c \
57+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_pwr.c \
58+ Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal_cortex.c \
59+ Core/Src/system_stm32g4xx.c \
60+ Core/Src/sysmem.c \
61+ Core/Src/syscalls.c
62+
63+ # ASM sources
64+ ASM_SOURCES = \
65+ startup_stm32g474xx.s
66+
67+ # ASM sources
68+ ASMM_SOURCES =
69+
70+
71+ # ######################################
72+ # binaries
73+ # ######################################
74+ PREFIX = arm-none-eabi-
75+ # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
76+ # either it can be added to the PATH environment variable.
77+ ifdef GCC_PATH
78+ CC = $(GCC_PATH ) /$(PREFIX ) gcc
79+ AS = $(GCC_PATH ) /$(PREFIX ) gcc -x assembler-with-cpp
80+ CP = $(GCC_PATH ) /$(PREFIX ) objcopy
81+ SZ = $(GCC_PATH ) /$(PREFIX ) size
82+ else
83+ CC = $(PREFIX ) gcc
84+ AS = $(PREFIX ) gcc -x assembler-with-cpp
85+ CP = $(PREFIX ) objcopy
86+ SZ = $(PREFIX ) size
87+ endif
88+ HEX = $(CP ) -O ihex
89+ BIN = $(CP ) -O binary -S
90+
91+ # ######################################
92+ # CFLAGS
93+ # ######################################
94+ # cpu
95+ CPU = -mcpu=cortex-m4
96+
97+ # fpu
98+ FPU = -mfpu=fpv4-sp-d16
99+
100+ # float-abi
101+ FLOAT-ABI = -mfloat-abi=hard
102+
103+ # mcu
104+ MCU = $(CPU ) -mthumb $(FPU ) $(FLOAT-ABI )
105+
106+ # macros for gcc
107+ # AS defines
108+ AS_DEFS =
109+
110+ # C defines
111+ C_DEFS = \
112+ -DUSE_HAL_DRIVER \
113+ -DSTM32G474xx
114+
115+
116+ # AS includes
117+ AS_INCLUDES =
118+
119+ # C includes
120+ C_INCLUDES = \
121+ -ICore/Inc \
122+ -IDrivers/STM32G4xx_HAL_Driver/Inc \
123+ -IDrivers/STM32G4xx_HAL_Driver/Inc/Legacy \
124+ -IDrivers/CMSIS/Device/ST/STM32G4xx/Include \
125+ -IDrivers/CMSIS/Include
126+
127+
128+ # compile gcc flags
129+ ASFLAGS = $(MCU ) $(AS_DEFS ) $(AS_INCLUDES ) $(OPT ) -Wall -fdata-sections -ffunction-sections
130+
131+ CFLAGS += $(MCU ) $(C_DEFS ) $(C_INCLUDES ) $(OPT ) -Wall -fdata-sections -ffunction-sections
132+
133+ ifeq ($(DEBUG ) , 1)
134+ CFLAGS += -g -gdwarf-2
135+ endif
136+
137+
138+ # Generate dependency information
139+ CFLAGS += -MMD -MP -MF"$(@:%.o=%.d ) "
140+
141+
142+ # ######################################
143+ # LDFLAGS
144+ # ######################################
145+ # link script
146+ LDSCRIPT = stm32g474vetx_flash.ld
147+
148+ # libraries
149+ LIBS = -lc -lm -lnosys
150+ LIBDIR =
151+ LDFLAGS = $(MCU ) -specs=nano.specs -T$(LDSCRIPT ) $(LIBDIR ) $(LIBS ) -Wl,-Map=$(BUILD_DIR ) /$(TARGET ) .map,--cref -Wl,--gc-sections
152+
153+ # default action: build all
154+ all : $(BUILD_DIR ) /$(TARGET ) .elf $(BUILD_DIR ) /$(TARGET ) .hex $(BUILD_DIR ) /$(TARGET ) .bin
155+
156+
157+ # ######################################
158+ # build the application
159+ # ######################################
160+ # list of objects
161+ OBJECTS = $(addprefix $(BUILD_DIR ) /,$(notdir $(C_SOURCES:.c=.o ) ) )
162+ vpath % .c $(sort $(dir $(C_SOURCES ) ) )
163+ # list of ASM program objects
164+ OBJECTS += $(addprefix $(BUILD_DIR ) /,$(notdir $(ASM_SOURCES:.s=.o ) ) )
165+ vpath % .s $(sort $(dir $(ASM_SOURCES ) ) )
166+ OBJECTS += $(addprefix $(BUILD_DIR ) /,$(notdir $(ASMM_SOURCES:.S=.o ) ) )
167+ vpath % .S $(sort $(dir $(ASMM_SOURCES ) ) )
168+
169+ $(BUILD_DIR ) /% .o : % .c Makefile | $(BUILD_DIR )
170+ $(CC ) -c $(CFLAGS ) -Wa,-a,-ad,-alms=$(BUILD_DIR ) /$(notdir $(<:.c=.lst ) ) $< -o $@
171+
172+ $(BUILD_DIR ) /% .o : % .s Makefile | $(BUILD_DIR )
173+ $(AS ) -c $(CFLAGS ) $< -o $@
174+ $(BUILD_DIR ) /% .o : % .S Makefile | $(BUILD_DIR )
175+ $(AS ) -c $(CFLAGS ) $< -o $@
176+
177+ $(BUILD_DIR ) /$(TARGET ) .elf : $(OBJECTS ) Makefile
178+ $(CC ) $(OBJECTS ) $(LDFLAGS ) -o $@
179+ $(SZ ) $@
180+
181+ $(BUILD_DIR ) /% .hex : $(BUILD_DIR ) /% .elf | $(BUILD_DIR )
182+ $(HEX ) $< $@
183+
184+ $(BUILD_DIR ) /% .bin : $(BUILD_DIR ) /% .elf | $(BUILD_DIR )
185+ $(BIN ) $< $@
186+
187+ $(BUILD_DIR ) :
188+ mkdir $@
189+
190+ # ######################################
191+ # clean up
192+ # ######################################
193+ clean :
194+ -rm -fR $(BUILD_DIR )
195+
196+ # ######################################
197+ # dependencies
198+ # ######################################
199+ -include $(wildcard $(BUILD_DIR ) /* .d)
200+
201+ # *** EOF ***
0 commit comments