User Tools

Site Tools


riscv

This is an old revision of the document!


Riscv - how to use prinf from assembler

The following link explains how to setup and run RiscV Debian in qemu:-

https://www.codeproject.com/Tips/5383029/Run-Debian-RISC-V-In-QEMU-Virtual-Environment-For

All work has been carried out in the resulting operating system.

assemble with: as test2.s -o test2.o

then compile with: gcc test2.o -o test2

run with: ./test

test2.s
.section .rodata
prompt: .asciz "Value of t0 = %ld and value of t1 = %ld\n"
.globl main
.section .text
main:
    addi    sp, sp, -8
    sd      ra, 0(sp)
    la      a0, prompt
    li      t0,44
    li      t1,88
    mv      a1, t0
    mv      a2, t1
    call    printf
    ld      ra, 0(sp)
    addi    sp, sp, 8
    ret

https://fraserinnovations.com/risc-v/risc-v-instruction-set-explanation/

https://www.riscvschool.com/2022/04/28/risc-v-assembly-tutorial/

https://opentitan.org/book/doc/contributing/style_guides/asm_coding_style.html

https://mcyoung.xyz/2021/11/29/assembly-1/

https://operating-system-in-1000-lines.vercel.app/en/04-boot

https://riscvasm.lucasteske.dev/# online emulator

https://godbolt.org/ online emulator

riscv.1738510395.txt.gz · Last modified: 2025/02/02 15:33 by admin