[发布] RT-Thread RTOS v0.2.3版本

发布于 2008-10-06 07:04:37
更新记录
- 添加slab内存管理器;
- 添加用于小型内存系统的动态内存管理器 (使用动态内存时,小型内存管理器与slab内存管理器中使用其中之一);
- 添加lwip做为RT-Thread的TCP/IP协议栈 (0.2.3包含AT91RM9200网卡驱动,及QEMU/s3c2410虚拟的rtl8019网卡驱动);
- 添加C++特性支持;
- finsh中添加动态添加系统调用及系统变量的API;
- 修正rt_int*_t定义为显式的signed定义;
- 修正线程超时函数的问题;
- 修正链表中初始化问题;
- 修正Object中调用钩子函数的问题;

下载链接
rt-thread 0.2.3源代码

RT-Thread 0.2.3 API在线文档
http://www.rt-thread.org/rt-thread/rttdoc_0_2_3/

Msys下载链接
http://downloads.sourceforge.net/mingw/MSYS-1.0.10.exe

arm编译器windows版本链接
http://downloads.sourceforge.net/yagart ... 080928.exe

RT-Thread部分文档:
RT-Thread C++文档
http://www.rt-thread.org/rt-thread/11_RT-Thread%20C++.pdf
RT-Thread Shell文档
http://www.rt-thread.org/rt-thread/12_RT-Thread%20Shell.pdf
RT-Thread 配置文档
http://www.rt-thread.org/rt-thread/B_RT-Thread%20Configuration.pdf
RT-Thread on Skyeye (此文档中描述了如何编译及如何用Skyeye来模拟运行RT-Thread)
http://www.rt-thread.org/rt-thread/C_RT-Thread%20on%20Skyeye.pdf
insighter_setting.jpg
insighter_debug2.jpg

查看更多

关注者
0
被浏览
21.2k
7 个回答
bernard
bernard 2008-10-06
skyeye, arm-elf-insight协同调试RT-Thread RTOS

在rtt-0.2.3 ools目录中用skyeye模拟运行RT-Thread/lumit4510的命令行是:
skyeye -c ..kernelsplumit4510skyeye.conf -e ..kernelsplumit4510
tthread-lumit4510.elf

而skyeye内部是包含一个gdb stub的,也就是在本地建立一个gdb的庄,通过网络的形式再和实际的gdb程序连接,接受这个gdb程序的指挥进行模拟CPU的调试,这种调试方式是可以进行中断调试及网络协议栈调试的。

skyeye进入调试的命令行参数是(在前述命令行的基础上)
skyeye -d -c ..kernelsplumit4510skyeye.conf -e ..kernelsplumit4510
tthread-lumit4510.elf

运行后,应该会屏幕的最末端出现:
... server TCP port is 12345
的字样,此时说明skyeye等在本地端口12345上,并且是TCP连接方式。


接下去就是arm-elf-insight如何连接调试了,请安装yagarto的toolchains,运行yagartoinarm-elf-insight.exe
File菜单->Open...菜单 打开rtt-0.2.3kernelsplumit4510
tthread-lumit4510.elf文件(此文件也就是RT-Thread的操作系统内核映像文件,必须采用调试模式编译),打开后arm-elf-insight.exe应该会自动跳到start.S,也就是RT-Thread的最开始的入口处。

File菜单->Target Settings 菜单,Target选择Remote/TCP,Hostname:输入localhost,Port:输入12345。More Options的地方,选择上Attach to Target和Continue from Last Stop。然后按确定退出这个对话框。

Run菜单->Connect to target菜单,如果无意外,应该会显示一个Successfully connected对话框,确定就是了。
insighter_setting.jpg

此时就可以开始进行RT-Thread调试了,试着在rtthread_startup函数(也就是RT-Thread的第一个C入口函数)设置个断点:在GDB控制终端输入break rtthread_startup (打开GDB控制终端:View菜单->Console菜单)

设置完断点后,在arm-elf-insight主窗口输入一个c(Continue,Control菜单中的Continue菜单),很快就停下来了,停在了rtthread_startup函数上。
insighter_debug2.jpg
bernard
bernard 2008-10-07
RT-Thread 0.2.3版本也是支持QEMU/2410的模拟运行的,而且模拟运行的效果非常不错(等到出0.3.0技术预览版这个特点就更明显了)

在rt-thread/tools目录下有多个批处理文件:
run-2410.bat 普通的运行模式;
run-2410-debug.bat 带gdb调试庄的运行模式,适合于和insight衔接进行操作系统的调试;
run-2410-nonet.bat 非网络模式运行,适合于RT-Thread中去掉RT_USING_LWIP选项的情况;

在编译好s3c2410的内核后就可以直接运行上面的几个批处理文件了,激活QEMU的网络功能需要安装一个虚拟网卡,可以参见opensvn的windows安装方法。
bernard
bernard 2008-10-08
RT-Thread 0.2.3的实时指标
环境AT91RM9200,180MHz
编译器gcc 3.4.5
编译参数-O2
指标:
线程切换时间,7.478us
中断切换时间,6.410us
(注意是中断切换时间而不是中断响应时间)

测试代码:

/*
* File : benchmark.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, 2007, 2008 RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
*
*
* Change Logs:
* Date Author Notes
* 2008-08-31 Bernard the first version
*/

#include
#include

#include
/*
* benchmark for AT91RM9200 benchmark
*
* mck = 59904000 Hz
* TC2, mck/32
*/
#define TC2_CV *((volatile unsigned long*)0xFFFA0090) /* (TC2) Counter Value */

/* benchmark utility */
void set_tracepoint(rt_int32_t level)
{
static rt_uint16_t value;
rt_uint16_t v;

if (level == 0)
{
value = TC2_CV;
}
else
{
v = TC2_CV;
rt_kprintf("CV: 0x%04x
", v - value);
}
}

rt_thread_t thread1 = RT_NULL;
rt_thread_t thread2 = RT_NULL;
rt_thread_t thread3 = RT_NULL;

void thread1_entry(void* parameter)
{
while (1)
{
rt_thread_resume(thread2);

/* init trace point */
set_tracepoint(0);
/* there is no auto schedule, call scheduler */
rt_schedule();

rt_thread_delay(50);
}
}

void thread2_entry(void* parameter)
{
while (1)
{
rt_thread_suspend(thread2);
/* there is no auto schedule, call scheduler */
rt_schedule();

set_tracepoint(1);
}
}

void thread3_entry(void* parameter)
{
rt_kprintf("thread3 entry
");

while (1)
{
rt_thread_suspend(thread3);
/* there is no auto schedule, call scheduler */
rt_schedule();

/* trigger trace point */
set_tracepoint(1);
}
}

void thread_benchmark()
{
if (thread1 != RT_NULL)
{
/* delete thread 1 */
rt_thread_delete(thread1);
thread1 = RT_NULL;
}

if (thread2 != RT_NULL)
{
/* delete thread 2 */
rt_thread_delete(thread2);
thread2 = RT_NULL;
}

/* create thread 1 and thread 2*/
thread1 = rt_thread_create("tid1", thread1_entry, RT_NULL,
1024, 250, 20);
rt_thread_startup(thread1);

thread2 = rt_thread_create("tid2", thread2_entry, RT_NULL,
1024, 200, 20);
rt_thread_startup(thread2);
}

/* isr handle, in tc 1 interrupt */
void isr_handler(int irqno)
{
static volatile rt_uint32_t cnt = 0;
volatile rt_uint32_t dummy;

dummy = REG_IN32(AT9200_TC1_SR, 0);
if (cnt == 100)
{
rt_kprintf("trigger thread3
");
cnt = 0;

rt_thread_resume(thread3);

/* there is no auto schedule, call scheduler */
rt_schedule();

/* init trace point */
set_tracepoint(0);
}
else cnt ++;
}

void isr_benchmark()
{
rt_uint32_t result;
rt_uint32_t value;

if (thread3 != RT_NULL)
{
/* delete thread 3 */
result = rt_thread_delete(thread3);
RT_ASSERT(result == RT_EOK);
thread3 = RT_NULL;
}

/* init time counter 1 */
value = REG_IN32(AT9200_TC1_SR, 0); /* read and clear status register */
REG_OUT32(AT9200_TC1_CCR, 0, (1 << 1)); /* disable timer */
REG_OUT32(AT9200_PMC_PCER, 0, (1 << TC1_VEC)); /* enable peripheral clock in pmc for tc0 */
REG_OUT32(AT9200_TC1_CMR, 0, 0x4004); /* timer clock5, lsck, 32768 Hz */
REG_OUT32(AT9200_TC1_RC, 0, 0x147); /* 100 tick per second */
REG_OUT32(AT9200_TC1_IER, 0, (1 << 4)); /* enable RC compare interrupt */
REG_OUT32(AT9200_TC1_CCR, 0, 0x05); /* enable clock counter and software trigger */

/* timer counter interrupt init */
REG_OUT32(AT9200_AIC_SMR, TC1_VEC*4, 0x02); /* interrupt trigger mode & priority */
REG_OUT32(AT9200_AIC_ICCR, 0, (1 << TC1_VEC)); /* clear the TC0 interrupt */
REG_OUT32(AT9200_AIC_IECR, 0, (1 << TC1_VEC)); /* enable the TC0 interrupt */

/* install int handler & unmask immediately*/
rt_hw_interrupt_install(TC1_VEC, isr_handler, RT_NULL);
rt_hw_interrupt_umask(TC1_VEC);

/* create thread 3 and startup */
thread3 = rt_thread_create("tid3", thread3_entry, RT_NULL,
1024, 180, 20);
result = rt_thread_startup(thread3);
RT_ASSERT(result == RT_EOK);
}

int rt_application_init()
{
rt_uint32_t value;

thread1 = thread2 = thread3 = RT_NULL;

/* init time counter 1 */
value = REG_IN32(AT9200_TC2_SR, 0); /* read and clear status register */
REG_OUT32(AT9200_TC2_CCR, 0, (1 << 1)); /* disable timer */
REG_OUT32(AT9200_PMC_PCER, 0, (1 << TC2_VEC)); /* enable peripheral clock in pmc for tc0 */
REG_OUT32(AT9200_TC2_CMR, 0, 0x2); /* timer clock3, mck/32 Hz */
REG_OUT32(AT9200_TC2_RC, 0, 0x147); /* 100 tick per second */
REG_OUT32(AT9200_TC2_CCR, 0, 0x05); /* enable clock counter and software trigger */

#ifdef RT_USING_FINSH
finsh_syscall_append("tbenchmark", (syscall_func)thread_benchmark);
finsh_syscall_append("ibenchmark", (syscall_func)isr_benchmark);
#endif

return 0;
}


finsh命令行下执行
tbenchmark(),进行线程切换测试
ibenchmark(),进行中断切换测试
bernard
bernard 2008-10-11
RT-Thread 0.2.3以后的发布路线如下:
RT-Thread 0.2.3 --> RT-Thread 0.2.4,主要针对0.2.3 bug修正的情况做发布。

RT-Thread主干 --> RT-Thread 0.3.0,新的特性会添加进来,大概一两周后会发布第一技术预览版本,新特性主要包括文件系统组件,RTGUI组件以及newlib(一套完整的libc库)
my2003sky
my2003sky 2009-03-11
这个图片在重新传一下吧,看看设置
bernard
bernard 2009-03-16
这个帖子里的图片已经重新上传了。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友