Add a linker script and example uart echo program

This commit is contained in:
2025-12-21 17:04:18 +01:00
parent c05ba60c3c
commit 25dd685345
2 changed files with 40 additions and 0 deletions

18
echo.S Normal file
View File

@@ -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

22
link.ld Normal file
View File

@@ -0,0 +1,22 @@
ENTRY(_start)
SECTIONS {
. = 0x80000000;
.text : ALIGN(4) {
*(.text*)
}
.rodata : ALIGN(8) {
*(.rodata*)
}
.data : ALIGN(8) {
*(.data*)
}
.bss : ALIGN(8) {
*(.bss*)
*(COMMON)
}
}