Added serv and made a blinky testbench for it

This commit is contained in:
2026-02-21 19:24:18 +01:00
parent 3b04f3a6be
commit a261264fda
12 changed files with 284 additions and 2 deletions

14
sw/blinky/Makefile Normal file
View File

@@ -0,0 +1,14 @@
TOOLCHAIN_PREFIX?=riscv64-elf-
CC=$(TOOLCHAIN_PREFIX)gcc
OBJCOPY=$(TOOLCHAIN_PREFIX)objcopy
%.elf: %.S link.ld
# $(CC) -nostartfiles -nostdlib -march=rv32i_zicsr -mabi=ilp32 -Tlink.ld -o$@ $<
$(CC) -nostartfiles -nostdlib -ffreestanding -march=rv32i_zicsr -mabi=ilp32 -Tlink.ld -o$@ $<
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
%.hex: %.bin
hexdump -v -e '1/1 "%02x\n"' $< > $@
clean:
rm -f *.elf *.bin *.hex

17
sw/blinky/blinky.S Normal file
View File

@@ -0,0 +1,17 @@
#define GPIO_BASE 0x80000000
#define DELAY 100
.globl _start
_start:
lui a0, %hi(GPIO_BASE)
addi a0, a0, %lo(GPIO_BASE)
addi t0, zero, 0
li t1, DELAY
.lp1:
sb t0, 0(a0)
addi t0, t0, 1
and t2, zero, zero
time1:
addi t2, t2, 1
bne t1, t2, time1
j .lp1

BIN
sw/blinky/blinky.elf Executable file

Binary file not shown.

40
sw/blinky/blinky.hex Normal file
View File

@@ -0,0 +1,40 @@
37
05
00
80
13
05
05
00
93
02
00
00
13
03
40
06
23
00
55
00
93
82
12
00
b3
73
00
00
93
83
13
00
e3
1e
73
fe
6f
f0
df
fe

10
sw/blinky/link.ld Normal file
View File

@@ -0,0 +1,10 @@
OUTPUT_ARCH( "riscv" )
ENTRY(_start)
SECTIONS
{
. = 0x00000000;
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
}