diff options
Diffstat (limited to 'arch/riscv/machine/Makefile')
| -rw-r--r-- | arch/riscv/machine/Makefile | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/riscv/machine/Makefile b/arch/riscv/machine/Makefile new file mode 100644 index 0000000..c6fe845 --- /dev/null +++ b/arch/riscv/machine/Makefile @@ -0,0 +1,33 @@ +NAME = machine + +CROSS_COMPILE ?= riscv64-suse-linux- +AS = $(CROSS_COMPILE)as +LD = $(CROSS_COMPILE)ld +ASFLAGS = -g -march=rv64g -mabi=lp64 +QEMU ?= qemu-system-riscv64 +QEMU_FLAGS ?= + +DEBUG = +ifneq ($(strip $(DEBUG)),) + QEMU_FLAGS += -s -S +endif + +## +# Targets + +.PHONY: run +run: clean build + @$(QEMU) $(QEMU_FLAGS) -machine virt -bios $(NAME) -nographic + +.PHONY: build +build: + @$(AS) $(ASFLAGS) -o $(NAME).o -c $(NAME).S + @$(LD) -T config.ld $(NAME).o -o $(NAME) + +.PHONY: clean +clean: + @rm -f $(NAME).o $(NAME) + +.PHONY: gdb +gdb: + $(Q) gdb --command gdb.txt |
