From 2ecf97e382b4aff25bb97ea730a0c36d08747998 Mon Sep 17 00:00:00 2001 From: cheapie Date: Mon, 25 May 2026 14:01:06 -0500 Subject: Add big-endian railroad crossing sample and big-endian versions of libraries --- c/rvcontroller-libraries/rvcontroller-init-be.S | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 c/rvcontroller-libraries/rvcontroller-init-be.S (limited to 'c/rvcontroller-libraries/rvcontroller-init-be.S') diff --git a/c/rvcontroller-libraries/rvcontroller-init-be.S b/c/rvcontroller-libraries/rvcontroller-init-be.S new file mode 100644 index 0000000..86389c7 --- /dev/null +++ b/c/rvcontroller-libraries/rvcontroller-init-be.S @@ -0,0 +1,30 @@ +#Assembly stub for C programs targeting RVController - Big-endian Flavor +#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 + +#This file should always be linked first. +#RVController has a default reset vector of 0, +#therefore _start should end up as the first thing in the file. + +.section .text.startup +_start: + +# Switch to big-endian mode (little-endian is default after reset) +li t0,0x20 # MBE +csrrs x0,0x310,t0 # 0x310 = mstatush + +# Set up stack pointer +li sp,0x10000 + +# Call main function +call main + +# Exit program +li a7,10 +ecall + +# Shouldn't ever get here, will crash if it does +ret + +.globl _start -- cgit v1.2.3