232 lines
6.8 KiB
Makefile
232 lines
6.8 KiB
Makefile
##########################################################################################################################
|
|
# File automatically-generated by tool: [projectgenerator] version: [3.3.0] date: [Mon Aug 05 10:29:11 CST 2019]
|
|
##########################################################################################################################
|
|
|
|
# ------------------------------------------------
|
|
# Generic Makefile (based on gcc)
|
|
#
|
|
# ChangeLog :
|
|
# 2017-02-10 - Several enhancements + project update mode
|
|
# 2015-07-22 - first version
|
|
# ------------------------------------------------
|
|
|
|
######################################
|
|
# target
|
|
######################################
|
|
TARGET = TencentOS_tiny
|
|
|
|
|
|
######################################
|
|
# building variables
|
|
######################################
|
|
# debug build?
|
|
DEBUG = 1
|
|
# optimization
|
|
OPT = -O0
|
|
|
|
TOP_DIR = ../../../../
|
|
#######################################
|
|
# paths
|
|
#######################################
|
|
# Build path
|
|
BUILD_DIR = build
|
|
|
|
######################################
|
|
# source
|
|
######################################
|
|
# C sources
|
|
KERNEL_SRC = \
|
|
${wildcard $(TOP_DIR)/kernel/core/*.c}
|
|
C_SOURCES += $(KERNEL_SRC)
|
|
|
|
ARCH_SRC = \
|
|
${wildcard $(TOP_DIR)/arch/arc/nsim/em/gcc/*.c} \
|
|
${wildcard $(TOP_DIR)/arch/arc/nsim/common/*.c}
|
|
C_SOURCES += $(ARCH_SRC)
|
|
|
|
CMSIS_SRC = \
|
|
${wildcard $(TOP_DIR)/osal/cmsis_os/*.c}
|
|
C_SOURCES += $(CMSIS_SRC)
|
|
|
|
HAL_DRIVER_SRC = \
|
|
$(TOP_DIR)/board/ARC_NSIM_EM/BSP/Src/main.c \
|
|
$(TOP_DIR)/board/ARC_NSIM_EM/BSP/Src/nsim_init.c \
|
|
$(TOP_DIR)/board/ARC_NSIM_EM/BSP/Src/nsim_uart_obj.c \
|
|
$(TOP_DIR)/examples/hello_world/hello_world.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/board/board.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/startup/arc_cxx_support.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_cache.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_connect.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_exception.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_mp.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_mpu.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_timer.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_udma.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_util.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/library/clib/embARC_sbrk.c \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/library/clib/embARC_syscalls.c
|
|
C_SOURCES += $(HAL_DRIVER_SRC)
|
|
|
|
# ASM sources
|
|
ASM_SOURCES = \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/startup/arc_startup.s \
|
|
$(TOP_DIR)/platform/vendor_bsp/embarc_bsp/arc/arc_exc_asm.s
|
|
|
|
|
|
ASM_SOURCES_S = \
|
|
$(TOP_DIR)/arch/arc/nsim/em/gcc/port_s.S
|
|
|
|
|
|
#######################################
|
|
# binaries
|
|
#######################################
|
|
PREFIX = arc-elf32-
|
|
# 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 -DLIB_CONSOLE
|
|
C_DEFS = \
|
|
-DBOARD_NSIM \
|
|
-DCURRENT_CORE=arcem \
|
|
-DEMBARC_TCF_GENERATED \
|
|
-DHW_VERSION=10 \
|
|
-DLIB_CLIB \
|
|
-D_HAVE_LIBGLOSS_ \
|
|
-D_HEAPSIZE=8192 \
|
|
-D_HOSTLINK_ \
|
|
-D_NSIM_ \
|
|
-D_STACKSIZE=2048 \
|
|
-D__GNU__
|
|
|
|
|
|
|
|
# AS includes
|
|
AS_INCLUDES =
|
|
|
|
# C includes
|
|
KERNEL_INC = \
|
|
-I $(TOP_DIR)/kernel/core/include \
|
|
-I $(TOP_DIR)/kernel/pm/include \
|
|
-I $(TOP_DIR)/kernel/hal/include \
|
|
-I $(TOP_DIR)/arch/arc/nsim/common/include \
|
|
-I $(TOP_DIR)/arch/arc/nsim/em/gcc \
|
|
-I $(TOP_DIR)/board/ARC_NSIM_EM/TOS-CONFIG
|
|
C_INCLUDES += $(KERNEL_INC)
|
|
CMSIS_INC = \
|
|
-I $(TOP_DIR)/osal/cmsis_os
|
|
C_INCLUDES += $(CMSIS_INC)
|
|
|
|
HAL_DRIVER_INC = \
|
|
-I $(TOP_DIR)/board/ARC_NSIM_EM/BSP/Inc \
|
|
-I $(TOP_DIR)/platform/vendor_bsp/embarc_bsp/include \
|
|
-I $(TOP_DIR)/platform/vendor_bsp/embarc_bsp/board \
|
|
-I $(TOP_DIR)/platform/vendor_bsp/embarc_bsp/library
|
|
C_INCLUDES += $(HAL_DRIVER_INC)
|
|
|
|
# compile gcc flags
|
|
ASFLAGS = -mcpu=em4_dmips -mlittle-endian -mcode-density -mdiv-rem -mswap -mnorm -mmpy-option=6 -mbarrel-shifter --param l1-cache-size=16384 --param l1-cache-line-size=32 $(C_DEFS) $(C_INCLUDES) $(OPT) -fdata-sections -ffunction-sections -std=gnu99
|
|
|
|
CFLAGS = -mcpu=em4_dmips -mlittle-endian -mcode-density -mdiv-rem -mswap -mnorm -mmpy-option=6 -mbarrel-shifter --param l1-cache-size=16384 --param l1-cache-line-size=32 $(C_DEFS) $(C_INCLUDES) $(OPT) -fdata-sections -ffunction-sections -std=gnu99
|
|
|
|
# ifeq ($(DEBUG), 1)
|
|
# CFLAGS += -g -gdwarf-2
|
|
# endif
|
|
|
|
|
|
# Generate dependency information
|
|
CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)"
|
|
|
|
|
|
#######################################
|
|
# LDFLAGS
|
|
#######################################
|
|
# link script
|
|
LDSCRIPT = linker_template_gnu.ldf
|
|
|
|
# libraries
|
|
LIBS = -lc -lm -lnosys
|
|
LIBDIR =
|
|
LDFLAGS = --specs=nsim.specs -mcpu=em4_dmips -mlittle-endian -mcode-density -mdiv-rem -mswap -mnorm -mmpy-option=6 -mbarrel-shifter --param l1-cache-size=16384 --param l1-cache-line-size=32 $(LIBDIR) $(LIBS) -mno-sdata -nostartfiles -Wl,-M,-Map=$(BUILD_DIR)/$(TARGET).map -lm -Wl,--script=$(LDSCRIPT)
|
|
|
|
# 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)))
|
|
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES_S:.S=.o)))
|
|
vpath %.S $(sort $(dir $(ASM_SOURCES_S)))
|
|
|
|
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
|
|
$(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
|
|
$(AS) -c $(CFLAGS) $< -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)
|
|
|
|
#######################################
|
|
# dependencies
|
|
#######################################
|
|
-include $(wildcard $(BUILD_DIR)/*.d)
|
|
|
|
# *** EOF ***
|