summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author勤为本 <[email protected]>2017-09-13 15:21:09 +0800
committer勤为本 <[email protected]>2017-09-13 15:21:09 +0800
commit574e22bdbd1a2d907016c953b230782215190a1a (patch)
tree242edebaf1616925d42618aec135c62556ce84df
parent8d908671821bad9136be1bc5cbc3c5dbd966541c (diff)
在配置文件“rtconfig.h”中增加硬浮点FPU的配置项,
浮点经常会用到,所以默认使用硬浮点。
-rw-r--r--bsp/ls1cdev/drivers/board.c2
-rw-r--r--bsp/ls1cdev/rtconfig.h2
-rw-r--r--libcpu/mips/loongson_1c/stackframe_fpu.h4
3 files changed, 8 insertions, 0 deletions
diff --git a/bsp/ls1cdev/drivers/board.c b/bsp/ls1cdev/drivers/board.c
index 29d7fa7142..cb5fbdae09 100644
--- a/bsp/ls1cdev/drivers/board.c
+++ b/bsp/ls1cdev/drivers/board.c
@@ -94,8 +94,10 @@ void rt_hw_board_init(void)
/* init operating system timer */
rt_hw_timer_init();
+#ifdef RT_USING_FPU
/* init hardware fpu */
rt_hw_fpu_init();
+#endif
rt_kprintf("current sr: 0x%08x\n", read_c0_status());
}
diff --git a/bsp/ls1cdev/rtconfig.h b/bsp/ls1cdev/rtconfig.h
index 99bb973b90..8f87497875 100644
--- a/bsp/ls1cdev/rtconfig.h
+++ b/bsp/ls1cdev/rtconfig.h
@@ -75,6 +75,8 @@
#define RT_UART_RX_BUFFER_SIZE 64
// </section>
+#define RT_USING_FPU
+
// <section name="RT_USING_CONSOLE" description="Using console" default="true" >
#define RT_USING_CONSOLE
// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
diff --git a/libcpu/mips/loongson_1c/stackframe_fpu.h b/libcpu/mips/loongson_1c/stackframe_fpu.h
index 58e9271833..93b8ef10c3 100644
--- a/libcpu/mips/loongson_1c/stackframe_fpu.h
+++ b/libcpu/mips/loongson_1c/stackframe_fpu.h
@@ -37,6 +37,7 @@
.macro SAVE_FPU
.set push
.set noreorder
+#ifdef RT_USING_FPU
move k1, sp /* �����ֳ� */
and k0, k1, 0xFFFFFFF8 /* 8�ֽڶ��� */
PTR_SUBU sp, k0, PT_FPU_SIZE /* ����ջ�� */
@@ -57,6 +58,7 @@
s.d $f28, PT_FPU_R28(sp)
s.d $f30, PT_FPU_R30(sp)
move sp, k1 /* �ָ��ֳ� */
+#endif
.set reorder
.set pop
.endm
@@ -65,6 +67,7 @@
.macro RESTORE_FPU
.set push
.set noreorder
+#ifdef RT_USING_FPU
move k1, sp /* �����ֳ� */
and k0, k1, 0xFFFFFFF8 /* 8�ֽڶ��� */
PTR_SUBU sp, k0, PT_FPU_SIZE /* ����ջ��*/
@@ -85,6 +88,7 @@
l.d $f28, PT_FPU_R28(sp)
l.d $f30, PT_FPU_R30(sp)
move sp, k1 /* �ָ��ֳ� */
+#endif
.set reorder
.set pop
.endm