31 lines
1.1 KiB
Makefile
31 lines
1.1 KiB
Makefile
AM_SRCS := riscv/npc/start.S \
|
|
riscv/npc/trm.c \
|
|
riscv/npc/ioe.c \
|
|
riscv/npc/timer.c \
|
|
riscv/npc/input.c \
|
|
riscv/npc/cte.c \
|
|
riscv/npc/trap.S \
|
|
platform/dummy/vme.c \
|
|
platform/dummy/mpe.c
|
|
|
|
CFLAGS += -fdata-sections -ffunction-sections
|
|
LDFLAGS += -T $(AM_HOME)/scripts/linker.ld \
|
|
--defsym=_pmem_start=0x80000000 --defsym=_entry_offset=0x0
|
|
LDFLAGS += --gc-sections -e _start
|
|
|
|
MAINARGS_MAX_LEN = 64
|
|
MAINARGS_PLACEHOLDER = The insert-arg rule in Makefile will insert mainargs here.
|
|
CFLAGS += -DMAINARGS_MAX_LEN=$(MAINARGS_MAX_LEN) -DMAINARGS_PLACEHOLDER=\""$(MAINARGS_PLACEHOLDER)"\"
|
|
|
|
insert-arg: image
|
|
@python $(AM_HOME)/tools/insert-arg.py $(IMAGE).bin $(MAINARGS_MAX_LEN) "$(MAINARGS_PLACEHOLDER)" "$(mainargs)"
|
|
|
|
image: image-dep
|
|
@$(OBJDUMP) -d $(IMAGE).elf > $(IMAGE).txt
|
|
@echo + OBJCOPY "->" $(IMAGE_REL).bin
|
|
@$(OBJCOPY) -S --set-section-flags .bss=alloc,contents -O binary $(IMAGE).elf $(IMAGE).bin
|
|
|
|
run: insert-arg
|
|
echo "TODO: add command here to run simulation"
|
|
|
|
.PHONY: insert-arg
|