|
@@ -93,8 +93,6 @@ ifeq ($(wildcard $(LINKER_SCRIPT)),)
|
|
|
$(warning The link script file $(LINKER_SCRIPT) for $(SOC) doesn't exist, please check!)
|
|
$(warning The link script file $(LINKER_SCRIPT) for $(SOC) doesn't exist, please check!)
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
--include $(NUCLEI_SDK_SOC)/runmode.mk
|
|
|
|
|
-
|
|
|
|
|
# Add extra cflags for SoC related
|
|
# Add extra cflags for SoC related
|
|
|
ifeq ($(DOWNLOAD), flash)
|
|
ifeq ($(DOWNLOAD), flash)
|
|
|
COMMON_FLAGS += -DVECTOR_TABLE_REMAPPED
|
|
COMMON_FLAGS += -DVECTOR_TABLE_REMAPPED
|
|
@@ -104,13 +102,6 @@ ifneq ($(SYSCLK),)
|
|
|
COMMON_FLAGS += -DSYSTEM_CLOCK=$(SYSCLK)
|
|
COMMON_FLAGS += -DSYSTEM_CLOCK=$(SYSCLK)
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
-## QEMU/XLSPIKE options
|
|
|
|
|
-ifeq ($(XLCFG_PLIC),1)
|
|
|
|
|
-QEMU_ELF_OPT := -bios
|
|
|
|
|
-else
|
|
|
|
|
-QEMU_ELF_OPT := -kernel
|
|
|
|
|
-endif
|
|
|
|
|
-
|
|
|
|
|
ifneq ($(SMP),)
|
|
ifneq ($(SMP),)
|
|
|
$(call assert,$(call gt,$(SMP),1),SMP must be a integer number >= 2)
|
|
$(call assert,$(call gt,$(SMP),1),SMP must be a integer number >= 2)
|
|
|
ifneq ($(BOOT_HARTID),)
|
|
ifneq ($(BOOT_HARTID),)
|
|
@@ -138,20 +129,11 @@ ifneq ($(SPLITMODE),)
|
|
|
OPENOCD_CMD_ARGS += set SPLITMODE $(SPLITMODE);
|
|
OPENOCD_CMD_ARGS += set SPLITMODE $(SPLITMODE);
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
-
|
|
|
|
|
# If HARTID_OFS is not empty
|
|
# If HARTID_OFS is not empty
|
|
|
ifneq ($(HARTID_OFS),)
|
|
ifneq ($(HARTID_OFS),)
|
|
|
COMMON_FLAGS += -D__HARTID_OFFSET=$(HARTID_OFS)
|
|
COMMON_FLAGS += -D__HARTID_OFFSET=$(HARTID_OFS)
|
|
|
endif
|
|
endif
|
|
|
|
|
|
|
|
-ifneq ($(CPU_CNT),)
|
|
|
|
|
-QEMU_OPT += -smp $(CPU_CNT)
|
|
|
|
|
-endif
|
|
|
|
|
-## xlspike is only valid for nuclei demosoc/evalsoc
|
|
|
|
|
-ifneq ($(CPU_CNT),)
|
|
|
|
|
-XLSPIKE_OPT += -p$(CPU_CNT)
|
|
|
|
|
-endif
|
|
|
|
|
-
|
|
|
|
|
# Set RISCV_ARCH and RISCV_ABI
|
|
# Set RISCV_ARCH and RISCV_ABI
|
|
|
CORE_UPPER := $(call uc, $(CORE))
|
|
CORE_UPPER := $(call uc, $(CORE))
|
|
|
include $(NUCLEI_SDK_BUILD)/Makefile.core
|
|
include $(NUCLEI_SDK_BUILD)/Makefile.core
|
|
@@ -183,42 +165,6 @@ endif
|
|
|
RISCV_ABI ?= $(word 2, $(CORE_ARCH_ABI))
|
|
RISCV_ABI ?= $(word 2, $(CORE_ARCH_ABI))
|
|
|
RISCV_TUNE ?= $(word 3, $(CORE_ARCH_ABI))
|
|
RISCV_TUNE ?= $(word 3, $(CORE_ARCH_ABI))
|
|
|
|
|
|
|
|
-# Handle QEMU Emulation
|
|
|
|
|
-# - QEMU_MC_EXTOPT is used to pass extra options to qemu -M machine options for evalsoc,
|
|
|
|
|
-# please dont pass any extra , to this make variable, you can pass such
|
|
|
|
|
-# as QEMU_MC_EXTOPT=debug=1 but not pass QEMU_MC_EXTOPT=,debug=1
|
|
|
|
|
-# - QEMU_CPU_EXTOPT is used to pass extra options to qemu -cpu cpu options for evalsoc,
|
|
|
|
|
-# please dont pass any extra , to this make variable, you can pass such
|
|
|
|
|
-# as QEMU_CPU_EXTOPT=vlen=512 but not pass QEMU_CPU_EXTOPT=,vlen=512
|
|
|
|
|
-QEMU_MACHINE ?= nuclei_evalsoc,download=$(DOWNLOAD)
|
|
|
|
|
-# You can pass customized soc configuration here
|
|
|
|
|
-ifneq ($(QEMU_SOCCFG),)
|
|
|
|
|
-QEMU_MACHINE := $(QEMU_MACHINE),soc-cfg=$(NUCLEI_SDK_SOC)/$(QEMU_SOCCFG)
|
|
|
|
|
-endif
|
|
|
|
|
-ifneq ($(QEMU_MC_EXTOPT),)
|
|
|
|
|
-QEMU_MACHINE := $(QEMU_MACHINE),$(QEMU_MC_EXTOPT)
|
|
|
|
|
-endif
|
|
|
|
|
-
|
|
|
|
|
-QEMU_ARCHEXT ?= ${ARCH_EXT}
|
|
|
|
|
-QEMU_CPU ?= nuclei-$(CORE),ext=$(QEMU_ARCHEXT)
|
|
|
|
|
-ifneq ($(QEMU_CPU_EXTOPT),)
|
|
|
|
|
-QEMU_CPU := $(QEMU_CPU),$(QEMU_CPU_EXTOPT)
|
|
|
|
|
-endif
|
|
|
|
|
-
|
|
|
|
|
-ifneq ($(SEMIHOST),)
|
|
|
|
|
-QEMU_OPT += -semihosting
|
|
|
|
|
-endif
|
|
|
|
|
-
|
|
|
|
|
-# Handle XLModel Emulation
|
|
|
|
|
-XLMODEL_OPT += -M nuclei_evalsoc
|
|
|
|
|
-XLMODEL_OPT += --cpu=$(CORE) --download=$(DOWNLOAD)
|
|
|
|
|
-ifneq ($(ARCH_EXT),)
|
|
|
|
|
-XLMODEL_OPT += --ext=$(ARCH_EXT)
|
|
|
|
|
-endif
|
|
|
|
|
-ifneq ($(CPU_CNT),)
|
|
|
|
|
-XLMODEL_OPT += --smp=$(CPU_CNT)
|
|
|
|
|
-endif
|
|
|
|
|
-
|
|
|
|
|
ifneq ($(CODESIZE),)
|
|
ifneq ($(CODESIZE),)
|
|
|
COMMON_FLAGS += -DCODESIZE=$(CODESIZE)
|
|
COMMON_FLAGS += -DCODESIZE=$(CODESIZE)
|
|
|
endif
|
|
endif
|
|
@@ -258,3 +204,20 @@ ifneq ($(VALID_NUCLEI_SDK_SOC_BOARD),)
|
|
|
INCDIRS += $(VALID_NUCLEI_SDK_SOC_BOARD)/Include
|
|
INCDIRS += $(VALID_NUCLEI_SDK_SOC_BOARD)/Include
|
|
|
C_SRCDIRS += $(VALID_NUCLEI_SDK_SOC_BOARD)/Source
|
|
C_SRCDIRS += $(VALID_NUCLEI_SDK_SOC_BOARD)/Source
|
|
|
endif
|
|
endif
|
|
|
|
|
+
|
|
|
|
|
+# NOTE: runmode.mk is mainly used by nuclei sdk for evalsoc to control ILM/DLM/ICACHE/DCACHE enable or disable
|
|
|
|
|
+# during `_premain_init`, which is only useful for internal usage
|
|
|
|
|
+-include $(NUCLEI_SDK_SOC)/runmode.mk
|
|
|
|
|
+# NOTE: When cpufeature.mk and cpufeature.h are generated by nuclei_gen
|
|
|
|
|
+# then CPU_CONFIG_MK will be defined as 1 in cpufeature.mk
|
|
|
|
|
+# And then cpuconfig.mk will not be included
|
|
|
|
|
+ifneq ($(CPU_CONFIG_MK),1)
|
|
|
|
|
+# NOTE: this is useful for nuclei sdk for evalsoc to dynamic control which cpu config to be enabled
|
|
|
|
|
+# eg. XLCFG_PLIC=1 will enable plic and will define CFG_HAS_PLIC
|
|
|
|
|
+-include $(NUCLEI_SDK_SOC)/cpuconfig.mk
|
|
|
|
|
+endif
|
|
|
|
|
+
|
|
|
|
|
+# NOTE: include nuclei qemu run options
|
|
|
|
|
+-include $(NUCLEI_SDK_SOC)/qemu.mk
|
|
|
|
|
+# NOTE: include nuclei near cycle model run options
|
|
|
|
|
+-include $(NUCLEI_SDK_SOC)/xlmodel.mk
|