diff --git a/common/inc/plat/config.h b/common/inc/plat/config.h index 95756917..9664fad6 100644 --- a/common/inc/plat/config.h +++ b/common/inc/plat/config.h @@ -1,6 +1,6 @@ #pragma once -#if defined(PLATFORM_qemu_virt) +#if defined(PLATFORM_qemu_virt) || defined(PLATFORM_qemu_virt4) #include "plat/qemu_virt.h" #elif defined(PLATFORM_sifive_unleashed) #include "plat/sifive_unleashed.h" diff --git a/common/plat/qemu_virt.mk b/common/plat/qemu_virt.mk index 8325ff1f..13d7d947 100644 --- a/common/plat/qemu_virt.mk +++ b/common/plat/qemu_virt.mk @@ -2,7 +2,8 @@ export ARCH=rv64imac_zicsr export ABI=lp64 export CMODEL=medany export QEMU_MACHINE=virt -export QEMU_SMP=4 +export QEMU_SMP=1 +export QEMU_OPTIONS=-icount 3 export COMMON_INC:=${ROOT}/common/inc export COMMON_LIB:=${ROOT}/common/build/${PLATFORM} export STARTFILES:=${ROOT}/common/build/${PLATFORM}/start diff --git a/common/plat/qemu_virt4.mk b/common/plat/qemu_virt4.mk new file mode 100644 index 00000000..8325ff1f --- /dev/null +++ b/common/plat/qemu_virt4.mk @@ -0,0 +1,9 @@ +export ARCH=rv64imac_zicsr +export ABI=lp64 +export CMODEL=medany +export QEMU_MACHINE=virt +export QEMU_SMP=4 +export COMMON_INC:=${ROOT}/common/inc +export COMMON_LIB:=${ROOT}/common/build/${PLATFORM} +export STARTFILES:=${ROOT}/common/build/${PLATFORM}/start +PLAT_SRCS=src/drivers/uart/ns16550a.c src/drivers/time.c diff --git a/projects/ping-pong/app0/main.c b/projects/ping-pong/app0/main.c index 36b69e48..dbeb4821 100644 --- a/projects/ping-pong/app0/main.c +++ b/projects/ping-pong/app0/main.c @@ -89,7 +89,7 @@ int main(void) s3k_msg_t msg; s3k_reply_t reply; memcpy(msg.data, "pong", 5); - s3k_reg_write(S3K_REG_SERVTIME, 4500); + s3k_reg_write(S3K_REG_SERVTIME, 100); while (1) { do { reply = s3k_sock_sendrecv(11, &msg); diff --git a/projects/ping-pong/scripts/gdb.sh b/projects/ping-pong/scripts/gdb.sh deleted file mode 100755 index 11faf60b..00000000 --- a/projects/ping-pong/scripts/gdb.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -KERNEL=build/s3k -APP0=build/app0 -APP1=build/app1 - -if [[ -z "$TMUX" ]]; then - echo "No tmux session" - exit 0 -fi - -tmux split-window -d "./scripts/qemu.sh -s -S" -sleep 0.5 - -riscv64-unknown-elf-gdb \ - -ex "set confirm off" \ - -ex "set pagination off" \ - -ex "set output-radix 16" \ - -ex "symbol-file $KERNEL.elf" \ - -ex "add-symbol-file $APP0.elf" \ - -ex "add-symbol-file $APP1.elf" \ - -ex "j 0x80000000" \ - -ex "b _hang" \ - -ex "b *0x80010000" \ - -ex "b *0x80020000" \ - -ex "b handle_exception" \ - -ex "target remote localhost:1234" \ - -ex "layout split" \ - -ex "fs cmd" - -kill -SIGTERM $(pgrep qemu-system-*) diff --git a/projects/ping-pong/scripts/qemu.sh b/projects/ping-pong/scripts/qemu.sh deleted file mode 100755 index 38c08122..00000000 --- a/projects/ping-pong/scripts/qemu.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -KERNEL=build/s3k -APP0=build/app0 -APP1=build/app1 - -qemu-system-riscv64 -M virt -smp 4 -m 128M \ - -nographic -bios none -kernel $KERNEL.elf \ - -device loader,file=$APP0.bin,addr=0x80010000 \ - -device loader,file=$APP1.bin,addr=0x80020000 \ - $@ diff --git a/scripts/qemu.sh b/scripts/qemu.sh index dcb7961b..9a23b3a6 100755 --- a/scripts/qemu.sh +++ b/scripts/qemu.sh @@ -15,4 +15,4 @@ if [[ -z "$QEMU_SMP" ]]; then fi qemu-system-riscv64 -M $QEMU_MACHINE -smp $QEMU_SMP -m 128M -nographic -bios none \ - $LOADER $@ + $LOADER $QEMU_OPTIONS $@