summaryrefslogtreecommitdiff
path: root/c/bigfib
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/bigfib
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/bigfib')
-rw-r--r--c/bigfib/Makefile20
-rw-r--r--c/bigfib/bigfib.c23
-rwxr-xr-xc/bigfib/bigfib.elfbin0 -> 6552 bytes
-rw-r--r--c/bigfib/bigfib.hex19
-rw-r--r--c/bigfib/bigfib.obin0 -> 2184 bytes
-rw-r--r--c/bigfib/rvcontroller.ld45
6 files changed, 107 insertions, 0 deletions
diff --git a/c/bigfib/Makefile b/c/bigfib/Makefile
new file mode 100644
index 0000000..6eb4ffc
--- /dev/null
+++ b/c/bigfib/Makefile
@@ -0,0 +1,20 @@
+all: bigfib.hex
+
+bigfib.o: bigfib.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 bigfib.o bigfib.c
+
+bigfib.elf: ../rvcontroller-libraries/rvcontroller-init.o ../rvcontroller-libraries/rvcontroller-ecalls.o bigfib.o
+ riscv32-none-elf-ld -T rvcontroller.ld --no-warn-rwx-segments -o bigfib.elf ../rvcontroller-libraries/rvcontroller-init.o bigfib.o ../rvcontroller-libraries/rvcontroller-ecalls.o
+
+dump: bigfib.elf
+ riscv32-none-elf-objdump -d bigfib.elf
+
+bigfib.hex: bigfib.elf
+ riscv32-none-elf-objcopy -O ihex bigfib.elf bigfib.hex
+
+load: bigfib.hex
+ bash -c "wl-copy < bigfib.hex"
+
+clean:
+ rm -f bigfib.bin bigfib.elf bigfib.o init.o
+
diff --git a/c/bigfib/bigfib.c b/c/bigfib/bigfib.c
new file mode 100644
index 0000000..063c27e
--- /dev/null
+++ b/c/bigfib/bigfib.c
@@ -0,0 +1,23 @@
+/* Fibonacci Sequence for RVController
+ * A product of Advanced Mesecons Devices, a Cheapie Systems company
+ * This is free and unencumbered software released into the public domain.
+ * See http://unlicense.org/ for more information */
+
+#include <stdint.h>
+#include "rvcontroller-ecalls.h"
+
+uint64_t prev = 0;
+uint64_t oldprev = 0;
+uint64_t curr = 1;
+
+void main(void) {
+ while ((curr & 0x800000000000000) == 0 ) {
+ printstr("\nH ");
+ printint(curr/(1LL << 32));
+ printstr("\nL ");
+ printint(curr%(1LL << 32));
+ oldprev = prev;
+ prev = curr;
+ curr = prev + oldprev;
+ }
+}
diff --git a/c/bigfib/bigfib.elf b/c/bigfib/bigfib.elf
new file mode 100755
index 0000000..2fcdf75
--- /dev/null
+++ b/c/bigfib/bigfib.elf
Binary files differ
diff --git a/c/bigfib/bigfib.hex b/c/bigfib/bigfib.hex
new file mode 100644
index 0000000..b13c263
--- /dev/null
+++ b/c/bigfib/bigfib.hex
@@ -0,0 +1,19 @@
+:10000000370101002920A94873000000828096B8BA
+:1000100022E44AE003457010218939E1B70900085C
+:100020001309400F130A800F930480104A85812022
+:10003000032540100D2852851D280325001025207A
+:1000400003350010906088E090E4B6952A96333529
+:10005000A600B386A50033F536012330C01079D54C
+:100060002264026996BE8548730000008280914830
+:10007000730000008280AD48730000008280930806
+:10008000100873000000828093085008730000007D
+:10009000828093087008730000008280732510C06E
+:1000A0008280732500C0828093086008730000007E
+:1000B00082800589F322008093920248B3E2A20075
+:1000C00073900280828095487300000082809308BC
+:1000D0000008730000008280A14873000000828045
+:1000E0009308300873000000828093084008730072
+:0C00F000000082800A4820000A4C20001A
+:1001000001000000000000000000000000000000EE
+:080110000000000000000000E7
+:00000001FF
diff --git a/c/bigfib/bigfib.o b/c/bigfib/bigfib.o
new file mode 100644
index 0000000..32d9e29
--- /dev/null
+++ b/c/bigfib/bigfib.o
Binary files differ
diff --git a/c/bigfib/rvcontroller.ld b/c/bigfib/rvcontroller.ld
new file mode 100644
index 0000000..985892b
--- /dev/null
+++ b/c/bigfib/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
+ }