Add support for running LK in supervisor mode or machine mode. - Macro-ify CSR access to use correct CSR # or use SBI call as req'd - Add support to make SBI calls - Split CLINT and lk timer abstraction so that RISC-V timer can use SBI as required. - Add support for booting other harts as primary since hart0 on U540 does not support S-mode. A map is used to get LK cpu number from hartid.
30 lines
657 B
Makefile
30 lines
657 B
Makefile
LOCAL_DIR := $(GET_LOCAL_DIR)
|
|
MODULE := $(LOCAL_DIR)
|
|
|
|
PLATFORM := sifive
|
|
VARIANT := sifive_u
|
|
|
|
WITH_SMP := 1
|
|
BOOT_HART := 1
|
|
|
|
GLOBAL_DEFINES += SIFIVE_FREQ=500000000 # 500 MHz
|
|
|
|
RISCV_MODE ?= machine
|
|
|
|
ifeq ($(RISCV_MODE),supervisor)
|
|
MEMBASE ?= 0x080200000
|
|
SMP_MAX_CPUS := 4
|
|
else
|
|
MEMBASE ?= 0x080000000
|
|
SMP_MAX_CPUS := 5
|
|
endif
|
|
MEMSIZE ?= 0x200000000 # 8 GiB
|
|
|
|
MODULE_SRCS := $(LOCAL_DIR)/target.c
|
|
# set some global defines based on capability
|
|
GLOBAL_DEFINES += TARGET_HAS_DEBUG_LED=1
|
|
GLOBAL_DEFINES += PLATFORM_HAS_DYNAMIC_TIMER=1
|
|
GLOBAL_DEFINES += ARCH_RISCV_CLINT_BASE=0x02000000
|
|
GLOBAL_DEFINES += ARCH_RISCV_MTIME_RATE=1000000 # 1 MHz
|
|
|
|
include make/module.mk |