38 lines
1.3 KiB
Makefile
38 lines
1.3 KiB
Makefile
TARGET_SIM ?= /home/marius/Work/RISC-V/RISC-V-TLM/RISCV_TLM
|
|
TARGET_FLAGS ?= $(RISCV_TARGET_FLAGS)
|
|
ifeq ($(shell command -v $(TARGET_SIM) 2> /dev/null),)
|
|
$(error Target simulator executable '$(TARGET_SIM)` not found)
|
|
endif
|
|
|
|
START_ADDRES := $(shell readelf -s $(<) | grep "begin_signature" | awk '{print "0x"$2 }')
|
|
END_ADDRES := $(shell readelf -s $(<) | grep "end_signature" | awk '{print "0x"$2 }')
|
|
|
|
RUN_TARGET=\
|
|
$(TARGET_SIM) $(TARGET_FLAGS) \
|
|
-B `readelf -s $(<) | grep "begin_signature" | awk '{print "0x"$$2 }'`\
|
|
-E `readelf -s $(<) | grep "end_signature" | awk '{print "0x"$$2 }'` -T \
|
|
$(<).hex ;\
|
|
mv *output $(work_dir_isa)/
|
|
|
|
RISCV_PREFIX ?= riscv32-unknown-elf-
|
|
RISCV_GCC ?= $(RISCV_PREFIX)gcc
|
|
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump
|
|
RISCV_GCC_OPTS ?= -g -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles $(RVTEST_DEFINES)
|
|
|
|
COMPILE_CMD = $$(RISCV_GCC) $(1) $$(RISCV_GCC_OPTS) \
|
|
-I$(ROOTDIR)/riscv-test-suite/env/ \
|
|
-I$(TARGETDIR)/$(RISCV_TARGET)/ \
|
|
-T$(TARGETDIR)/$(RISCV_TARGET)/link.ld \
|
|
$$(<) -o $$@
|
|
|
|
OBJ_CMD = $$(RISCV_OBJDUMP) $$@ -D > $$@.objdump; \
|
|
$$(RISCV_OBJDUMP) $$@ --source > $$@.debug
|
|
|
|
OBJ_HEX = riscv32-unknown-elf-objcopy -Oihex $$@ $$@.hex
|
|
|
|
COMPILE_TARGET=\
|
|
$(COMPILE_CMD); \
|
|
$(OBJ_CMD);\
|
|
$(OBJ_HEX)
|
|
|