aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/machine/Makefile
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-09-03 11:53:15 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-05 16:02:49 +0100
commit4f69fb67ee229c7b59ced5db64142b527d74ce7b (patch)
treed9aab519f0caa6086368c297d9849bbf7e4589b0 /arch/riscv/machine/Makefile
parente94cc18273810ce9cc44d80608042c16eae4e6e4 (diff)
downloadfarga-4f69fb67ee229c7b59ced5db64142b527d74ce7b.tar.gz
farga-4f69fb67ee229c7b59ced5db64142b527d74ce7b.zip
Provide an improved example on early boot stage
This also implied a renaming arch/riscv/bios -> arch/riscv/machine. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'arch/riscv/machine/Makefile')
-rw-r--r--arch/riscv/machine/Makefile33
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