From b884315aa529f5993f8aa12d44d601fdf4a4fac3 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 2 Apr 2025 15:27:19 +0200 Subject: add: rv64 CI, and copyright updates. Signed-off-by: Amlal El Mahrouss --- src/arm64/ci.make | 2 +- src/arm64/makefile | 2 +- src/ppc64/makefile | 2 +- src/rv64/ci.make | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/rv64/linkscript.ld | 46 ------------------------------------------- src/rv64/makefile | 4 ++-- src/rv64/script.lds | 46 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 104 insertions(+), 51 deletions(-) create mode 100644 src/rv64/ci.make delete mode 100644 src/rv64/linkscript.ld create mode 100644 src/rv64/script.lds (limited to 'src') diff --git a/src/arm64/ci.make b/src/arm64/ci.make index 169d7f7..07f1746 100644 --- a/src/arm64/ci.make +++ b/src/arm64/ci.make @@ -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. # # ======================================================== # diff --git a/src/arm64/makefile b/src/arm64/makefile index 7aa0ae4..8d05e8b 100644 --- a/src/arm64/makefile +++ b/src/arm64/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. # # ======================================================== # diff --git a/src/ppc64/makefile b/src/ppc64/makefile index 03d524f..8adb03f 100644 --- a/src/ppc64/makefile +++ b/src/ppc64/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. # # ======================================================== # 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/linkscript.ld b/src/rv64/linkscript.ld deleted file mode 100644 index ca4e8dc..0000000 --- a/src/rv64/linkscript.ld +++ /dev/null @@ -1,46 +0,0 @@ -ENTRY(cb_reset_vector); - -. = 0x80000000; - -SECTIONS { - .text : ALIGN(4K) { - PROVIDE(_text_start = .); - - *(.init); - *(.text); - - PROVIDE(_text_end = .); - } - - PROVIDE(cb_global_pointer = .); - - .bss : ALIGN(4K) { - PROVIDE(_bss_start = .); - - *(.bss); - - PROVIDE(_bss_end = .); - } - - .rodata : ALIGN(4K) { - PROVIDE(_rodata_start = .); - - *(.rodata); - - PROVIDE(_rodata_end = .); - } - - - .data : ALIGN(4K) { - PROVIDE(_data_start = .); - - *(.data); - - PROVIDE(_data_end = .); - } - - PROVIDE(cb_stack_end = . + 0x1000); - - PROVIDE(cb_memory_end = .); - PROVIDE(cb_boot_processor_ready = . + 0x4); -} 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/script.lds b/src/rv64/script.lds new file mode 100644 index 0000000..ca4e8dc --- /dev/null +++ b/src/rv64/script.lds @@ -0,0 +1,46 @@ +ENTRY(cb_reset_vector); + +. = 0x80000000; + +SECTIONS { + .text : ALIGN(4K) { + PROVIDE(_text_start = .); + + *(.init); + *(.text); + + PROVIDE(_text_end = .); + } + + PROVIDE(cb_global_pointer = .); + + .bss : ALIGN(4K) { + PROVIDE(_bss_start = .); + + *(.bss); + + PROVIDE(_bss_end = .); + } + + .rodata : ALIGN(4K) { + PROVIDE(_rodata_start = .); + + *(.rodata); + + PROVIDE(_rodata_end = .); + } + + + .data : ALIGN(4K) { + PROVIDE(_data_start = .); + + *(.data); + + PROVIDE(_data_end = .); + } + + PROVIDE(cb_stack_end = . + 0x1000); + + PROVIDE(cb_memory_end = .); + PROVIDE(cb_boot_processor_ready = . + 0x4); +} -- cgit v1.2.3