mirror of
https://github.com/olofk/serv.git
synced 2026-02-22 22:57:12 +00:00
26 lines
1010 B
Makefile
26 lines
1010 B
Makefile
TARGET_SIM ?= server
|
|
ifeq ($(shell command -v $(TARGET_SIM) 2> /dev/null),)
|
|
$(error Target simulator executable '$(TARGET_SIM)` not found)
|
|
endif
|
|
|
|
RUN_TARGET=\
|
|
$(TARGET_SIM) \
|
|
+signature=$(work_dir_isa)/$(*).signature.output \
|
|
+firmware=$(work_dir_isa)/$<.hex 2> $(work_dir_isa)/$@
|
|
|
|
RISCV_PREFIX ?= riscv32-unknown-elf-
|
|
RISCV_GCC ?= $(RISCV_PREFIX)gcc
|
|
RISCV_OBJCOPY ?= $(RISCV_PREFIX)objcopy
|
|
RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump
|
|
RISCV_GCC_OPTS ?= -static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles
|
|
|
|
COMPILE_TARGET=\
|
|
$$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) \
|
|
-I$(ROOTDIR)/riscv-test-env/ \
|
|
-I$(TARGETDIR)/$(RISCV_TARGET)/ \
|
|
-T$(TARGETDIR)/$(RISCV_TARGET)/link.ld $$< \
|
|
-o $(work_dir_isa)/$$@; \
|
|
$$(RISCV_OBJCOPY) -O binary $(work_dir_isa)/$$@ $(work_dir_isa)/$$@.bin; \
|
|
$$(RISCV_OBJDUMP) -D $(work_dir_isa)/$$@ > $(work_dir_isa)/$$@.objdump; \
|
|
python3 $(TARGETDIR)/$(RISCV_TARGET)/makehex.py $(work_dir_isa)/$$@.bin 2048 > $(work_dir_isa)/$$@.hex;
|