From 4f69fb67ee229c7b59ced5db64142b527d74ce7b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 3 Sep 2024 11:53:15 +0200 Subject: Provide an improved example on early boot stage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also implied a renaming arch/riscv/bios -> arch/riscv/machine. Signed-off-by: Miquel Sabaté Solà --- arch/riscv/machine/Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 arch/riscv/machine/Makefile (limited to 'arch/riscv/machine/Makefile') 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 -- cgit v1.2.3