aboutsummaryrefslogtreecommitdiffstats
path: root/examples/device_tree.format
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-11-06 17:39:08 +0000
committers-ol <s+removethis@s-ol.nu>2021-11-06 17:39:08 +0000
commit4853cb44e09303dd42b917fcdb56d00ccb3b2ef0 (patch)
treea1cd54c7d4375968876632ea2e01063219e1af2e /examples/device_tree.format
parentnew elf generator w/ symbol output (diff)
downloadsubv-hardware.tar.gz
subv-hardware.zip
Diffstat (limited to '')
-rw-r--r--examples/device_tree.format152
1 files changed, 152 insertions, 0 deletions
diff --git a/examples/device_tree.format b/examples/device_tree.format
new file mode 100644
index 0000000..ca4f2bd
--- /dev/null
+++ b/examples/device_tree.format
@@ -0,0 +1,152 @@
+== code 0x80400000
+# main:
+# print device tree info.
+# OpenSBI calls us with a1 set to the start of the DTB
+# load 0x10000000 (UART0) into a0
+37/7 0a/5 10000/20
+
+13/7 15/5 0/3 0b/5 000/12
+
+# check magic == 0xd00dfeed
+37/7 06/5 edfe1/20
+13/7 06/5 0/3 06/5 dd0/12
+03/7 05/5 2/3 15/5 000/12
+63/7 0/1 c/4 1/3 05/5 06/5 01/6 0/1
+
+37/7 0b/5 80500/20
+13/7 0b/5 0/3 0b/5 014/12
+6f/7 01/5 00/8 0/1 044/10 0/1
+
+03/7 0b/5 2/3 15/5 004/12
+6f/7 01/5 00/8 0/1 01a/10 0/1
+6f/7 01/5 00/8 0/1 050/10 0/1
+6f/7 01/5 00/8 0/1 030/10 0/1
+
+# exit:
+# system reset (via SBI extension SRST)
+# a7 = ext id, a6 = fid, a0 = 0, a1 = 0
+37/7 11/5 53525/20
+13/7 11/5 0/3 11/5 354/12
+33/7 10/5 0/3 00/5 00/5 00/7
+33/7 0a/5 0/3 00/5 00/5 00/7
+33/7 0b/5 0/3 00/5 00/5 00/7
+# ECALL
+73/7 00/5 0/3 00/5 000/12
+
+# err_magic:
+37/7 0b/5 80500/20
+13/7 0b/5 0/3 0b/5 000/12
+6f/7 01/5 00/8 0/1 02a/10 0/1
+6f/7 00/5 ff/8 1/1 3ee/10 1/1
+
+# bswapw:
+# byte-order-swap word in a1
+# srli a1, a0, 8
+# lui a2, 16
+# addi a2, a2, -256
+# and a1, a1, a2
+13/7 05/5 5/3 0b/5 008/12
+37/7 06/5 00016/20
+13/7 06/5 0/3 06/5 f00/12
+33/7 05/5 7/3 05/5 06/5 00/7
+# srli a2, a0, 24
+# or a1, a1, a2
+13/7 06/5 5/3 0b/5 018/12
+33/7 05/5 6/3 05/5 06/5 00/7
+# slli a2, a0, 8
+# lui a3, 4080
+# and a2, a2, a3
+13/7 06/5 1/3 0b/5 008/12
+37/7 07/5 00ff0/20
+33/7 06/5 7/3 06/5 07/5 00/7
+# slli a0, a0, 24
+# or a0, a0, a2
+# or a0, a0, a1
+13/7 0b/5 1/3 0b/5 018/12
+33/7 0b/5 6/3 0b/5 06/5 00/7
+33/7 0b/5 6/3 0b/5 05/5 00/7
+# ret
+67/7 00/5 0/3 01/5 000/12
+
+# printnl:
+13/7 06/5 0/3 00/5 00a/12
+# printnl:spin:
+# spin if FIFO is full (thr_emtpy = UART+5 & 0x20)
+03/7 07/5 4/3 0a/5 005/12
+13/7 07/5 7/3 07/5 020/12
+63/7 1/1 c/4 0/3 07/5 00/5 3f/6 1/1
+# print char
+23/7 00/5 2/3 0a/5 06/5 00/7
+# return
+67/7 00/5 0/3 01/5 000/12
+
+# print:
+# print:loop:
+# load unsigned byte at a1
+03/7 06/5 4/3 0b/5 000/12
+# break loop if zero
+63/7 0/1 e/4 0/3 06/5 00/5 00/6 0/1
+# print:spin:
+# spin if FIFO is full (thr_emtpy = UART+5 & 0x20)
+03/7 07/5 4/3 0a/5 005/12
+13/7 07/5 7/3 07/5 020/12
+63/7 1/1 c/4 0/3 07/5 00/5 3f/6 1/1
+# print char
+23/7 00/5 2/3 0a/5 06/5 00/7
+# increment a1
+13/7 0b/5 0/3 0b/5 001/12
+# jump back up
+6f/7 00/5 ff/8 1/1 3f2/10 1/1
+# print:break:
+# return
+67/7 00/5 0/3 01/5 000/12
+
+# print_hex_word:
+13/7 08/5 0/3 0b/5 000/12
+13/7 09/5 0/3 00/5 01c/12
+13/7 12/5 0/3 01/5 000/12
+# print_hex_word:loop:
+# shift
+33/7 0b/5 5/3 08/5 09/5 00/7
+6f/7 01/5 00/8 0/1 00a/10 0/1
+
+# break if last shift
+63/7 0/1 6/4 0/3 09/5 00/5 00/6 0/1
+
+# subtract shift count, loop
+13/7 09/5 0/3 09/5 ffc/12
+6f/7 00/5 ff/8 1/1 3f8/10 1/1
+# print_hex_word:break:
+# return
+67/7 00/5 0/3 12/5 000/12
+
+# print_hex_dgt:
+# a1 = a1 & 0xf
+13/7 0b/5 7/3 0b/5 00f/12
+# t1 = 0x40
+13/7 06/5 0/3 00/5 040/12
+
+# add 0x30 (ascii '0') / 0x61 (ascii 'a')
+13/7 0b/5 0/3 0b/5 030/12
+63/7 0/1 4/4 4/3 0b/5 06/5 00/6 0/1
+13/7 0b/5 0/3 0b/5 027/12
+
+# print_hex_dgt:spin:
+# spin if FIFO is full (thr_emtpy = UART+5 & 0x20)
+03/7 07/5 4/3 0a/5 005/12
+13/7 07/5 7/3 07/5 020/12
+63/7 1/1 c/4 0/3 07/5 00/5 3f/6 1/1
+
+# print char
+23/7 00/5 2/3 0a/5 0b/5 00/7
+
+# return
+67/7 00/5 0/3 01/5 000/12
+
+== data 0x80500000
+# E_MAGIC:
+# "Invalid DTB magic!\n\0"
+49/8 6e/8 76/8 61/8 6c/8 69/8 64/8 20/8 44/8 54/8 42/8 20/8 6d/8 61/8 67/8 69/8 63/8 21/8 a/8 0/8
+# S_TOTALSZ:
+54/8 6f/8 74/8 61/8 6c/8 20/8 53/8 69/8 7a/8 65/8 3a/8 20/8 0/8
+