summaryrefslogtreecommitdiff
path: root/c/bfhello
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2026-05-23 20:14:34 -0500
committercheapie <no-email-for-you@example.com>2026-05-23 20:14:34 -0500
commit85b5fde272be6ab543aa866baebabddc24566bdb (patch)
treeb4f2e3bb634effe51c2bdc5585ca4ea8b98d6dfa /c/bfhello
downloadrvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.gz
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.bz2
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.xz
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.zip
Add initial content
Diffstat (limited to 'c/bfhello')
-rw-r--r--c/bfhello/Makefile20
-rw-r--r--c/bfhello/bfhello.b1
-rw-r--r--c/bfhello/bfhello.c91
-rwxr-xr-xc/bfhello/bfhello.elfbin0 -> 6508 bytes
-rw-r--r--c/bfhello/bfhello.hex27
-rw-r--r--c/bfhello/bfhello.obin0 -> 1856 bytes
-rw-r--r--c/bfhello/rvcontroller.ld45
7 files changed, 184 insertions, 0 deletions
diff --git a/c/bfhello/Makefile b/c/bfhello/Makefile
new file mode 100644
index 0000000..fa163ed
--- /dev/null
+++ b/c/bfhello/Makefile
@@ -0,0 +1,20 @@
+all: bfhello.hex
+
+bfhello.o: bfhello.c
+ clang -target riscv32-none-elf -I../rvcontroller-libraries -march=rv32imacb_zicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx_zcb_zcmp_zcmt -ffreestanding -O3 -c -o bfhello.o bfhello.c
+
+bfhello.elf: ../rvcontroller-libraries/rvcontroller-init.o ../rvcontroller-libraries/rvcontroller-ecalls.o bfhello.o
+ riscv32-none-elf-ld -T rvcontroller.ld --no-warn-rwx-segments -o bfhello.elf ../rvcontroller-libraries/rvcontroller-init.o bfhello.o ../rvcontroller-libraries/rvcontroller-ecalls.o
+
+dump: bfhello.elf
+ riscv32-none-elf-objdump -d bfhello.elf
+
+bfhello.hex: bfhello.elf
+ riscv32-none-elf-objcopy -O ihex bfhello.elf bfhello.hex
+
+load: bfhello.hex
+ bash -c "wl-copy < bfhello.hex"
+
+clean:
+ rm -f bfhello.bin bfhello.elf bfhello.o init.o
+
diff --git a/c/bfhello/bfhello.b b/c/bfhello/bfhello.b
new file mode 100644
index 0000000..8e5e5a6
--- /dev/null
+++ b/c/bfhello/bfhello.b
@@ -0,0 +1 @@
+++++++++[>+++++++++<-]>.+++++++++++++++++++++++++++++.+++++++..+++.>++++[>++++++++<-]>.>+++++[<+++++++++++>-]<.>++++[<++++++>-]<.+++.------.--------.>+++[>+++++++++++<-]>.>++++++++++.
diff --git a/c/bfhello/bfhello.c b/c/bfhello/bfhello.c
new file mode 100644
index 0000000..95d2209
--- /dev/null
+++ b/c/bfhello/bfhello.c
@@ -0,0 +1,91 @@
+/* This is a translation of bfhello.b, generated by bftoc.py (by Paul Kaefer)
+ * It was generated on Sunday, May 17, 2026 at 12:17AM
+ */
+
+#include "rvcontroller-ecalls.h"
+
+void main(void)
+{
+ int size = 1000;
+ int tape[size];
+ int i = 0;
+
+ /* Clearing the tape (array) */
+ for (i=0; i<size; i++)
+ tape[i] = 0;
+
+ int ptr = 0;
+
+ tape[ptr] += 8;
+ while (tape[ptr] != 0)
+ {
+ ptr += 1;
+ tape[ptr] += 9;
+ ptr -= 1;
+ tape[ptr] -= 1;
+ }
+ ptr += 1;
+ printchar(tape[ptr]);
+ tape[ptr] += 29;
+ printchar(tape[ptr]);
+ tape[ptr] += 7;
+ printchar(tape[ptr]);
+ printchar(tape[ptr]);
+ tape[ptr] += 3;
+ printchar(tape[ptr]);
+ ptr += 1;
+ tape[ptr] += 4;
+ while (tape[ptr] != 0)
+ {
+ ptr += 1;
+ tape[ptr] += 8;
+ ptr -= 1;
+ tape[ptr] -= 1;
+ }
+ ptr += 1;
+ printchar(tape[ptr]);
+ ptr += 1;
+ tape[ptr] += 5;
+ while (tape[ptr] != 0)
+ {
+ ptr -= 1;
+ tape[ptr] += 11;
+ ptr += 1;
+ tape[ptr] -= 1;
+ }
+ ptr -= 1;
+ printchar(tape[ptr]);
+ ptr += 1;
+ tape[ptr] += 4;
+ while (tape[ptr] != 0)
+ {
+ ptr -= 1;
+ tape[ptr] += 6;
+ ptr += 1;
+ tape[ptr] -= 1;
+ }
+ ptr -= 1;
+ printchar(tape[ptr]);
+ tape[ptr] += 3;
+ printchar(tape[ptr]);
+ tape[ptr] -= 6;
+ printchar(tape[ptr]);
+ tape[ptr] -= 8;
+ printchar(tape[ptr]);
+ ptr += 1;
+ tape[ptr] += 3;
+ while (tape[ptr] != 0)
+ {
+ ptr += 1;
+ tape[ptr] += 11;
+ ptr -= 1;
+ tape[ptr] -= 1;
+ }
+ ptr += 1;
+ printchar(tape[ptr]);
+ ptr += 1;
+ tape[ptr] += 10;
+ printchar(tape[ptr]);
+ return;
+}
+
diff --git a/c/bfhello/bfhello.elf b/c/bfhello/bfhello.elf
new file mode 100755
index 0000000..fea2048
--- /dev/null
+++ b/c/bfhello/bfhello.elf
Binary files differ
diff --git a/c/bfhello/bfhello.hex b/c/bfhello/bfhello.hex
new file mode 100644
index 0000000..c21b4ac
--- /dev/null
+++ b/c/bfhello/bfhello.hex
@@ -0,0 +1,27 @@
+:10000000370101002920A9487300000082804EB802
+:10001000130101801301018805650A95233485FACF
+:1000200028009305F57F9385157A23200500110597
+:10003000E31DB5FE2245B245130685003365A520B4
+:100040002E9513058504B3F5C50E3355C50EB3E4DF
+:10005000A50013F5F40FC1201385D401619D652817
+:1000600013844402619C22857D2022856D201385A6
+:100070007402619D4D204245D2451306450033650B
+:10008000B52013050502B3F5C50E3355C50E33E48F
+:10009000A5001375F40F41206245930555003346C2
+:1000A000A5203325A6202295130575033376B40EBB
+:1000B0003355B50E3364A6001375F40FA928130544
+:1000C0008401619D89281305B401619DA920130550
+:1000D0005401619D89201305D400619D2D2803459D
+:1000E000C10113051502619D3D200345010229054B
+:1000F000619D85658A9503B485FA1301017F13011B
+:1001000001794EBA09A885487300000082809148A1
+:10011000730000008280AD48730000008280930865
+:1001200010087300000082809308500873000000DC
+:10013000828093087008730000008280732510C0CD
+:100140008280732500C082809308600873000000DD
+:1001500082800589F322008093920248B3E2A200D4
+:10016000739002808280954873000000828093081B
+:100170000008730000008280A148730000008280A4
+:1001800093083008730000008280930840087300D1
+:040190000000828069
+:00000001FF
diff --git a/c/bfhello/bfhello.o b/c/bfhello/bfhello.o
new file mode 100644
index 0000000..c206039
--- /dev/null
+++ b/c/bfhello/bfhello.o
Binary files differ
diff --git a/c/bfhello/rvcontroller.ld b/c/bfhello/rvcontroller.ld
new file mode 100644
index 0000000..985892b
--- /dev/null
+++ b/c/bfhello/rvcontroller.ld
@@ -0,0 +1,45 @@
+/* Thanks https://github.com/darklife/darkriscv */
+ __heap_size = 0x200; /* required amount of heap */
+ __stack_size = 0x800; /* required amount of stack */
+ ENTRY(_start);
+ MEMORY
+ {
+ RAM (rwx) : ORIGIN = 0x00000000, LENGTH = 0x10000
+ }
+ SECTIONS
+ {
+ .text :
+ {
+ *(.text.startup)
+ *(.text)
+ *(.text)
+ *(.rodata*)
+ } > RAM
+ .data :
+ {
+ *(.sbss)
+ *(.data)
+ *(.bss)
+ *(.rela*)
+ *(COMMON)
+ } > RAM
+
+ .heap :
+ {
+ . = ALIGN(4);
+ PROVIDE ( end = . );
+ _sheap = .;
+ . = . + __heap_size;
+ . = ALIGN(4);
+ _eheap = .;
+ } >RAM
+
+ .stack :
+ {
+ . = ALIGN(4);
+ _estack = .;
+ . = . + __stack_size;
+ . = ALIGN(4);
+ _sstack = .;
+ } >RAM
+ }