aboutsummaryrefslogtreecommitdiff
path: root/machine
diff options
context:
space:
mode:
authorYan <892930505@qq.com>2020-10-30 05:27:39 +0800
committerGitHub <noreply@github.com>2020-10-29 14:27:39 -0700
commita161e6f3ef31004e47a5b94b85c2e84b764f8637 (patch)
tree1a28b326a3caffd63091e079e4f00f0680c2ce0e /machine
parentf7df78365f9aca4102a6d7136ea58b91f51c13cb (diff)
downloadriscv-pk-a161e6f3ef31004e47a5b94b85c2e84b764f8637.zip
riscv-pk-a161e6f3ef31004e47a5b94b85c2e84b764f8637.tar.gz
riscv-pk-a161e6f3ef31004e47a5b94b85c2e84b764f8637.tar.bz2
Disable device tree filter when load a dts from file (#217)
* add device tree in elf, using --with-dts to add the absolute path of device tree * Disable device tree filter
Diffstat (limited to 'machine')
-rw-r--r--machine/machine.ac4
-rw-r--r--machine/machine.mk.in5
-rw-r--r--machine/mentry.S13
3 files changed, 22 insertions, 0 deletions
diff --git a/machine/machine.ac b/machine/machine.ac
index a787113..e3033b2 100644
--- a/machine/machine.ac
+++ b/machine/machine.ac
@@ -4,3 +4,7 @@ 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], [Support a machine dts]),
+ [AC_SUBST([MACHINE_DTS], $with_dts, [machine dts])]
+)
diff --git a/machine/machine.mk.in b/machine/machine.mk.in
index dcecb7a..c7075fb 100644
--- a/machine/machine.mk.in
+++ b/machine/machine.mk.in
@@ -37,3 +37,8 @@ machine_c_srcs = \
machine_asm_srcs = \
mentry.S \
fp_asm.S \
+
+mentry.o: machine.dtb
+
+machine.dtb: $(MACHINE_DTS)
+ dtc -O dtb $^ -o $@ \ No newline at end of file
diff --git a/machine/mentry.S b/machine/mentry.S
index 9ec9916..e619812 100644
--- a/machine/mentry.S
+++ b/machine/mentry.S
@@ -281,6 +281,10 @@ do_reset:
#endif
# Boot on the first hart
+#ifdef MACHINE_DTS
+ csrr a0, mhartid
+ la a1, dtb_start
+#endif
j init_first_hart
.LmultiHartInit:
@@ -313,6 +317,15 @@ do_reset:
wfi
j .LmultiHart
+#ifdef MACHINE_DTS
+.section .dtb
+.align 3
+.global dtb_start, dtb_end
+dtb_start:
+.incbin "machine.dtb"
+dtb_end:
+#endif
+
.bss
.align RISCV_PGSHIFT
stacks: