代码拉取完成,页面将自动刷新
##########################################################################################################################
# v2p_ca9 GCC compiler Makefile
##########################################################################################################################
# ------------------------------------------------
# Generic Makefile (based on gcc)
# ------------------------------------------------
######################################
# target
######################################
TARGET = v2p_ca9
######################################
# building variables
######################################
# debug build?
DEBUG = 1
# optimization
OPT = -Og
# tools dir
OS_NAME = $(shell uname -o)
LC_OS_NAME = $(shell echo $(OS_NAME) | tr '[A-Z]' '[a-z]')
ifeq ($(LC_OS_NAME), cygwin)
GCC_DIR = /cygdrive/c/Users/pc/Desktop/v2p_ca9/gcc-arm-10.2-2020.11-mingw-w64-i686-arm-none-linux-gnueabihf/bin
QEMU_DIR = /cygdrive/c/Program\ Files/qemu
else
GCC_DIR = /d/GNU_MCU/gcc-linaro-7.5.0-2019.12-i686-mingw32_arm-linux-gnueabihf/bin
QEMU_DIR = /F/work/env_released/tools/qemu/qemu32
endif
PROJECTBASE = /d/work/freertos_smp_portf
#######################################
# binaries
#######################################
PREFIX = arm-linux-gnueabihf-
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
OBJCOPY = $(PREFIX)objcopy
OBJDUMP = $(PREFIX)objdump
AR = $(PREFIX)ar
SZ = $(PREFIX)size
LD = $(PREFIX)ld
HEX = $(OBJCOPY) -O ihex
BIN = $(OBJCOPY) -O binary -S
GDB = $(PREFIX)gdb
QEMU = $(QEMU_DIR)/qemu-system-arm
override PROJECTBASE := $(abspath $(PROJECTBASE))
TOP_DIR = $(PROJECTBASE)
#######################################
# Build path
BUILD_DIR = build
OBJ_DIR = $(BUILD_DIR)/obj
######################################
# source
######################################
# C sources
C_SOURCES = \
${wildcard $(TOP_DIR)/cmsis/source/*.c} \
${wildcard $(TOP_DIR)/debug_log/*.c} \
${wildcard $(TOP_DIR)/driver/*.c} \
${wildcard $(TOP_DIR)/freertos/*.c} \
${wildcard $(TOP_DIR)/freertos/portable/GCC/ARM_CA9/*.c} \
${wildcard $(TOP_DIR)/freertos/portable/MemMang/heap_4.c} \
${wildcard $(TOP_DIR)/*.c}
# ASM sources
ASM_SOURCES = \
${wildcard $(TOP_DIR)/freertos/portable/GCC/ARM_CA9/*.s} \
${wildcard $(TOP_DIR)/cstartup.s}
######################################
# third party ibrary
######################################
THIRDLIB =
#######################################
# CFLAGS
#######################################
# macros for gcc
# AS defines
AS_DEFS = -D__VFP_FP__
# C defines
C_DEFS = -D__VFP_FP__
# AS includes
AS_INCLUDES =
# C includes
C_INCLUDES = \
-I $(TOP_DIR)/debug_log \
-I $(TOP_DIR)/driver \
-I $(TOP_DIR)/cmsis/include \
-I $(TOP_DIR)/freertos/include \
-I $(TOP_DIR)/freertos/portable/GCC/ARM_CA9 \
-I $(TOP_DIR)
# compile gcc flags
ASFLAGS = -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfloat-abi=hard -mfpu=neon $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections -fno-pie
CFLAGS = -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfloat-abi=hard -mfpu=neon $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections -fno-pie
ifeq ($(DEBUG), 1)
CFLAGS += -g -gdwarf-2
endif
# Generate dependency information
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
#######################################
# LDFLAGS
#######################################
# link script
LD_FILE = $(TARGET).lds
LDSCRIPT = $(TOP_DIR)/$(LD_FILE)
# libraries
LIBS = -lm
LIBDIR =
LDFLAGS = -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfloat-abi=hard -mfpu=neon -nostartfiles -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -static -Wl,--gc-sections -Wl,--build-id=none
# default action: build all
all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin $(BUILD_DIR)/$(TARGET).lst
#######################################
# build the application
#######################################
# list of objects
OBJECTS = $(addprefix $(OBJ_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
# list of ASM program objects
OBJECTS += $(addprefix $(OBJ_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))
# list of lib objects
OBJECTS += $(THIRDLIB)
$(OBJ_DIR)/%.o: %.c Makefile | $(OBJ_DIR)
@echo CC $(notdir $<)
@$(CC) -c $(subst $(TOP_DIR), ., $(CFLAGS)) -Wa,-a,-ad,-alms=$(OBJ_DIR)/$(notdir $(<:.c=.lst)) $(subst $(TOP_DIR), ., $<) -o $@
$(OBJ_DIR)/%.o: %.s Makefile | $(OBJ_DIR)
@echo AS $(notdir $<)
@$(AS) -c $(subst $(TOP_DIR), ., $(CFLAGS)) $(subst $(TOP_DIR), ., $<) -o $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) $(LD_FILE) Makefile
@echo LD $(notdir $@)
@$(CC) $(OBJECTS) $(subst $(TOP_DIR), ., $(LDFLAGS)) -o $@
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
@echo HEX $(notdir $@)
@$(HEX) $< $@
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
@echo BIN $(notdir $@)
@$(BIN) $< $@
$(BUILD_DIR)/%.lst: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
@echo OBJDUMP $(notdir $@)
@$(OBJDUMP) --source --demangle --disassemble --reloc --wide $< > $@
@$(SZ) --format=berkeley $<
$(BUILD_DIR):
@echo MKDIR $@
@mkdir $@
ifeq ($(OBJ_DIR), $(wildcard $(OBJ_DIR)))
else
$(OBJ_DIR):$(BUILD_DIR)
@echo MKDIR $@
@mkdir $@
endif
#######################################
# clean up
#######################################
clean:
@echo RM $(BUILD_DIR)
@rm -fR $(BUILD_DIR)
#######################################
# use gdb debug
#######################################
debug:
@echo start GDB
@$(GDB) -x $(BUILD_DIR)/../gdb.script $(BUILD_DIR)/$(TARGET).elf
qemu:
@echo start qemu
@$(QEMU) -M vexpress-a9 -m 1024m -smp 2 -kernel $(BUILD_DIR)/$(TARGET).elf -nographic
qemu1:
@echo start qemu
@$(QEMU) -M vexpress-a9 -m 1024m -smp 1 -kernel $(BUILD_DIR)/$(TARGET).elf -nographic
qemu_gdb:
@echo start qemu
@$(QEMU) -M vexpress-a9 -m 1024m -smp 1 -kernel $(BUILD_DIR)/$(TARGET).elf -nographic -gdb tcp::1234 -S
#######################################
# dependencies
#######################################
#-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
# *** EOF ***
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。