Skip to content

Commit 1ab8f46

Browse files
committed
Modify main to output only printf
1 parent 13ef664 commit 1ab8f46

File tree

1 file changed

+12
-63
lines changed
  • bsp/xuantie/virt64/c906/applications

1 file changed

+12
-63
lines changed
Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,19 @@
1-
#include <rtthread.h>
2-
3-
#define THREAD_PRIORITY 25
4-
#define THREAD_STACK_SIZE 2048
5-
#define THREAD_TIMESLICE 5
6-
7-
static rt_thread_t tid1 = RT_NULL;
8-
9-
/* 线程 1 的入口函数 */
10-
static void thread1_entry(void *parameter)
11-
{
12-
rt_uint32_t count = 0;
13-
14-
for (count = 0; count < 10 ; count++)
15-
{
16-
/* 线程 1 采用低优先级运行 */
17-
rt_kprintf("thread1 count: %d\n", count);
18-
rt_thread_mdelay(500);
19-
}
20-
rt_kprintf("thread1 exit\n");
21-
/* 线程 1 运行结束后也将自动被系统脱离 */
22-
}
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
*/
239

24-
#if defined(RT_VERSION_CHECK) && (RTTHREAD_VERSION >= RT_VERSION_CHECK(5, 0, 1))
25-
rt_align(RT_ALIGN_SIZE)
26-
#else
27-
ALIGN(RT_ALIGN_SIZE)
28-
#endif
29-
static char thread2_stack[1024];
30-
static struct rt_thread thread2;
31-
/* 线程 2 入口 */
32-
static void thread2_entry(void *param)
33-
{
34-
rt_uint32_t count = 0;
35-
36-
/* 线程 2 拥有较高的优先级,以抢占线程 1 而获得执行 */
37-
for (count = 0; count < 10 ; count++)
38-
{
39-
/* 线程 2 打印计数值 */
40-
rt_kprintf("thread2 count: %d\n", count);
41-
}
42-
rt_kprintf("thread2 exit\n");
43-
/* 线程 2 运行结束后也将自动被系统脱离 */
44-
}
10+
#include <rtthread.h>
11+
#include <rthw.h>
12+
#include <string.h>
4513

46-
/* 线程示例 */
4714
int main(void)
4815
{
49-
/* 创建线程 1,名称是 thread1,入口是 thread1_entry*/
50-
tid1 = rt_thread_create("thread1",
51-
thread1_entry, RT_NULL,
52-
THREAD_STACK_SIZE,
53-
THREAD_PRIORITY, THREAD_TIMESLICE);
54-
55-
/* 如果获得线程控制块,启动这个线程 */
56-
if (tid1 != RT_NULL)
57-
rt_thread_startup(tid1);
58-
59-
/* 初始化线程 2,名称是 thread2,入口是 thread2_entry */
60-
rt_thread_init(&thread2,
61-
"thread2",
62-
thread2_entry,
63-
RT_NULL,
64-
&thread2_stack[0],
65-
sizeof(thread2_stack),
66-
THREAD_PRIORITY - 1, THREAD_TIMESLICE);
67-
rt_thread_startup(&thread2);
16+
rt_kprintf("Hello RISC-V\n");
6817

6918
return 0;
7019
}

0 commit comments

Comments
 (0)