mirror of
https://github.com/apache/nuttx.git
synced 2026-08-20 13:08:26 +00:00
boards/rv-virt: Supports FPU test and ostest in both rv32/rv64
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
c1ea37742b
commit
f40a673fdf
4 changed files with 167 additions and 2 deletions
|
|
@ -66,4 +66,6 @@ CONFIG_STACK_COLORATION=y
|
|||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2021
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_FPUSIZE=528
|
||||
CONFIG_USEC_PER_TICK=1000
|
||||
|
|
|
|||
71
boards/risc-v/qemu-rv/rv-virt/configs/nsh64/defconfig
Normal file
71
boards/risc-v/qemu-rv/rv-virt/configs/nsh64/defconfig
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_DISABLE_OS_API is not set
|
||||
# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set
|
||||
# CONFIG_NSH_DISABLEBG is not set
|
||||
# CONFIG_NSH_DISABLE_CAT is not set
|
||||
# CONFIG_NSH_DISABLE_CD is not set
|
||||
# CONFIG_NSH_DISABLE_FREE is not set
|
||||
# CONFIG_NSH_DISABLE_HELP is not set
|
||||
# CONFIG_NSH_DISABLE_LOSMART is not set
|
||||
# CONFIG_NSH_DISABLE_LS is not set
|
||||
# CONFIG_NSH_DISABLE_MOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_NSH_DISABLE_PSSTACKUSAGE is not set
|
||||
# CONFIG_NSH_DISABLE_UNAME is not set
|
||||
CONFIG_16550_ADDRWIDTH=0
|
||||
CONFIG_16550_UART0=y
|
||||
CONFIG_16550_UART0_BASE=0x10000000
|
||||
CONFIG_16550_UART0_CLOCK=3686400
|
||||
CONFIG_16550_UART0_IRQ=37
|
||||
CONFIG_16550_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_16550_UART=y
|
||||
CONFIG_ARCH="risc-v"
|
||||
CONFIG_ARCH_BOARD="rv-virt"
|
||||
CONFIG_ARCH_BOARD_QEMU_RV_VIRT=y
|
||||
CONFIG_ARCH_CHIP="qemu-rv"
|
||||
CONFIG_ARCH_CHIP_QEMU_RV64=y
|
||||
CONFIG_ARCH_CHIP_QEMU_RV=y
|
||||
CONFIG_ARCH_CHIP_QEMU_RV_ISA_A=y
|
||||
CONFIG_ARCH_CHIP_QEMU_RV_ISA_C=y
|
||||
CONFIG_ARCH_CHIP_QEMU_RV_ISA_M=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BINFMT_DISABLE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=6366
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CLOCK_MONOTONIC=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=64
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RAM_SIZE=33554432
|
||||
CONFIG_RAM_START=0x80000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SERIAL_UART_ARCH_MMIO=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_MONTH=12
|
||||
CONFIG_START_YEAR=2021
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_FPUSIZE=264
|
||||
CONFIG_USEC_PER_TICK=1000
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
############################################################################
|
||||
# boards/risc-v/rv32m1/rv32m1-vega/src/Makefile
|
||||
# boards/risc-v/qemu-rv/rv-virt/src/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
|
|
@ -22,6 +22,6 @@ include $(TOPDIR)/Make.defs
|
|||
|
||||
RCSRCS = etc/init.d/rcS
|
||||
|
||||
CSRCS = qemu_rv_appinit.c
|
||||
CSRCS = qemu_rv_appinit.c qemu_rv_ostest.c
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
|
|
|
|||
92
boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_ostest.c
Normal file
92
boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_ostest.c
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/****************************************************************************
|
||||
* boards/risc-v/qemu-rv/rv-virt/src/qemu_rv_ostest.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <syscall.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#undef HAVE_FPU
|
||||
#if defined(CONFIG_ARCH_FPU) && \
|
||||
!defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \
|
||||
defined(CONFIG_TESTING_OSTEST_FPUSIZE) && \
|
||||
defined(CONFIG_SCHED_WAITPID)
|
||||
# define HAVE_FPU 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FPU
|
||||
|
||||
#if CONFIG_TESTING_OSTEST_FPUSIZE != (8 * FPU_XCPT_REGS)
|
||||
# error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static uintptr_t g_saveregs[XCPTCONTEXT_REGS];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will
|
||||
* return the current FPU registers.
|
||||
*/
|
||||
|
||||
void arch_getfpu(FAR uint32_t *fpusave)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Take a snapshot of the thread context right now */
|
||||
|
||||
flags = enter_critical_section();
|
||||
riscv_saveusercontext(g_saveregs);
|
||||
|
||||
/* Return only the floating register values */
|
||||
|
||||
memcpy(fpusave, &g_saveregs[INT_XCPT_REGS], INT_REG_SIZE * FPU_XCPT_REGS);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/* Given two arrays of size CONFIG_TESTING_OSTEST_FPUSIZE this function
|
||||
* will compare them and return true if they are identical.
|
||||
*/
|
||||
|
||||
bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
|
||||
{
|
||||
return memcmp(fpusave1, fpusave2, INT_REG_SIZE * FPU_XCPT_REGS) == 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_FPU */
|
||||
Loading…
Add table
Add a link
Reference in a new issue