Files
kunlun/bb_cpu/Makefile

121 lines
3.9 KiB
Makefile

# OUTPUT type
# 1 - .out
# 2 - .a
# 3 - .so
OUTPUT_TYPE = 1
OUTPUT_NAME = bb_cpu
SUB_DIRS = startup $(TOPDIR)/common/os_shim/dtestos bb mac common fsm misc
ifeq ($(target), kunlun3)
hw_dep = hw3
comp_dep = riscv3
else
$(error error is not suport this target $(target) ))
endif
EXT_SRC = $(TOPDIR)/startup/riscv3/src/platform.c \
$(TOPDIR)/common/utils/iot_bitops.c \
$(TOPDIR)/common/io_lib/src/iot_printf.c \
$(TOPDIR)/common/io_lib/src/iot_string.c \
$(TOPDIR)/common/io_lib/src/iot_strformat.c \
$(TOPDIR)/plc/halmac/$(hw_dep)/sched/mac_sched_hw.c \
$(TOPDIR)/plc/halmac/$(hw_dep)/misc/mac_hw_misc.c \
$(TOPDIR)/plc/halmac/$(hw_dep)/common/mac_rf_common_hw.c \
$(TOPDIR)/plc/halmac/$(hw_dep)/common/mac_rf_timer.c \
$(TOPDIR)/plc/halphy/rf_tone_map.c \
$(TOPDIR)/plc/halmac/$(hw_dep)/tx/mac_rf_txq_hw.c \
$(TOPDIR)/plc/halphy/phy_rf_chn.c \
$(TOPDIR)/plc/halphy/$(hw_dep)/plc/phy_phase.c \
$(TOPDIR)/plc/halmac/$(hw_dep)/reset/mac_reset.c
ADD_INCLUDE += $(TOPDIR)/inc/hw/reg/$(comp_dep)/$(HW_HEADER_VER) \
$(TOPDIR)/startup/$(comp_dep)/inc \
$(TOPDIR)/driver/src/$(hw_dep)/inc
ADD_INCLUDE += $(TOPDIR)/plc/halmac/$(hw_dep)/plc_inc \
$(TOPDIR)/plc/halmac/$(hw_dep)/rf_inc \
$(TOPDIR)/plc/halmac/$(hw_dep)/plc_inc/desc \
$(TOPDIR)/plc/halmac/$(hw_dep)/rf_inc/desc \
$(TOPDIR)/plc/halphy/$(hw_dep)/plc/inc \
$(TOPDIR)/plc/halphy/$(hw_dep)/rf/inc
ADD_INCLUDE += $(TOPDIR)/inc \
$(TOPDIR)/inc/driver \
$(TOPDIR)/driver/inc \
$(TOPDIR)/common/io_lib/inc \
$(TOPDIR)/export/inc/io_lib \
$(TOPDIR)/inc/compiler/gcc \
$(TOPDIR)/inc/utils \
$(TOPDIR)/inc/os_shim \
$(TOPDIR)/bb_cpu/inc
ADD_INCLUDE += $(TOPDIR)/plc/common/inc \
$(TOPDIR)/inc/dbglog \
$(TOPDIR)/inc/cli \
$(TOPDIR)/inc/io_lib \
$(TOPDIR)/plc/halphy/inc \
$(TOPDIR)/inc/pkt \
$(TOPDIR)/export/inc/pkt \
$(TOPDIR)/inc/plc_lib \
$(TOPDIR)/plc/inc \
$(TOPDIR)/plc/halmac/inc \
$(TOPDIR)/ftm/inc
# predefined macro
PRE_MARCO += IRAM_SECTION_DISABLE
#PRE_MARCO += IOT_ASSERT_DEBUG=0
LD_SCRIPT = link_bb_cpu.lds
# lib dir
ADD_LIBDIR += $(TOPDIR)/driver
# lib need to ld together
ADD_LIB += driver
DISABLE_BACKTRACE = 1
extra_work = echo handle bb_cpu..;\
$(TOPDIR)/tools/rom_img/make_ld.sh --addrs $(OUTPUT_FULL_NAME)\
$(TOPDIR)/tools/rom_img/riscv/sp_symbol > \
$(TOPDIR)/startup/ldscripts/riscv/sp_$(MODE_TYPE).addrs.ld ;\
xxd -i < $(OUTPUT_DIR)/$(OUTPUT_NAME).bin > \
$(TOPDIR)/startup/riscv3/inc/bb_cpu.txt
#####################################################
ifeq ($(bbcpu_enable), 1)
.PHONY: TARGET
TARGET: .output/plc/lib/bb_cpu.out
@echo "const char plc_core1[] = {" > plc_core1.h
@chmod 777 $(TOPDIR)/tools/bin_tool/bin2hex_frame
@$(TOPDIR)/tools/bin_tool/bin2hex_frame $(OUTPUT_DIR)/$(OUTPUT_NAME).bin tmp.txt
@cat tmp.txt >> plc_core1.h
@echo "};" >> plc_core1.h
@mv plc_core1.h $(TOPDIR)/dtest/dtest3/mac_phy/double_cpu/kl3_core0
@rm -rf tmp.txt
endif
ifdef TOPDIR
include $(TOPDIR)/build/makefile.cfg
else
include $(CURDIR)/build/makefile.cfg
TOPDIR = $(CURDIR)
export TOPDIR
endif
dump:
$(OBJDUMP) -D -S -l $(OUTPUT_FULL_NAME) > $(OUTPUT_FULL_NAME).dump
# display the obj files and output name
debug:
@echo TOPDIR=$(TOPDIR)
@echo OUTPUT_LIB=$(OUTPUT_FULL_NAME)
@echo DEPS=$(DEPS)
@echo OBJECTS=$(OBJECTS)
@echo SRCS=$(SRCS)
@echo OBJECTS folder=$(foreach dirname, $(SUB_DIRS), $(addprefix $(BIN_DIR)/, $(dirname)))
@echo output_name=$(OUTPUT_FULL_NAME)