1 Star 0 Fork 1

cuixh11/泛亚

forked from Moster/泛亚 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Makefile 5.55 KB
一键复制 编辑 原始数据 按行查看 历史
Moster 提交于 2023-11-18 16:43 . Upload code
######################################
# target
######################################
TARGET = avas_mm32
######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Og
#######################################
# paths
#######################################
# Build path
BUILD_DIR = build
######################################
# source
######################################
# C sources
C_SOURCES = \
Drivers/MM32F0140/Source/system_mm32f0140.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_comp.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_uid.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_sqrt.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_gpio.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_div.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_spi.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_uart.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_dbg.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_crc.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_i2c.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_exti.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_rcc.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_wwdg.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_adc.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_misc.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_pwr.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_flash.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_dma.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_iwdg.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_flexcan.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_tim.c \
Drivers/MM32F0140/HAL_Lib/Src/hal_ver.c
# === appliation related files ===
# hal
C_SOURCES += \
user/hal/flex_can.c \
user/hal/hal_init.c \
user/hal/i2c1.c \
user/hal/iwdg.c \
user/hal/sit1040.c \
user/hal/spi1.c \
user/hal/systick.c \
user/hal/tda5235.c \
user/hal/uart.c \
user/hal/wt2003.c \
user/hal/wt8871.c
# app
C_SOURCES += \
user/app/main.c \
user/app/audio_chip_ctl/audio_chip_ctl.c \
user/app/audio_ctl/audio_ctl.c \
user/app/avas_app/avas_app.c \
user/app/build_info/build_info.c \
user/app/flex_can_rx/flex_can_rx.c \
user/app/flex_can_tx/flex_can_tx.c \
user/app/mfg_test/mfg_test.c \
user/app/sys_cfg/sys_cfg.c \
user/app/sys_status/sys_status.c \
user/app/sys/sys.c \
user/app/version/version.c
# util
C_SOURCES += \
user/util/crc16_ccitt.c \
user/util/cs.c \
user/util/hexdump.c
# ASM sources
ASM_SOURCES = \
Drivers/MM32F0140/Source/gcc/startup_mm32f0140.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-m0
# fpu
# NONE for Cortex-M0/M0+/M3
# float-abi
# mcu
MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
# macros for gcc
# AS defines
AS_DEFS =
# C defines
C_DEFS = \
-DNDEBUG \
-DUSE_HAL_DRIVER \
-DSTM32F030x6
# AS includes
AS_INCLUDES =
# C includes
C_INCLUDES = \
-ICore/Inc \
-IDrivers/MM32F0140/Include \
-IDrivers/MM32F0140/HAL_Lib/Inc \
-IDrivers/CMSIS/Include
C_INCLUDES += \
-Iuser/app \
-Iuser/app/audio_chip_ctl\
-Iuser/app/audio_ctl \
-Iuser/app/avas_app \
-Iuser/app/build_info \
-Iuser/app/flex_can_rx \
-Iuser/app/flex_can_tx \
-Iuser/app/mfg_test \
-Iuser/app/sys \
-Iuser/app/sys_cfg \
-Iuser/app/sys_status \
-Iuser/hal \
-Iuser/util \
-Iuser/version
# 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 = mm32f0144c6p.ld
# libraries
LIBS = -lc -lm -lnosys
LIBDIR =
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)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
$(AS) -c $(CFLAGS) $< -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(SZ) $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(HEX) $< $@
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
$(BIN) $< $@
$(BUILD_DIR):
mkdir $@
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)
flash: $(BUILD_DIR)/$(TARGET).hex
pyocd flash -e sector $^
test:
# make -C user/util
# make -C user/app/sys_status
make -C user/app/sys_cfg
#######################################
# dependencies
#######################################
-include $(wildcard $(BUILD_DIR)/*.d)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/a1276327078/AVAS_FY.git
git@gitee.com:a1276327078/AVAS_FY.git
a1276327078
AVAS_FY
泛亚
master

搜索帮助