separate .text and .data for instruction and data memory

This commit is contained in:
2020-11-10 00:19:42 -07:00
parent 32d0a2dcaa
commit caf9a6f4f7
4 changed files with 74 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
all: test.hex
all: text.hex data.hex
CC = riscv64-linux-gnu-gcc
# CFLAGS = -march=rv32i -mabi=ilp32
@@ -19,5 +19,11 @@ LDFLAGS = -T test.ld
%.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' | sed 's/^\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/' > $@
text.hex: test.elf
riscv64-linux-gnu-objdump -s $^ | sed -n '/.text/,$$p' | tail -n+2 | sed -n '/.data/,$$!p' | cut -f3-6 -d ' ' | sed -e 's/ /\n/g' | sed 's/^\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/' > $@
data.hex: test.elf
riscv64-linux-gnu-objdump -s $^ | sed -n '/.data/,$$p' | tail -n+2 | sed -n '/.bss/,$$!p' | cut -f3-6 -d ' ' | sed -e 's/ /\n/g' | sed 's/^\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/' > $@
clean:
rm test.elf text.hex data.hex