2454 views|1 replies

98

Posts

0

Resources
The OP
 

[Zhongke Bluexun AB32VG1 RISC-V Evaluation Board] Try to use RTThread multitasking [Copy link]

 

Due to the needs of study and work, I have used FreeRTOS and ucOS before. I have also heard from friends around me that RTThread is a good domestic RTOS. Taking advantage of the EE's kindness, I was given the opportunity to evaluate it, so I tried to learn and understand RTThread.

The most basic and most important function of an RTOS is task scheduling. Below we will try to start two RTThread tasks and print their respective information.

As shown in the figure above, we initialize and start two threads, thread_1 and thread_2. The function rt_thread_create is used to initialize the task information, and _rt_thread_startup is used to start the task.

We can see that the functions of the two tasks are very simple, just printing information every 1000 milliseconds.

rt_thread_t rt_thread_create(const char *name,
                             void (*entry)(void *parameter),
                             void       *parameter,
                             rt_uint32_t stack_size,
                             rt_uint8_t  priority,
                             rt_uint32_t tick)

The above figure is the prototype of rt_thread_create. The first parameter is the thread name, the second is the thread function entry, the third is the thread parameter, the fourth is the stack size, the fifth is the priority, and the sixth is the time slice.

The most interesting one is the sixth parameter, which is a setting I have not seen in other RTOS. It allows users to set thread time slices, which gives RTOS users more flexibility in controlling threads.

The above is a screenshot of the running results.

This post is from Domestic Chip Exchange

Latest reply

The six parameters of the prototype of rt_thread_create are indeed very flexible in setting the thread time slice   Details Published on 2021-9-13 08:46
 
 

1662

Posts

0

Resources
2
 

The six parameters of the prototype of rt_thread_create are indeed very flexible in setting the thread time slice

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list