summaryrefslogtreecommitdiffhomepage
path: root/src/rv64
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-02 15:35:19 +0200
committerGitHub <noreply@github.com>2025-04-02 15:35:19 +0200
commitab54bcd5bee32eeb5e182ffff4e8bb187e875aa0 (patch)
treee7505b27850201450eb3528006c440638f1241ce /src/rv64
parentf42ce43556475acb576fa926f685128d1dccf64b (diff)
parenta113f91c6be56c3f39fc7680ec7f5c814d4d2c27 (diff)
Merge pull request #2 from amlel-el-mahrouss/dev
add: rv64 CI, and copyright updates.
Diffstat (limited to 'src/rv64')
-rw-r--r--src/rv64/ci.make53
-rw-r--r--src/rv64/makefile4
-rw-r--r--src/rv64/script.lds (renamed from src/rv64/linkscript.ld)0
3 files changed, 55 insertions, 2 deletions
diff --git a/src/rv64/ci.make b/src/rv64/ci.make
new file mode 100644
index 0000000..757d6c1
--- /dev/null
+++ b/src/rv64/ci.make
@@ -0,0 +1,53 @@
+ #
+ # ========================================================
+ #
+ # CoreBoot
+ # Date Added: 08/11/2023
+ # Copyright 2024, Amlal El Mahrouss, all rights reserved.
+ #
+ # ========================================================
+ #
+
+CC=riscv64-unknown-elf-gcc
+FIRMWARE=core-boot.elf
+FLAGS=-D__COMPILE_RISCV__ -I../../ -Wall -c -nostdlib -ffreestanding -fno-builtin -D__BSTRICT__ -D__BDEBUG__ -O0 -mcmodel=medany
+C_SRC= $(wildcard *.s) $(wildcard *.c) $(wildcard ../*.c) -c
+
+CXX=riscv64-unknown-elf-g++
+CXX_SRC= $(wildcard *.cc) $(wildcard ../*.cc) -c
+
+LD=riscv64-unknown-elf-ld
+OBJ=*.o
+FLAGS_LD= --script=script.lds -o core-boot.elf
+
+EMU=qemu-system-riscv64 -m 4G -smp 2 -machine virt -bios $(FIRMWARE) -d int -device VGA
+
+.PHONY: all
+all: firmware-link
+ @echo "[CoreBoot] Done."
+
+# link (make firmware)
+.PHONY: firmware-link
+firmware-link: firmware-compile
+ $(LD) $(OBJ) $(FLAGS_LD)
+
+# compile firmware
+.PHONY: firmware-compile
+firmware-compile:
+ $(CC) $(FLAGS) $(C_SRC)
+ $(CXX) -ffreestanding -fno-rtti -fno-exceptions $(FLAGS) $(CXX_SRC)
+
+# launch qemu rule
+.PHONY: run
+run:
+ $(EMU)
+
+# launch qemu with attached debugger
+.PHONY: run-dbg
+run-dbg:
+ $(EMU) -S
+
+# remove object files
+.PHONY: clean
+clean:
+ rm -f $(wildcard *.o) $(wildcard *.elf) $(wildcard *.rom) $(wildcard *.epm)
diff --git a/src/rv64/makefile b/src/rv64/makefile
index 0bd8a28..757d6c1 100644
--- a/src/rv64/makefile
+++ b/src/rv64/makefile
@@ -3,7 +3,7 @@
#
# CoreBoot
# Date Added: 08/11/2023
- # Copyright 2024, ZKA Technologies, all rights reserved.
+ # Copyright 2024, Amlal El Mahrouss, all rights reserved.
#
# ========================================================
#
@@ -18,7 +18,7 @@ CXX_SRC= $(wildcard *.cc) $(wildcard ../*.cc) -c
LD=riscv64-unknown-elf-ld
OBJ=*.o
-FLAGS_LD= --script=linkscript.ld -o core-boot.elf
+FLAGS_LD= --script=script.lds -o core-boot.elf
EMU=qemu-system-riscv64 -m 4G -smp 2 -machine virt -bios $(FIRMWARE) -d int -device VGA
diff --git a/src/rv64/linkscript.ld b/src/rv64/script.lds
index ca4e8dc..ca4e8dc 100644
--- a/src/rv64/linkscript.ld
+++ b/src/rv64/script.lds