summaryrefslogtreecommitdiff
path: root/echo.S
diff options
context:
space:
mode:
authortaitep <taitep@taitep.se>2025-12-21 17:04:18 +0100
committertaitep <taitep@taitep.se>2025-12-21 17:04:18 +0100
commit25dd685345b4bba7418eca4252e1b65ce20356cd (patch)
treec7c16b686f5cda154cf8b7b4898a1cfdd38fb8fd /echo.S
parentc05ba60c3c6ebe89a3db666c316929e0d0d2fdfa (diff)
Add a linker script and example uart echo program
Diffstat (limited to 'echo.S')
-rw-r--r--echo.S18
1 files changed, 18 insertions, 0 deletions
diff --git a/echo.S b/echo.S
new file mode 100644
index 0000000..58b2573
--- /dev/null
+++ b/echo.S
@@ -0,0 +1,18 @@
+.section .text
+.globl _start
+
+.equ UART_DATA, 0
+.equ UART_STATUS, 1
+.equ UART_RX_READY = 0b10
+.equ UART_TX_READY = 0b01
+
+_start:
+ li a0, 0x1000
+
+loop:
+ lbu t0, UART_STATUS(a0)
+ andi t0, t0, UART_RX_READY
+ beqz t0, loop
+ lbu t0, UART_DATA(a0)
+ sb t0, UART_DATA(a0)
+ j loop