initial versioin

This commit is contained in:
Wang Chen
2021-03-31 14:32:02 +08:00
committed by unicornx
parent 8ad78e0e0a
commit ad15280f3a
277 changed files with 15119 additions and 1 deletions

7
code/asm/asm2c/Makefile Normal file
View File

@@ -0,0 +1,7 @@
EXEC = test
SRC = $(EXEC).s $(EXEC).c
GDBINIT = ./gdbinit
include ../rule.mk

9
code/asm/asm2c/gdbinit Normal file
View File

@@ -0,0 +1,9 @@
display/z $sp
display/z $ra
display/z $a0
display/z $a1
set disassemble-next-line on
b _start
target remote : 1234
c

5
code/asm/asm2c/test.c Normal file
View File

@@ -0,0 +1,5 @@
int foo(int a, int b)
{
int sum = a + b;
return sum;
}

23
code/asm/asm2c/test.s Normal file
View File

@@ -0,0 +1,23 @@
# ASM call C
.text # Define beginning of text section
.global _start # Define entry _start
.global foo #
_start: # Label, not really required
la sp, stack_end # prepare stack for calling functions
li a0, 1
li a1, 2
call foo
stop:
j stop # Infinite loop to stop execution
stack_start:
.rept 10
.word 0
.endr
stack_end:
.end # End of file