Ok this is epic
This commit is contained in:
18
test/Makefile
Normal file
18
test/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
GCC_COMPILER=riscv32-unknown-elf-gcc
|
||||
GCC_OBJCOPY=riscv32-unknown-elf-objcopy
|
||||
|
||||
all:
|
||||
assemble
|
||||
build
|
||||
@echo "Done"
|
||||
|
||||
assemble:
|
||||
$(GCC_COMPILER) -S test.c
|
||||
|
||||
build:
|
||||
$(GCC_COMPILER) -Wl,-Ttext=0x0 -nostdlib -march=rv64i -mabi=lp64 -o test test.S
|
||||
$(GCC_OBJCOPY) -O binary test test.bin
|
||||
|
||||
clean:
|
||||
rm -f test test.bin
|
||||
|
||||
6
test/basic.S
Normal file
6
test/basic.S
Normal file
@@ -0,0 +1,6 @@
|
||||
ADDI x2, x0, 1
|
||||
|
||||
loop:
|
||||
SUB x1, x1, x2
|
||||
SW x1, 4(x0)
|
||||
BLT x0, x1, loop
|
||||
6
test/test.S
Normal file
6
test/test.S
Normal file
@@ -0,0 +1,6 @@
|
||||
ADDI x2, x0, 1
|
||||
|
||||
loop:
|
||||
SUB x1, x1, x2
|
||||
SW x1, 4(x0)
|
||||
BLT x0, x1, loop
|
||||
4
test/test.c
Normal file
4
test/test.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int main() {
|
||||
int x = 1 + 2;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user