2020 release

This commit is contained in:
Yanyan Jiang 2020-08-11 22:03:04 +08:00 committed by Zihao Yu
commit 61348e8b07
86 changed files with 5127 additions and 0 deletions

5
scripts/isa/mips32.mk Normal file
View file

@ -0,0 +1,5 @@
CROSS_COMPILE := mips-linux-gnu-
COMMON_FLAGS := -march=mips32 -fno-pic -fno-delayed-branch -mno-abicalls -mno-check-zero-division -EL
CFLAGS += $(COMMON_FLAGS) -static -mno-llsc -mno-imadd -mno-mad
ASFLAGS += $(COMMON_FLAGS) -O0
LDFLAGS += -EL

5
scripts/isa/riscv32.mk Normal file
View file

@ -0,0 +1,5 @@
CROSS_COMPILE := riscv64-linux-gnu-
COMMON_FLAGS := -fno-pic -march=rv32im -mabi=ilp32
CFLAGS += $(COMMON_FLAGS) -static
ASFLAGS += $(COMMON_FLAGS) -O0
LDFLAGS += -melf32lriscv

3
scripts/isa/x86.mk Normal file
View file

@ -0,0 +1,3 @@
CFLAGS += -m32 -fno-pic -fno-omit-frame-pointer -march=i386
ASFLAGS += -m32 -fno-pic
LDFLAGS += -melf_i386

3
scripts/isa/x86_64.mk Normal file
View file

@ -0,0 +1,3 @@
CFLAGS += -m64 -fPIC -mno-sse
ASFLAGS += -m64 -fPIC
LDFLAGS += -melf_x86_64

2
scripts/mips32-nemu.mk Normal file
View file

@ -0,0 +1,2 @@
include $(AM_HOME)/scripts/isa/mips32.mk
include $(AM_HOME)/scripts/platform/nemu.mk

24
scripts/native.mk Normal file
View file

@ -0,0 +1,24 @@
AM_SRCS := native/trm.c \
native/ioe.c \
native/cte.c \
native/trap.S \
native/vme.c \
native/mpe.c \
native/platform.c \
native/native-input.c \
native/native-timer.c \
native/native-gpu.c \
native/native-audio.c \
CFLAGS += -fpie
ASFLAGS += -fpie -pie
image:
@echo + LD "->" $(IMAGE_REL)
@g++ -pie -o $(IMAGE) -Wl,--whole-archive $(LINKAGE) -Wl,-no-whole-archive -lSDL2
run: image
$(IMAGE)
gdb: image
gdb -ex "handle SIGUSR1 SIGSEGV noprint nostop" $(IMAGE)

31
scripts/platform/nemu.mk Normal file
View file

@ -0,0 +1,31 @@
AM_SRCS := nemu/trm.c \
nemu/ioe/ioe.c \
nemu/ioe/timer.c \
nemu/ioe/input.c \
nemu/ioe/gpu.c \
nemu/ioe/audio.c \
nemu/isa/$(ISA)/cte.c \
nemu/isa/$(ISA)/trap.S \
nemu/isa/$(ISA)/vme.c \
nemu/mpe.c \
nemu/isa/$(ISA)/boot/start.S
LDFLAGS += -L $(AM_HOME)/am/src/nemu/scripts
LDFLAGS += -T $(AM_HOME)/am/src/nemu/isa/$(ISA)/boot/loader.ld
LDFLAGS += --gc-sections -e _start
NEMUFLAGS += -b -l $(shell dirname $(IMAGE).elf)/nemu-log.txt $(IMAGE).bin
CFLAGS += -DMAINARGS=\"$(mainargs)\"
CFLAGS += -I$(AM_HOME)/am/src/nemu/include
.PHONY: $(AM_HOME)/am/src/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)"
gdb: image
$(MAKE) -C $(NEMU_HOME) ISA=$(ISA) gdb ARGS="$(NEMUFLAGS)"

17
scripts/platform/qemu.mk Normal file
View 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)

2
scripts/riscv32-nemu.mk Normal file
View file

@ -0,0 +1,2 @@
include $(AM_HOME)/scripts/isa/riscv32.mk
include $(AM_HOME)/scripts/platform/nemu.mk

3
scripts/x86-nemu.mk Normal file
View file

@ -0,0 +1,3 @@
include $(AM_HOME)/scripts/isa/x86.mk
CFLAGS += -mstringop-strategy=loop
include $(AM_HOME)/scripts/platform/nemu.mk

13
scripts/x86-qemu.mk Normal file
View file

@ -0,0 +1,13 @@
include $(AM_HOME)/scripts/isa/x86.mk
include $(AM_HOME)/scripts/platform/qemu.mk
AM_SRCS := x86/qemu/start32.S \
x86/qemu/trap32.S \
x86/qemu/trm.c \
x86/qemu/cte.c \
x86/qemu/ioe.c \
x86/qemu/vme.c \
x86/qemu/mpe.c
run: build-arg
@qemu-system-i386 $(QEMU_FLAGS)

13
scripts/x86_64-qemu.mk Normal file
View file

@ -0,0 +1,13 @@
include $(AM_HOME)/scripts/isa/x86_64.mk
include $(AM_HOME)/scripts/platform/qemu.mk
AM_SRCS := x86/qemu/start64.S \
x86/qemu/trap64.S \
x86/qemu/trm.c \
x86/qemu/cte.c \
x86/qemu/ioe.c \
x86/qemu/vme.c \
x86/qemu/mpe.c
run: build-arg
@qemu-system-x86_64 $(QEMU_FLAGS)