From 7bf906f3692618c21d2a03600cb6bd84b1e9a467 Mon Sep 17 00:00:00 2001 From: Toby Jaffey Date: Mon, 8 Dec 2025 02:45:38 +0000 Subject: [PATCH] Rename .s to .S so preprocessor runs (https://stackoverflow.com/questions/33358825/gnu-assembler-preprocessor-define) --- apps/crt0.S | 13 +++++++++++++ apps/hello-asm/hello-asm.S | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 apps/crt0.S create mode 100644 apps/hello-asm/hello-asm.S diff --git a/apps/crt0.S b/apps/crt0.S new file mode 100644 index 0000000..220fd7a --- /dev/null +++ b/apps/crt0.S @@ -0,0 +1,13 @@ +#include "uvm32_sys.h" +#include "uvm32_common_custom.h" +.section .initial_jump , "ax", %progbits +.global _start +.align 4 +_start: +# sp is already setup by vm +sw ra,12(sp) +jal ra, main +li a7, 0x138 #IOREQ_HALT (Rust assembler doesn't pick up def...) +ecall +.section .data + diff --git a/apps/hello-asm/hello-asm.S b/apps/hello-asm/hello-asm.S new file mode 100644 index 0000000..a38c926 --- /dev/null +++ b/apps/hello-asm/hello-asm.S @@ -0,0 +1,12 @@ +#include "uvm32_sys.h" +#include "uvm32_common_custom.h" +.section .initial_jump , "ax", %progbits +.global _start +_start: +la a0, str +li a7, IOREQ_PRINTLN +ecall +li a7, IOREQ_HALT +ecall +str: +.ascii "Hi\0"