move assembly project

This commit is contained in:
2020-09-27 18:05:58 -06:00
parent cd811470bb
commit 6fc8195b27
7 changed files with 0 additions and 0 deletions

1
test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
elf2hex

20
test/Makefile Normal file
View File

@ -0,0 +1,20 @@
all: test.hex
CC = riscv64-linux-gnu-gcc
# CFLAGS = -march=rv32i -mabi=ilp32
CFLAGS = -march=rv64i -mabi=lp64
AS = riscv64-linux-gnu-as
ASFLAGS = $(CFLAGS)
LD = riscv64-linux-gnu-ld
LDFLAGS = -T test.ld
%.o: %.S
$(AS) $(ASFLAGS) $^ -o $@
%.elf: %.o
$(LD) $(LDFLAGS) $^ -o $@
test.hex: test.elf
riscv64-linux-gnu-objdump -s $^ | sed -n '/0000/,$$p' | cut -f3-6 -d ' ' | sed -e 's/ /\n/g' > $@

36
test/test.S Normal file
View File

@ -0,0 +1,36 @@
.global _start
.text
_start:
add x1, x0, x0
add x2, x0, x0
add x3, x0, x0
add x4, x0, x0
add x5, x0, x0
add x6, x0, x0
add x7, x0, x0
add x8, x0, x0
add x9, x0, x0
add x10, x0, x0
add x11, x0, x0
add x12, x0, x0
add x13, x0, x0
add x14, x0, x0
add x15, x0, x0
add x16, x0, x0
add x17, x0, x0
add x18, x0, x0
add x19, x0, x0
add x20, x0, x0
add x21, x0, x0
add x22, x0, x0
add x23, x0, x0
add x24, x0, x0
add x25, x0, x0
add x26, x0, x0
add x27, x0, x0
add x28, x0, x0
add x29, x0, x0
add x30, x0, x0
add x31, x0, x0
.data

12
test/test.csv Normal file
View File

@ -0,0 +1,12 @@
test.elf: file format elf64-littleriscv
Contents of section .text:
0000 b3000000 33010000 b3010000 33020000 ....3.......3...
0010 b3020000 33030000 b3030000 33040000 ....3.......3...
0020 b3040000 33050000 b3050000 33060000 ....3.......3...
0030 b3060000 33070000 b3070000 33080000 ....3.......3...
0040 b3080000 33090000 b3090000 330a0000 ....3.......3...
0050 b30a0000 330b0000 b30b0000 330c0000 ....3.......3...
0060 b30c0000 330d0000 b30d0000 330e0000 ....3.......3...
0070 b30e0000 330f0000 b30f0000 ....3.......
1 test.elf: file format elf64-littleriscv
2 Contents of section .text:
3 0000 b3000000 33010000 b3010000 33020000 ....3.......3...
4 0010 b3020000 33030000 b3030000 33040000 ....3.......3...
5 0020 b3040000 33050000 b3050000 33060000 ....3.......3...
6 0030 b3060000 33070000 b3070000 33080000 ....3.......3...
7 0040 b3080000 33090000 b3090000 330a0000 ....3.......3...
8 0050 b30a0000 330b0000 b30b0000 330c0000 ....3.......3...
9 0060 b30c0000 330d0000 b30d0000 330e0000 ....3.......3...
10 0070 b30e0000 330f0000 b30f0000 ....3.......

BIN
test/test.elf Executable file

Binary file not shown.

32
test/test.hex Normal file
View File

@ -0,0 +1,32 @@
b3000000
33010000
b3010000
33020000
b3020000
33030000
b3030000
33040000
b3040000
33050000
b3050000
33060000
b3060000
33070000
b3070000
33080000
b3080000
33090000
b3090000
330a0000
b30a0000
330b0000
b30b0000
330c0000
b30c0000
330d0000
b30d0000
330e0000
b30e0000
330f0000
b30f0000

17
test/test.ld Normal file
View File

@ -0,0 +1,17 @@
ENTRY(_start)
MEMORY
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 1024
}
SECTIONS
{
.text :
{
_text = .;
*(.text*)
*(.rodata*)
_etext = .;
} > ROM
}