diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/knsh32/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/knsh32/defconfig index b18154e5b8..8e088fe67c 100644 --- a/boards/risc-v/qemu-rv/rv-virt/configs/knsh32/defconfig +++ b/boards/risc-v/qemu-rv/rv-virt/configs/knsh32/defconfig @@ -42,6 +42,7 @@ CONFIG_ARCH_USE_MMU=y CONFIG_ARCH_USE_MPU=y CONFIG_ARCH_USE_S_MODE=y CONFIG_BINFMT_ELF_EXECUTABLE=y +CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=6366 CONFIG_BUILD_KERNEL=y CONFIG_DEBUG_ASSERTIONS=y diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig index 5b4f6aca9a..fca3035cc7 100644 --- a/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig +++ b/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig @@ -42,6 +42,7 @@ CONFIG_ARCH_USE_MMU=y CONFIG_ARCH_USE_MPU=y CONFIG_ARCH_USE_S_MODE=y CONFIG_BINFMT_ELF_EXECUTABLE=y +CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=6366 CONFIG_BUILD_KERNEL=y CONFIG_DEBUG_ASSERTIONS=y @@ -62,7 +63,6 @@ CONFIG_INIT_MOUNT_FSTYPE="hostfs" CONFIG_INIT_MOUNT_SOURCE="" CONFIG_INIT_MOUNT_TARGET="/system" CONFIG_INIT_STACKSIZE=3072 -CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_ENVPATH=y CONFIG_LIBC_EXECFUNCS=y CONFIG_LIBC_PERROR_STDOUT=y diff --git a/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c b/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c index 357ecba97a..aa38aedd32 100644 --- a/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c +++ b/boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_appinit.c @@ -36,6 +36,7 @@ #include +#include "riscv_internal.h" #include "romfs.h" /**************************************************************************** @@ -177,3 +178,17 @@ void board_late_initialize(void) #endif } + +#ifdef CONFIG_BOARDCTL_POWEROFF +int board_power_off(int status) +{ +#ifdef CONFIG_BUILD_KERNEL + riscv_sbi_system_reset(SBI_SRST_TYPE_SHUTDOWN, SBI_SRST_REASON_NONE); +#else + #warning "to be done" +#endif + + UNUSED(status); + return 0; +} +#endif