rt-thread nano finsh控制台移植的一些问题
·
因为nano只能手动移植,参考官方文档
Nano 移植控制台/FinSH (rt-thread.org)
需要注意的几个点:
1.rtconfig里需要
#include "finsh_config.h"
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 128 //控制台内存大小
建议屏蔽这段,因为在finsh_config里重复定义了
#if 0 //finsh线程相关,使用finsh_config.h的宏定义部分
#if defined(RT_USING_FINSH) //
#define FINSH_USING_MSH
#define FINSH_USING_MSH_ONLY
// <h>Finsh Configuration
// <o>the priority of finsh thread <1-7>
// <i>the priority of finsh thread
// <i>Default: 6
#define __FINSH_THREAD_PRIORITY 5
#define FINSH_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 8 * __FINSH_THREAD_PRIORITY + 1)
// <o>the stack of finsh thread <1-4096>
// <i>the stack of finsh thread
// <i>Default: 4096 (4096Byte)
#define FINSH_THREAD_STACK_SIZE 512
// <o>the history lines of finsh thread <1-32>
// <i>the history lines of finsh thread
// <i>Default: 5
#define FINSH_HISTORY_LINES 1
#define FINSH_USING_SYMTAB
// </h>
#endif
然后就是实现接口函数,这里要注意几个点
1.在rtthread里,main函数是作为线程存在的,是可能会被抢占的,可以查看rt_thread_create和rt_thread_init的引用来看初始化了几个线程,一定要注意几个系统进程的优先级,初始化信号量的线程必须在tshell线程前,否则getchar时会直接导致shell无法使用
更多推荐


所有评论(0)