sentry_gimbal_hzz/Makefile

281 lines
9.4 KiB
Makefile
Raw Normal View History

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-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 \
\ \
modules/algorithm/controller.c \
modules/algorithm/kalman_filter.c \
modules/algorithm/QuaternionEKF.c \
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 \
modules/motor/dji_motor.c \
modules/motor/HT04.c \
modules/motor/LK9025.c \
2022-10-29 23:14:19 +08:00
modules/motor/motor_task.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 \
modules/master_machine/seasky_protocol.c \
modules/algorithm/crc8.c \
modules/algorithm/crc16.c
2022-10-20 17:13:02 +08:00
# ASM sources
ASM_SOURCES = \
startup_stm32f407xx.s
#######################################
# 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-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
AS_INCLUDES =
# 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 \
-IHAL_N_Middlewares/Middlewares/ST/ARM/DSP/Inc \
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-03 18:19:06 +08:00
-Imodules/super_cap
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)))
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
2022-11-11 12:32:24 +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-11 12:32:24 +08:00
@$(AS) -c $(CFLAGS) $< -o $@
2022-10-20 17:13:02 +08:00
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
2022-11-11 12:32:24 +08:00
@$(CC) $(OBJECTS) $(LDFLAGS) -o $@
@$(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):
mkdir $@
2022-10-20 17:13:02 +08:00
#######################################
# clean up
#######################################
clean:
-rm -r $(BUILD_DIR)
2022-10-20 17:13:02 +08:00
#######################################
# dependencies
#######################################
-include $(wildcard $(BUILD_DIR)/*.d)
# *** EOF ***