From d609dcb35dafebeafced9c40d92ddd5da630aa54 Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 30 May 2026 08:58:29 -0500 Subject: Organize files better and include binaries for assembly samples --- assembly/hello/Makefile | 24 ++++++++++++++++++++++++ assembly/hello/hello.S | 6 ++++++ assembly/hello/hello.elf | Bin 0 -> 5304 bytes assembly/hello/hello.hex | 4 ++++ assembly/hello/hello.o | Bin 0 -> 1196 bytes assembly/hello/rvcontroller.ld | 1 + 6 files changed, 35 insertions(+) create mode 100644 assembly/hello/Makefile create mode 100644 assembly/hello/hello.S create mode 100755 assembly/hello/hello.elf create mode 100644 assembly/hello/hello.hex create mode 100644 assembly/hello/hello.o create mode 120000 assembly/hello/rvcontroller.ld (limited to 'assembly/hello') diff --git a/assembly/hello/Makefile b/assembly/hello/Makefile new file mode 100644 index 0000000..d7649e5 --- /dev/null +++ b/assembly/hello/Makefile @@ -0,0 +1,24 @@ +MARCH ?= rv32imacbzicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx_zcb_zcmp_zcmt + +.PHONY: all dump load clean + +all: hello.hex + +hello.o: hello.S + riscv32-none-elf-as -I../rvcontroller-libraries -march=${MARCH} -o hello.o hello.S + +hello.elf: hello.o + riscv32-none-elf-ld -T rvcontroller.ld --no-warn-rwx-segments -o hello.elf hello.o + +dump: hello.elf + riscv32-none-elf-objdump -d hello.elf + +hello.hex: hello.elf + riscv32-none-elf-objcopy -O ihex hello.elf hello.hex + +load: hello.hex + bash -c "wl-copy < hello.hex" + +clean: + rm -f hello.bin hello.elf hello.o + diff --git a/assembly/hello/hello.S b/assembly/hello/hello.S new file mode 100644 index 0000000..3eecf13 --- /dev/null +++ b/assembly/hello/hello.S @@ -0,0 +1,6 @@ +la a0,message +li a7,4 +ecall +li a7,10 +ecall +message: .asciz "Hello, world!\n" diff --git a/assembly/hello/hello.elf b/assembly/hello/hello.elf new file mode 100755 index 0000000..6aec39b Binary files /dev/null and b/assembly/hello/hello.elf differ diff --git a/assembly/hello/hello.hex b/assembly/hello/hello.hex new file mode 100644 index 0000000..f689ad4 --- /dev/null +++ b/assembly/hello/hello.hex @@ -0,0 +1,4 @@ +:100000001705000013054501914873000000A94839 +:100010007300000048656C6C6F2C20776F726C6405 +:04002000210A0000B1 +:00000001FF diff --git a/assembly/hello/hello.o b/assembly/hello/hello.o new file mode 100644 index 0000000..2d0bfb3 Binary files /dev/null and b/assembly/hello/hello.o differ diff --git a/assembly/hello/rvcontroller.ld b/assembly/hello/rvcontroller.ld new file mode 120000 index 0000000..bc01402 --- /dev/null +++ b/assembly/hello/rvcontroller.ld @@ -0,0 +1 @@ +../../rvcontroller.ld \ No newline at end of file -- cgit v1.2.3