From 6fa4aa965c07ffd8e326180e8380c950a78d1fbb Mon Sep 17 00:00:00 2001 From: "bernard.xiong@gmail.com" Date: Tue, 23 Oct 2012 02:42:52 +0000 Subject: [PATCH] Add exit() function on finsh shell. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2368 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/simulator/application.c | 50 ++++++++++++++++--------------------- bsp/simulator/rtconfig.h | 1 + 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/bsp/simulator/application.c b/bsp/simulator/application.c index 860f7933a..815168409 100644 --- a/bsp/simulator/application.c +++ b/bsp/simulator/application.c @@ -16,21 +16,12 @@ #include #include -#ifdef RT_USING_DFS -/* dfs init */ -#include -/* dfs filesystem:ELM filesystem init */ -#include -/* dfs Filesystem APIs */ -#include -#endif +#include void rt_init_thread_entry(void* parameter) { -#ifdef RT_USING_COMPONENTS_INIT /* initialization RT-Thread Components */ rt_components_init(); -#endif rt_platform_init(); @@ -66,7 +57,6 @@ void rt_init_thread_entry(void* parameter) else rt_kprintf("jffs2 initialzation failed!\n"); #endif - } #endif } @@ -81,30 +71,32 @@ void rt_test_thread_entry(void* parameter) } } -#include int rt_application_init() { - rt_thread_t thread; + rt_thread_t tid; -#if (RT_THREAD_PRIORITY_MAX == 32) - thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, 8, 20); -#else - thread = rt_thread_create("init", - rt_init_thread_entry, RT_NULL, - 2048, 80, 20); -#endif + tid = rt_thread_create("init", + rt_init_thread_entry, RT_NULL, + 2048, RT_THREAD_PRIORITY_MAX/3, 20); - if (thread != RT_NULL) - rt_thread_startup(thread); + if (tid != RT_NULL) + rt_thread_startup(tid); - thread = rt_thread_create("test", - rt_test_thread_entry, RT_NULL, - 2048, 9, 20); - if (thread != RT_NULL) - rt_thread_startup(thread); + tid = rt_thread_create("test", + rt_test_thread_entry, RT_NULL, + 2048, RT_THREAD_PRIORITY_MAX * 3 /4, 20); + if (tid != RT_NULL) + rt_thread_startup(tid); return 0; } + +#include +void rt_hw_exit(void) +{ + rt_kprintf("RT-Thread, bye\n"); + exit(0); +} +FINSH_FUNCTION_EXPORT_ALIAS(rt_hw_exit, exit, exit rt-thread); + /*@}*/ diff --git a/bsp/simulator/rtconfig.h b/bsp/simulator/rtconfig.h index da82ac636..214a4dcf1 100644 --- a/bsp/simulator/rtconfig.h +++ b/bsp/simulator/rtconfig.h @@ -1,6 +1,7 @@ /* RT-Thread config file */ #ifndef __RTTHREAD_CFG_H__ #define __RTTHREAD_CFG_H__ + #ifdef _MSC_VER #undef RT_USING_NEWLIB #undef RT_USING_MINILIBC -- GitLab