提交 574e22bd 编写于 作者: 勤为本

在配置文件“rtconfig.h”中增加硬浮点FPU的配置项,

浮点经常会用到,所以默认使用硬浮点。
上级 8d908671
...@@ -94,8 +94,10 @@ void rt_hw_board_init(void) ...@@ -94,8 +94,10 @@ void rt_hw_board_init(void)
/* init operating system timer */ /* init operating system timer */
rt_hw_timer_init(); rt_hw_timer_init();
#ifdef RT_USING_FPU
/* init hardware fpu */ /* init hardware fpu */
rt_hw_fpu_init(); rt_hw_fpu_init();
#endif
rt_kprintf("current sr: 0x%08x\n", read_c0_status()); rt_kprintf("current sr: 0x%08x\n", read_c0_status());
} }
......
...@@ -75,6 +75,8 @@ ...@@ -75,6 +75,8 @@
#define RT_UART_RX_BUFFER_SIZE 64 #define RT_UART_RX_BUFFER_SIZE 64
// </section> // </section>
#define RT_USING_FPU
// <section name="RT_USING_CONSOLE" description="Using console" default="true" > // <section name="RT_USING_CONSOLE" description="Using console" default="true" >
#define RT_USING_CONSOLE #define RT_USING_CONSOLE
// <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" /> // <integer name="RT_CONSOLEBUF_SIZE" description="The buffer size for console output" default="128" />
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
.macro SAVE_FPU .macro SAVE_FPU
.set push .set push
.set noreorder .set noreorder
#ifdef RT_USING_FPU
move k1, sp /* 保存现场 */ move k1, sp /* 保存现场 */
and k0, k1, 0xFFFFFFF8 /* 8字节对齐 */ and k0, k1, 0xFFFFFFF8 /* 8字节对齐 */
PTR_SUBU sp, k0, PT_FPU_SIZE /* 计算栈底 */ PTR_SUBU sp, k0, PT_FPU_SIZE /* 计算栈底 */
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
s.d $f28, PT_FPU_R28(sp) s.d $f28, PT_FPU_R28(sp)
s.d $f30, PT_FPU_R30(sp) s.d $f30, PT_FPU_R30(sp)
move sp, k1 /* 恢复现场 */ move sp, k1 /* 恢复现场 */
#endif
.set reorder .set reorder
.set pop .set pop
.endm .endm
...@@ -65,6 +67,7 @@ ...@@ -65,6 +67,7 @@
.macro RESTORE_FPU .macro RESTORE_FPU
.set push .set push
.set noreorder .set noreorder
#ifdef RT_USING_FPU
move k1, sp /* 保存现场 */ move k1, sp /* 保存现场 */
and k0, k1, 0xFFFFFFF8 /* 8字节对齐 */ and k0, k1, 0xFFFFFFF8 /* 8字节对齐 */
PTR_SUBU sp, k0, PT_FPU_SIZE /* 计算栈底*/ PTR_SUBU sp, k0, PT_FPU_SIZE /* 计算栈底*/
...@@ -85,6 +88,7 @@ ...@@ -85,6 +88,7 @@
l.d $f28, PT_FPU_R28(sp) l.d $f28, PT_FPU_R28(sp)
l.d $f30, PT_FPU_R30(sp) l.d $f30, PT_FPU_R30(sp)
move sp, k1 /* 恢复现场 */ move sp, k1 /* 恢复现场 */
#endif
.set reorder .set reorder
.set pop .set pop
.endm .endm
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册