fixed setting in riscv-pk to enable rv32ia, added smp option in Makefile

master
maoyuchaxue 6 years ago
parent 528c919626
commit 6cf0d6db23

@ -12,11 +12,13 @@
# d = int | in_asm | ... QEMU debug info
# mode = debug | release
# LOG = off | error | warn | info | debug | trace
# smp SMP core number
# board Only available on riscv32, build without bbl, run on board
arch ?= riscv32
mode ?= debug
LOG ?= debug
smp ?= 1
target := $(arch)-blog_os
kernel := target/$(target)/$(mode)/ucore
@ -31,12 +33,12 @@ ifeq ($(arch), x86_64)
qemu_opts := \
-drive format=raw,file=$(bootimage) \
-drive format=raw,file=$(SFSIMG),media=disk,cache=writeback \
-smp 4 \
-smp $(smp) \
-serial mon:stdio \
-device isa-debug-exit
endif
ifeq ($(arch), riscv32)
qemu_opts := -machine virt -kernel $(bin) -nographic
qemu_opts := -machine virt -kernel $(bin) -nographic -smp cpus=$(smp)
endif
ifdef board
@ -69,7 +71,7 @@ ifeq ($(uname), Darwin)
prefix := x86_64-elf-
endif
ifeq ($(arch), riscv32)
prefix := riscv64-unknown-elf-
prefix := riscv32-unknown-elf-
endif
ld := $(prefix)ld
@ -118,7 +120,7 @@ else
--enable-32bit \
--enable-logo \
--disable-fp-emulation \
--host=riscv64-unknown-elf \
--host=riscv32-unknown-elf \
--with-payload=$(abspath $(kernel)) && \
make && \
cp bbl ../../kernel/$@

@ -1,14 +1,19 @@
.section .text.entry
.globl _start
_start:
lui sp, %hi(bootstacktop)
addi sp, sp, %lo(bootstacktop)
add t0, a0, 1
slli t0, t0, 16
lui sp, %hi(bootstack)
addi sp, sp, %lo(bootstack)
add sp, sp, t0
call rust_main
.section .bss
.align 12 #PGSHIFT
.global bootstack
bootstack:
.space 4096 * 16 #KSTACKSIZE
.space 4096 * 16 * 8
.global bootstacktop
bootstacktop:

@ -7,10 +7,11 @@ pub mod timer;
pub mod paging;
pub mod memory;
pub mod compiler_rt;
pub mod smp;
#[no_mangle]
pub extern fn rust_main() -> ! {
println!("Hello RISCV! {}", 123);
pub extern fn rust_main(hartid: usize) -> ! {
println!("Hello RISCV! {}", hartid);
::logging::init();
interrupt::init();
memory::init();

@ -4084,8 +4084,8 @@ fi
case "${BUILD_32BIT}" in
yes|default)
echo "Building 32-bit pk"
CFLAGS="$default_CFLAGS -march=rv32i -mabi=ilp32"
LDFLAGS="-march=rv32i -mabi=ilp32"
CFLAGS="$default_CFLAGS -march=rv32ia -mabi=ilp32"
LDFLAGS="-march=rv32ia -mabi=ilp32"
install_subdir="riscv32-unknown-elf"
;;
*)

@ -88,8 +88,8 @@ AC_ARG_ENABLE([32bit],
case "${BUILD_32BIT}" in
yes|default)
echo "Building 32-bit pk"
CFLAGS="$default_CFLAGS -march=rv32i -mabi=ilp32"
LDFLAGS="-march=rv32i -mabi=ilp32"
CFLAGS="$default_CFLAGS -march=rv32ia -mabi=ilp32"
LDFLAGS="-march=rv32ia -mabi=ilp32"
install_subdir="riscv32-unknown-elf"
;;
*)

Loading…
Cancel
Save