NJU-ProjectN/abstract-machine ics2023 initialized
NJU-ProjectN/abstract-machine 3348db971fd860be5cb28e21c18f9d0e65d0c96a Merge pull request #8 from Jasonyanyusong/master
This commit is contained in:
parent
2824efad33
commit
8e4feb4010
129 changed files with 9017 additions and 0 deletions
29
abstract-machine/scripts/platform/nemu.mk
Normal file
29
abstract-machine/scripts/platform/nemu.mk
Normal file
|
@ -0,0 +1,29 @@
|
|||
AM_SRCS := platform/nemu/trm.c \
|
||||
platform/nemu/ioe/ioe.c \
|
||||
platform/nemu/ioe/timer.c \
|
||||
platform/nemu/ioe/input.c \
|
||||
platform/nemu/ioe/gpu.c \
|
||||
platform/nemu/ioe/audio.c \
|
||||
platform/nemu/ioe/disk.c \
|
||||
platform/nemu/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
|
||||
NEMUFLAGS += -l $(shell dirname $(IMAGE).elf)/nemu-log.txt
|
||||
|
||||
CFLAGS += -DMAINARGS=\"$(mainargs)\"
|
||||
CFLAGS += -I$(AM_HOME)/am/src/platform/nemu/include
|
||||
.PHONY: $(AM_HOME)/am/src/platform/nemu/trm.c
|
||||
|
||||
image: $(IMAGE).elf
|
||||
@$(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: image
|
||||
$(MAKE) -C $(NEMU_HOME) ISA=$(ISA) run ARGS="$(NEMUFLAGS)" IMG=$(IMAGE).bin
|
||||
|
||||
gdb: image
|
||||
$(MAKE) -C $(NEMU_HOME) ISA=$(ISA) gdb ARGS="$(NEMUFLAGS)" IMG=$(IMAGE).bin
|
21
abstract-machine/scripts/platform/npc.mk
Normal file
21
abstract-machine/scripts/platform/npc.mk
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
CFLAGS += -DMAINARGS=\"$(mainargs)\"
|
||||
.PHONY: $(AM_HOME)/am/src/riscv/npc/trm.c
|
||||
|
||||
image: $(IMAGE).elf
|
||||
@$(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
|
17
abstract-machine/scripts/platform/qemu.mk
Normal file
17
abstract-machine/scripts/platform/qemu.mk
Normal file
|
@ -0,0 +1,17 @@
|
|||
.PHONY: build-arg
|
||||
|
||||
LDFLAGS += -N -Ttext-segment=0x00100000
|
||||
QEMU_FLAGS += -serial mon:stdio \
|
||||
-machine accel=tcg \
|
||||
-smp "$(smp)" \
|
||||
-drive format=raw,file=$(IMAGE)
|
||||
|
||||
build-arg: image
|
||||
@( echo -n $(mainargs); ) | dd if=/dev/stdin of=$(IMAGE) bs=512 count=2 seek=1 conv=notrunc status=none
|
||||
|
||||
BOOT_HOME := $(AM_HOME)/am/src/x86/qemu/boot
|
||||
|
||||
image: $(IMAGE).elf
|
||||
@$(MAKE) -s -C $(BOOT_HOME)
|
||||
@echo + CREATE "->" $(IMAGE_REL)
|
||||
@( cat $(BOOT_HOME)/bootblock.o; head -c 1024 /dev/zero; cat $(IMAGE).elf ) > $(IMAGE)
|
Loading…
Add table
Add a link
Reference in a new issue