########################################################################################################################## # File automatically-generated by tool: [projectgenerator] version: [4.4.0-B60] date: [Tue Aug 20 20:15:41 CST 2024] ########################################################################################################################## # ------------------------------------------------ # Generic Makefile (based on gcc) with Linux kernel style output # # Usage: # make - Build with quiet output (Linux kernel style) # make V=1 - Build with verbose output (show full commands) # make clean - Clean build files # # ChangeLog : # 2017-02-10 - Several enhancements + project update mode # 2015-07-22 - first version # ------------------------------------------------ ###################################### # target ###################################### TARGET = Basic_Framework_MC02 ###################################### # building variables ###################################### # debug build? DEBUG = 1 # optimization OPT = -Og ####################################### # paths ####################################### # Build path BUILD_DIR = build ###################################### # source ###################################### # C sources C_SOURCES = \ Core/Src/main.c \ Core/Src/gpio.c \ Core/Src/freertos.c \ Core/Src/adc.c \ Core/Src/dma.c \ Core/Src/fdcan.c \ Core/Src/octospi.c \ Core/Src/spi.c \ Core/Src/tim.c \ Core/Src/usart.c \ Core/Src/stm32h7xx_it.c \ Core/Src/stm32h7xx_hal_msp.c \ Core/Src/stm32h7xx_hal_timebase_tim.c \ USB_DEVICE/App/usb_device.c \ USB_DEVICE/App/usbd_desc.c \ USB_DEVICE/App/usbd_cdc_if.c \ USB_DEVICE/Target/usbd_conf.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pcd_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_ll_usb.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_rcc_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_gpio.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_hsem.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_dma_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_mdma.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_pwr_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_cortex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_i2c_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_exti.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_adc_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_fdcan.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_ospi.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_spi_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_tim_ex.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c \ Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart_ex.c \ Core/Src/system_stm32h7xx.c \ Middlewares/Third_Party/FreeRTOS/Source/croutine.c \ Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \ Middlewares/Third_Party/FreeRTOS/Source/list.c \ Middlewares/Third_Party/FreeRTOS/Source/queue.c \ Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \ Middlewares/Third_Party/FreeRTOS/Source/tasks.c \ Middlewares/Third_Party/FreeRTOS/Source/timers.c \ Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c \ Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \ Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \ Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \ Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \ Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \ Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \ Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_printf.c \ Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT.c \ Core/Src/sysmem.c \ Core/Src/syscalls.c \ bsp/dwt/bsp_dwt.c \ bsp/pwm/bsp_pwm.c \ bsp/gpio/bsp_gpio.c \ bsp/spi/bsp_spi.c \ bsp/iic/bsp_iic.c \ bsp/can/bsp_can.c \ bsp/usart/bsp_usart.c \ bsp/log/bsp_log.c \ bsp/bsp_tools.c \ modules/algorithm/controller.c \ modules/algorithm/kalman_filter.c \ modules/algorithm/QuaternionEKF.c \ modules/algorithm/crc8.c \ modules/algorithm/crc16.c \ modules/algorithm/user_lib.c \ modules/bluetooth/HC05.c \ modules/BMI088/bmi088.c \ modules/imu/BMI088driver.c \ modules/imu/BMI088Middleware.c \ modules/imu/ins_task.c \ modules/master_machine/master_process.c \ modules/master_machine/seasky_protocol.c \ modules/motor/DJImotor/dji_motor.c \ modules/motor/HTmotor/HT04.c \ modules/motor/LKmotor/LK9025.c \ modules/motor/DMmotor/dmmotor.c \ modules/motor/step_motor/step_motor.c \ modules/motor/step_motor/X_V2.c \ modules/motor/servo_motor/servo_motor.c \ modules/motor/motor_task.c \ modules/oled/oled.c \ modules/referee/crc_ref.c \ modules/referee/rm_referee.c \ modules/referee/referee_UI.c \ modules/referee/referee_task.c \ modules/remote/remote_control.c \ modules/super_cap/super_cap.c \ modules/can_comm/can_comm.c \ modules/message_center/message_center.c \ modules/daemon/daemon.c \ modules/alarm/buzzer.c \ modules/vofa/vofa.c \ modules/opencv/opencv.c \ modules/timachine/board_comm.c \ application/gimbal/gimbal.c \ application/chassis/chassis.c \ application/shoot/shoot.c \ application/cmd/robot_cmd.c \ application/robot.c \ Core/Src/i2c.c # ASM sources ASM_SOURCES = \ startup_stm32h723xx.s \ Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_ASM_ARMv7M.s # ASM sources ASMM_SOURCES = ####################################### # binaries ####################################### PREFIX = arm-none-eabi- # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) # either it can be added to the PATH environment variable. ifdef GCC_PATH CC = $(GCC_PATH)/$(PREFIX)gcc AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp CP = $(GCC_PATH)/$(PREFIX)objcopy SZ = $(GCC_PATH)/$(PREFIX)size else CC = $(PREFIX)gcc AS = $(PREFIX)gcc -x assembler-with-cpp CP = $(PREFIX)objcopy SZ = $(PREFIX)size endif HEX = $(CP) -O ihex BIN = $(CP) -O binary -S ####################################### # CFLAGS ####################################### # cpu CPU = -mcpu=cortex-m7 # fpu FPU = -mfpu=fpv5-d16 # float-abi FLOAT-ABI = -mfloat-abi=hard # mcu MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) # macros for gcc # AS defines AS_DEFS = # C defines C_DEFS = \ -DUSE_HAL_DRIVER \ -DSTM32H723xx \ -DARM_MATH_CM7 \ # AS includes AS_INCLUDES = \ -ICore/Inc # C includes C_INCLUDES = \ -ICore/Inc \ -IUSB_DEVICE/App \ -IUSB_DEVICE/Target \ -IDrivers/STM32H7xx_HAL_Driver/Inc \ -IDrivers/STM32H7xx_HAL_Driver/Inc/Legacy \ -IMiddlewares/Third_Party/FreeRTOS/Source/include \ -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS \ -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \ -IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc \ -IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \ -IDrivers/CMSIS/Device/ST/STM32H7xx/Include \ -IDrivers/CMSIS/Include \ -Iapplication/chassis \ -Iapplication/shoot \ -Iapplication/gimbal \ -Iapplication/cmd \ -Iapplication \ -Ibsp/dwt \ -Ibsp/can \ -Ibsp/usart \ -Ibsp/gpio \ -Ibsp/spi \ -Ibsp/iic \ -Ibsp/log \ -Ibsp/pwm \ -Ibsp \ -Imodules/algorithm \ -Imodules/bluetooth \ -Imodules/BMI088 \ -Imodules/imu \ -Imodules/master_machine \ -Imodules/motor/DJImotor \ -Imodules/motor/LKmotor \ -Imodules/motor/HTmotor \ -Imodules/motor/step_motor \ -Imodules/motor/servo_motor \ -Imodules/motor/DMmotor \ -Imodules/motor \ -Imodules/oled \ -Imodules/referee \ -Imodules/remote \ -Imodules/super_cap \ -Imodules/can_comm \ -Imodules/message_center \ -Imodules/daemon \ -Imodules/alarm \ -Imodules/vofa \ -Imodules/opencv \ -Imodules/timachine \ -Imodules \ -IMiddlewares/ST/ARM/DSP/Inc \ -IMiddlewares/ST/ARM/DSP/Include/dsp \ -IMiddlewares/Third_Party/SEGGER/RTT \ -IMiddlewares/Third_Party/SEGGER/Config # compile gcc flags ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) CFLAGS += -g -gdwarf-2 endif # Generate dependency information CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" ####################################### # LDFLAGS ####################################### # link script LDSCRIPT = STM32H723VGTx_FLASH.ld # libraries LIBS = -lc -lm -lnosys -larm_cortexM7lfdp_math LIBDIR = -LDrivers/CMSIS/DSP/Lib/GCC LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections,--print-memory-usage # default action: build all all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin ####################################### # quiet build ####################################### ifeq ($(V),1) Q = else Q = @ endif # Define the pretty-print functions define compile_c @echo " CC $(notdir $<)" $(Q)$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ endef define compile_asm @echo " AS $(notdir $<)" $(Q)$(AS) -c $(CFLAGS) $< -o $@ endef define link_elf @echo " LD $(notdir $@)" $(Q)$(CC) $(OBJECTS) $(LDFLAGS) -o $@ $(Q)$(SZ) $@ endef define create_hex @echo " HEX $(notdir $@)" $(Q)$(HEX) $< $@ endef define create_bin @echo " BIN $(notdir $@)" $(Q)$(BIN) $< $@ endef ####################################### # build the application ####################################### # list of objects OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) vpath %.c $(sort $(dir $(C_SOURCES))) # list of ASM program objects OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) vpath %.s $(sort $(dir $(ASM_SOURCES))) OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASMM_SOURCES:.S=.o))) vpath %.S $(sort $(dir $(ASMM_SOURCES))) $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) $(call compile_c) $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) $(call compile_asm) $(BUILD_DIR)/%.o: %.S Makefile | $(BUILD_DIR) $(call compile_asm) $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile $(call link_elf) $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR) $(call create_hex) $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR) $(call create_bin) $(BUILD_DIR): @echo " MKDIR $(BUILD_DIR)" $(Q)mkdir $@ ####################################### # clean up ####################################### clean: @echo " CLEAN $(BUILD_DIR)" $(Q)rd $(BUILD_DIR) /s/q ####################################### # dependencies ####################################### -include $(wildcard $(BUILD_DIR)/*.d) # *** EOF ***