diff --git a/Ubiquitous/XiUOS/kernel/kernel_test/Makefile b/Ubiquitous/XiUOS/kernel/kernel_test/Makefile index e1daf45c1..d8d58996c 100644 --- a/Ubiquitous/XiUOS/kernel/kernel_test/Makefile +++ b/Ubiquitous/XiUOS/kernel/kernel_test/Makefile @@ -1,4 +1,4 @@ -SRC_FILES := test_main.c +SRC_FILES := test_main.c test_fpu.c ifeq ($(CONFIG_KERNEL_TEST_SEM),y) SRC_FILES += test_sem.c diff --git a/Ubiquitous/XiUOS/kernel/kernel_test/test_fpu.c b/Ubiquitous/XiUOS/kernel/kernel_test/test_fpu.c new file mode 100644 index 000000000..fddb3de19 --- /dev/null +++ b/Ubiquitous/XiUOS/kernel/kernel_test/test_fpu.c @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2020 AIIT XUOS Lab +* XiUOS is licensed under Mulan PSL v2. +* You can use this software according to the terms and conditions of the Mulan PSL v2. +* You may obtain a copy of Mulan PSL v2 at: +* http://license.coscl.org.cn/MulanPSL2 +* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +* See the Mulan PSL v2 for more details. +*/ + +/** +* @file test_fpu.c +* @brief support to test touch function +* @version 1.0 +* @author AIIT XUOS Lab +* @date 2022-01-11 +*/ +#include +void FpuTest(void) +{ + float i = 8.25; + KPrintf("float i = 8.25 ['i %s 8' && 'i %s 9']\n",i > 8 ? ">" : "<",i < 9 ? "<" : ">"); + float add = i + 5.1; + KPrintf("float add(13.35) = i + 5.1 ['add %s 13' && 'add %s 14']\n",add > 13 ? ">" : "<",add < 14 ? "<" : ">"); + float sub = i - 5.1; + KPrintf("float sub(3.15) = i - 5.1 ['sub %s 3' && 'sub %s 4']\n",sub > 3 ? ">" : "<",sub < 4 ? "<" : ">"); + float mul = i * 5.1; + KPrintf("float mul(42.075) = i * 5.1 ['mul %s 42' && 'mul %s 43']\n",mul > 42 ? ">" : "<",mul < 43 ? "<" : ">"); + float div = i / 5.1; + KPrintf("float div(1.617) = i / 5.1 ['div %s 1' && 'div %s 2']\n",div > 1 ? ">" : "<",div < 2 ? "<" : ">"); +} + +SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0),FpuTest, FpuTest, Close AC task ); \ No newline at end of file