2022-10-20 17:13:02 +08:00
|
|
|
##########################################################################################################################
|
|
|
|
# File automatically-generated by tool: [projectgenerator] version: [3.17.1] date: [Thu Oct 20 16:31:27 CST 2022]
|
|
|
|
##########################################################################################################################
|
|
|
|
|
|
|
|
# ------------------------------------------------
|
|
|
|
# Generic Makefile (based on gcc)
|
|
|
|
#
|
|
|
|
# ChangeLog :
|
|
|
|
# 2017-02-10 - Several enhancements + project update mode
|
|
|
|
# 2015-07-22 - first version
|
|
|
|
# ------------------------------------------------
|
|
|
|
|
|
|
|
######################################
|
|
|
|
# target
|
|
|
|
######################################
|
|
|
|
TARGET = basic_framework
|
|
|
|
|
|
|
|
|
|
|
|
######################################
|
|
|
|
# building variables
|
|
|
|
######################################
|
|
|
|
# debug build?
|
|
|
|
DEBUG = 1
|
|
|
|
# optimization
|
|
|
|
OPT = -Og
|
|
|
|
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# paths
|
|
|
|
#######################################
|
|
|
|
# Build path
|
|
|
|
BUILD_DIR = build
|
|
|
|
|
|
|
|
######################################
|
|
|
|
# source
|
|
|
|
######################################
|
|
|
|
# C sources
|
|
|
|
C_SOURCES = \
|
2022-11-03 18:19:06 +08:00
|
|
|
HAL_N_Middlewares/Src/main.c \
|
|
|
|
HAL_N_Middlewares/Src/gpio.c \
|
|
|
|
HAL_N_Middlewares/Src/adc.c \
|
|
|
|
HAL_N_Middlewares/Src/can.c \
|
|
|
|
HAL_N_Middlewares/Src/dma.c \
|
|
|
|
HAL_N_Middlewares/Src/rng.c \
|
|
|
|
HAL_N_Middlewares/Src/rtc.c \
|
|
|
|
HAL_N_Middlewares/Src/spi.c \
|
|
|
|
HAL_N_Middlewares/Src/tim.c \
|
|
|
|
HAL_N_Middlewares/Src/usart.c \
|
|
|
|
HAL_N_Middlewares/Src/usb_device.c \
|
|
|
|
HAL_N_Middlewares/Src/usbd_conf.c \
|
|
|
|
HAL_N_Middlewares/Src/usbd_desc.c \
|
|
|
|
HAL_N_Middlewares/Src/usbd_cdc_if.c \
|
|
|
|
HAL_N_Middlewares/Src/stm32f4xx_it.c \
|
|
|
|
HAL_N_Middlewares/Src/stm32f4xx_hal_msp.c \
|
|
|
|
HAL_N_Middlewares/Src/system_stm32f4xx.c \
|
|
|
|
HAL_N_Middlewares/Src/freertos.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
|
|
|
|
HAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/croutine.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/list.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/queue.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/stream_buffer.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/tasks.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/timers.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
|
2022-11-11 21:20:58 +08:00
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_printf.c \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT.c \
|
2022-10-20 17:13:02 +08:00
|
|
|
bsp/bsp_dwt.c \
|
|
|
|
bsp/bsp_temperature.c \
|
|
|
|
bsp/bsp_led.c \
|
|
|
|
bsp/bsp_can.c \
|
|
|
|
bsp/bsp_buzzer.c \
|
|
|
|
bsp/bsp_usart.c \
|
|
|
|
bsp/bsp_log.c \
|
2022-11-12 18:03:18 +08:00
|
|
|
bsp/bsp_init.c \
|
2022-10-20 17:13:02 +08:00
|
|
|
modules/algorithm/controller.c \
|
|
|
|
modules/algorithm/kalman_filter.c \
|
|
|
|
modules/algorithm/QuaternionEKF.c \
|
2022-11-27 18:54:27 +08:00
|
|
|
modules/algorithm/crc8.c \
|
|
|
|
modules/algorithm/crc16.c \
|
|
|
|
modules/algorithm/user_lib.c \
|
2022-10-20 17:13:02 +08:00
|
|
|
modules/imu/BMI088driver.c \
|
|
|
|
modules/imu/BMI088Middleware.c \
|
|
|
|
modules/imu/ins_task.c \
|
|
|
|
modules/led_light/led_task.c \
|
|
|
|
modules/master_machine/master_process.c \
|
2022-11-27 18:54:27 +08:00
|
|
|
modules/master_machine/seasky_protocol.c \
|
2022-10-20 17:13:02 +08:00
|
|
|
modules/motor/dji_motor.c \
|
|
|
|
modules/motor/HT04.c \
|
|
|
|
modules/motor/LK9025.c \
|
2022-11-12 18:03:18 +08:00
|
|
|
modules/mode/step_motor.c \
|
2022-10-29 23:14:19 +08:00
|
|
|
modules/motor/motor_task.c \
|
2022-11-18 22:06:06 +08:00
|
|
|
modules/referee/crc.c \
|
2022-10-20 17:13:02 +08:00
|
|
|
modules/referee/referee.c \
|
2022-11-11 12:32:24 +08:00
|
|
|
modules/referee/referee_UI.c \
|
|
|
|
modules/referee/referee_communication.c \
|
2022-10-29 23:14:19 +08:00
|
|
|
modules/remote/remote_control.c \
|
2022-11-03 20:38:55 +08:00
|
|
|
modules/super_cap/super_cap.c \
|
2022-11-13 14:40:21 +08:00
|
|
|
modules/can_comm/can_comm.c \
|
2022-11-30 18:02:00 +08:00
|
|
|
modules/message_center/message_center.c \
|
2022-12-02 23:10:36 +08:00
|
|
|
modules/monitor/monitor.c \
|
2022-11-27 18:54:27 +08:00
|
|
|
application/gimbal/gimbal.c \
|
|
|
|
application/chassis/chassis.c \
|
|
|
|
application/shoot/shoot.c \
|
|
|
|
application/cmd/chassis_cmd.c \
|
|
|
|
application/cmd/gimbal_cmd.c \
|
|
|
|
application/robot.c
|
2022-11-03 20:38:55 +08:00
|
|
|
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
# ASM sources
|
2022-11-11 21:20:58 +08:00
|
|
|
ASM_SOURCES += \
|
|
|
|
startup_stm32f407xx.s \
|
|
|
|
HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_ASM_ARMv7M.s
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# binaries
|
|
|
|
#######################################
|
2022-11-20 15:10:59 +08:00
|
|
|
PREFIX = arm-none-eabi-
|
|
|
|
# PREFIX = ccache arm-none-eabi- 可以通过安装ccache来缓存makefile内容加速编译
|
2022-10-20 17:13:02 +08:00
|
|
|
# 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-m4
|
|
|
|
|
|
|
|
# fpu
|
|
|
|
FPU = -mfpu=fpv4-sp-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 \
|
|
|
|
-DSTM32F407xx \
|
|
|
|
-DARM_MATH_CM4 \
|
|
|
|
-DARM_MATH_MATRIX_CHECK \
|
|
|
|
-DARM_MATH_ROUNDING
|
|
|
|
|
|
|
|
# AS includes
|
2022-11-19 15:23:19 +08:00
|
|
|
AS_INCLUDES = -IHAL_N_Middlewares/Inc
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
# C includes
|
|
|
|
C_INCLUDES = \
|
2022-11-03 18:19:06 +08:00
|
|
|
-IHAL_N_Middlewares/Inc \
|
|
|
|
-IHAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Inc \
|
|
|
|
-IHAL_N_Middlewares/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy \
|
|
|
|
-IHAL_N_Middlewares/Drivers/CMSIS/Device/ST/STM32F4xx/Include \
|
|
|
|
-IHAL_N_Middlewares/Drivers/CMSIS/Include \
|
|
|
|
-IHAL_N_Middlewares/Drivers/CMSIS/DSP/Include \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/ST/STM32_USB_Device_Library/Core/Inc \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/include \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/include \
|
2022-11-11 21:20:58 +08:00
|
|
|
-IHAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT \
|
|
|
|
-IHAL_N_Middlewares/Middlewares/Third_Party/SEGGER/Config \
|
2022-11-03 18:19:06 +08:00
|
|
|
-IHAL_N_Middlewares/Middlewares/ST/ARM/DSP/Inc \
|
2022-11-28 16:17:30 +08:00
|
|
|
-Iapplication/chassis \
|
|
|
|
-Iapplication/shoot \
|
|
|
|
-Iapplication/gimbal \
|
|
|
|
-Iapplication/cmd \
|
2022-10-20 17:13:02 +08:00
|
|
|
-Iapplication \
|
|
|
|
-Ibsp \
|
|
|
|
-Imodules/algorithm \
|
|
|
|
-Imodules/imu \
|
|
|
|
-Imodules/led_light \
|
|
|
|
-Imodules/master_machine \
|
|
|
|
-Imodules/motor \
|
|
|
|
-Imodules/referee \
|
|
|
|
-Imodules/remote \
|
2022-11-28 16:17:30 +08:00
|
|
|
-Imodules/super_cap \
|
2022-11-30 18:02:00 +08:00
|
|
|
-Imodules/can_comm \
|
2022-12-02 22:17:10 +08:00
|
|
|
-Imodules/message_center \
|
|
|
|
-Imodules/monitor
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
# 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 = STM32F407IGHx_FLASH.ld
|
|
|
|
|
|
|
|
# libraries
|
|
|
|
LIBS = -lc -lm -lnosys \
|
|
|
|
-larm_cortexM4lf_math
|
|
|
|
LIBDIR = \
|
2022-11-03 18:19:06 +08:00
|
|
|
-LHAL_N_Middlewares/Drivers/CMSIS/Lib/GCC
|
2022-10-20 17:13:02 +08:00
|
|
|
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
|
|
|
|
|
|
|
|
# default action: build all
|
|
|
|
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
|
|
|
|
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# 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)))
|
|
|
|
|
2022-11-16 20:58:27 +08:00
|
|
|
# 以下是编译命令,命令之前被粉色高亮的@就是静默输出的指令.删除前面的@会将输出显示到命令行.
|
|
|
|
# 如@$(CC) -c $(CFLAGS) ...... 去掉第一个@即可.
|
2022-10-20 17:13:02 +08:00
|
|
|
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
2022-11-19 15:40:38 +08:00
|
|
|
@$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
2022-11-19 15:40:38 +08:00
|
|
|
@$(AS) -c $(CFLAGS) $< -o $@
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
|
2022-11-19 15:40:38 +08:00
|
|
|
@$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
2022-11-19 15:23:19 +08:00
|
|
|
$(SZ) $@
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|
|
|
$(HEX) $< $@
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
|
|
|
|
$(BIN) $< $@
|
|
|
|
|
|
|
|
$(BUILD_DIR):
|
2022-11-19 15:40:38 +08:00
|
|
|
@mkdir $@
|
2022-10-20 17:13:02 +08:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# clean up
|
|
|
|
#######################################
|
|
|
|
clean:
|
2022-11-30 22:10:57 +08:00
|
|
|
rd /s/q $(BUILD_DIR)
|
|
|
|
# linux: rm -rf $(BUILD_DIR)
|
2022-11-29 20:00:46 +08:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# download without debugging
|
|
|
|
#######################################
|
|
|
|
OPENOCD_FLASH_START = 0x08000000 # 如果切换芯片可能需要修改此值
|
|
|
|
|
|
|
|
download_dap:
|
|
|
|
openocd -f openocd_dap.cfg -c init -c halt -c "flash write_image erase $(BUILD_DIR)/$(TARGET).hex $(OPENOCD_FLASH_START)" -c reset -c shutdown
|
|
|
|
|
|
|
|
download_jlink:
|
|
|
|
openocd -f openocd_jlink.cfg -c init -c halt -c "flash write_image erase $(BUILD_DIR)/$(TARGET).hex $(OPENOCD_FLASH_START)" -c reset -c shutdown
|
|
|
|
|
2022-10-20 17:13:02 +08:00
|
|
|
#######################################
|
|
|
|
# dependencies
|
|
|
|
#######################################
|
|
|
|
-include $(wildcard $(BUILD_DIR)/*.d)
|
|
|
|
|
|
|
|
# *** EOF ***
|