aboutsummaryrefslogtreecommitdiff
path: root/machine
diff options
context:
space:
mode:
authorYan <892930505@qq.com>2020-11-01 08:14:48 +0800
committerGitHub <noreply@github.com>2020-10-31 17:14:48 -0700
commita4d4298ca10527a51fad86c53a93c48e6f510092 (patch)
tree7f2c843dd521181cbf3ae8ffa5ba660997c0b3f3 /machine
parentdef2f01eee49aa639c6e393d161687998cd64c4e (diff)
downloadriscv-pk-a4d4298ca10527a51fad86c53a93c48e6f510092.zip
riscv-pk-a4d4298ca10527a51fad86c53a93c48e6f510092.tar.gz
riscv-pk-a4d4298ca10527a51fad86c53a93c48e6f510092.tar.bz2
Disable device tree filter when load a dts from file (#219)
* add device tree in elf, using --with-dts to add the absolute path of device tree * Disable device tree filter * Remove *.dtb dependence, when the --with-dts option is not used
Diffstat (limited to 'machine')
-rw-r--r--machine/machine.ac5
-rw-r--r--machine/machine.mk.in7
-rw-r--r--machine/mentry.S13
3 files changed, 25 insertions, 0 deletions
diff --git a/machine/machine.ac b/machine/machine.ac
index a787113..011f0ca 100644
--- a/machine/machine.ac
+++ b/machine/machine.ac
@@ -4,3 +4,8 @@ AC_ARG_ENABLE([fp-emulation], AS_HELP_STRING([--disable-fp-emulation], [Disable
AS_IF([test "x$enable_fp_emulation" != "xno"], [
AC_DEFINE([PK_ENABLE_FP_EMULATION],,[Define if floating-point emulation is enabled])
])
+
+AC_ARG_WITH([dts], AS_HELP_STRING([--with-dts], [Specify a customize dts]),
+ [AC_SUBST([CUSTOM_DTS], $with_dts, [customize dts])],
+ [AC_SUBST([CUSTOM_DTS], [no], [customize dts])]
+)
diff --git a/machine/machine.mk.in b/machine/machine.mk.in
index dcecb7a..ee0fc36 100644
--- a/machine/machine.mk.in
+++ b/machine/machine.mk.in
@@ -37,3 +37,10 @@ machine_c_srcs = \
machine_asm_srcs = \
mentry.S \
fp_asm.S \
+
+ifneq (@CUSTOM_DTS@,no)
+mentry.o: custom.dtb
+
+custom.dtb: $(CUSTOM_DTS)
+ dtc -O dtb $^ -o $@
+endif \ No newline at end of file
diff --git a/machine/mentry.S b/machine/mentry.S
index 9ec9916..f9285a4 100644
--- a/machine/mentry.S
+++ b/machine/mentry.S
@@ -281,6 +281,10 @@ do_reset:
#endif
# Boot on the first hart
+#ifdef CUSTOM_DTS
+ csrr a0, mhartid
+ la a1, dtb_start
+#endif
j init_first_hart
.LmultiHartInit:
@@ -313,6 +317,15 @@ do_reset:
wfi
j .LmultiHart
+#ifdef CUSTOM_DTS
+.section .dtb
+.align 3
+.global dtb_start, dtb_end
+dtb_start:
+.incbin "custom.dtb"
+dtb_end:
+#endif
+
.bss
.align RISCV_PGSHIFT
stacks: