You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
3.8 KiB

#===============================================================================
# export variables
#===============================================================================
export VENDOR_DIR := $(shell cd ../../../../vendor/ && /bin/pwd)
export RISCV_DIR=$(VENDOR_DIR)/tools/host/platform/cc_riscv32_musl/cc_riscv32_musl/bin
# Liteos Depends variables
export LITEOSTOPDIR := $(VENDOR_DIR)/platform/liteos/liteos-207.0.0-release
export LOSCFG_COMPILER_THIRDPARTY_SUPPORT := y
export CROSS_COMPILE:=$(RISCV_DIR)/riscv32-linux-musl-
# Dmcu localdir variables
export DMCUDIR := $(VENDOR_DIR)/huanglong/mcu/dmcu
export DMCUBINDIR := $(VENDOR_DIR)/huanglong/binary/mcu/dmcu
export OSALDIR := $(VENDOR_DIR)/huanglong/mcu/osal
export DRVDIR := $(VENDOR_DIR)/huanglong/linux/drv
# Dmcu output variables
export OUT_TARGET := dmcu
export OUTDIR := $(DMCUDIR)/out
export DMCULIB := $(OUTDIR)/lib/dmcu
export LITEOS_OUTDIR := $(LITEOSTOPDIR)/out/$(OUT_TARGET)
export LITEOSLIB := $(LITEOS_OUTDIR)/lib
# Liteos Depends Makefile
include $(LITEOSTOPDIR)/build/make/los_config.mk
include $(LITEOSTOPDIR)/build/make/compiler_gcc.mk
include $(LITEOSTOPDIR)/config.mk
include $(LITEOSTOPDIR)/build/menuconfig/Makefile.kconfig
LITEOS_CFLAGS += -Werror -Wextra -Wl,-z,noexecstack,-mabi=ilp32,-march=rv32imc
.PHONY: help config lib clean install
help:
$(HIDE)echo "--------------------------------------------------------------------------"
$(HIDE)echo "1. make help: get help infomation of make"
$(HIDE)echo "2. make xxx.config: using xxx.config to project before make all"
$(HIDE)echo "3. make all: make a version based the xxx.config"
$(HIDE)echo "4. make menuconfig: configure features for project and load .config"
$(HIDE)echo "5. make xxx.saveconfig: save .config to xxx.config after configure feature"
$(HIDE)echo "6. make clean: clean out files in the project"
$(HIDE)echo "---------------------------------------------------------------------------"
%.config:
$(HIDE)echo "-------------------------------------------------------"
$(HIDE)echo " Configure $@ for dmcu project"
$(HIDE)echo "-------------------------------------------------------"
$(HIDE)cp -f $(DMCUDIR)/configs/$@ $(LITEOSTOPDIR)/.config
$(HIDE)make -C $(LITEOSTOPDIR) savemenuconfig
%.saveconfig:
$(HIDE)echo "-------------------------------------------------------"
$(HIDE)echo " Save .config to dmcu project"
$(HIDE)echo "-------------------------------------------------------"
$(HIDE)cp -f $(LITEOSTOPDIR)/.config $(DMCUDIR)/configs/$(shell echo $@|awk -F '.' '{ print $$1 }').config
libs:
$(HIDE)make -C $(DMCUDIR)/app OBJOUT=$(OUTDIR)/obj/dmcu/app OUT=$(DMCULIB) all
$(HIDE)make -C $(DMCUDIR)/platform OBJOUT=$(OUTDIR)/obj/dmcu/platform OUT=$(DMCULIB) all
$(HIDE)make -C $(DMCUDIR)/module/gfbg OBJOUT=$(OUTDIR)/obj/module/gfbg OUT=$(DMCULIB) all
$(HIDE)make -C $(DMCUDIR)/module/vo OBJOUT=$(OUTDIR)/obj/module/vo OUT=$(DMCULIB) all
$(HIDE)make -C $(DMCUDIR)/module/panel OBJOUT=$(OUTDIR)/obj/module/panel OUT=$(DMCULIB) all
$(HIDE)make -C $(DMCUDIR)/module/memc OBJOUT=$(OUTDIR)/obj/module/memc OUT=$(DMCULIB) all
$(HIDE)make -C $(DMCUDIR)/module/pq OBJOUT=$(OUTDIR)/obj/module/pq OUT=$(DMCULIB) all
LIBS += $(foreach x,$(DMCULIB)/lib, $(wildcard $(addprefix $(x)/*,.a)))
LIBS += $(foreach x,$(LITEOSLIB)/install, $(wildcard $(addprefix $(x)/*,.a)))
all:libs
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -L $(LITEOSLIB)/install \
--whole-archive $(LIBS) --no-whole-archive -Map $(OUTDIR)/$(OUT_TARGET).map -o $(OUTDIR)/$(OUT_TARGET).elf
$(OBJCOPY) -O binary $(OUTDIR)/$(OUT_TARGET).elf $(OUTDIR)/$(OUT_TARGET).img
$(OBJDUMP) -D -h $(OUTDIR)/$(OUT_TARGET).elf > $(OUTDIR)/$(OUT_TARGET).asm
$(HIDE)tools/parse_memory_map.py $(OUTDIR)/$(OUT_TARGET).map
clean:
rm -rf $(DMCUDIR)/out