mirror of
https://github.com/olofk/serv.git
synced 2026-01-13 15:17:25 +00:00
27 lines
886 B
Makefile
27 lines
886 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) \
|
|
+timeout=100000000000 \
|
|
+signature=$(*).signature.output \
|
|
+firmware=$(<).hex 2> $@
|
|
|
|
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) $(1) $$(RISCV_GCC_OPTS) \
|
|
-I$(ROOTDIR)/riscv-test-env/ \
|
|
-I$(TARGETDIR)/$(RISCV_TARGET)/ \
|
|
-T$(TARGETDIR)/$(RISCV_TARGET)/link.ld $$< \
|
|
-o $$@; \
|
|
$$(RISCV_OBJCOPY) -O binary $$@ $$@.bin; \
|
|
$$(RISCV_OBJDUMP) -D $$@ > $$@.objdump; \
|
|
python3 $(TARGETDIR)/$(RISCV_TARGET)/makehex.py $$@.bin 524288 > $$@.hex;
|