CH32L103移植RT-Thread

用官網(wǎng)提供的EVT文件中的rtthread樣版工程創(chuàng)建線程后,線程一直處于就緒態(tài),不能運行打印出。

#include?"ch32l103.h"
#include?#include?#include?"drivers/pin.h"
#include?#include?#define?DBG_TAG?"main"


rt_thread_t?th1_ptr?=?NULL;
struct?rt_thread?th2?;

rt_uint8_t?th2_stack[512]?=?{0};

void?th1_entry(void?*parameter)
{
????int?i?=?0;
????for(i?=?0;?i?<?5?;?i++){
????????rt_kprintf("th1?running...\n");
????????rt_thread_mdelay(1000);
????}

}

void?th2_entry(void?*parameter)
{
????int?i?=?0;
????for(i?=?0;?i?<?5?;?i++)
????{
????????rt_kprintf("th2?running...\n");
????????rt_thread_mdelay(1000);
????}

}

void?scheduler_hook(struct?rt_thread?*from,?struct?rt_thread?*to)
{
????rt_kprintf("from:%s?--->?to:%s\n",from->name,to->name);
}

int?main(void)
{
????int?ret?=?0;

????//??rt_scheduler_sethook(scheduler_hook);

????th1_ptr?=?rt_thread_create("th1_demo",th1_entry,NULL,1024,20,5);
????if(th1_ptr?==?RT_NULL){
????????LOG_E("rt_thread_create?failed...\n");
????????return?-RT_ENOMEM;
????}

????LOG_D("rt_thread_create?successed?...\n");
????rt_thread_startup(th1_ptr);

????ret?=?rt_thread_init(&th2,?"th2_demo",?th2_entry,?NULL,?th2_stack,?\
????????????sizeof(th2_stack),?19,?5);
????if(ret?<?0){
????????LOG_E("rt_thread_init?failed...\n");
????????return?ret;
????}
????LOG_D("rt_thread_init?successed?...\n");
????rt_thread_startup(&th2);
}

3d7c4bf0ec134007c58e2777cbd4191.png

您好,若方便可將工程發(fā)我郵箱(lzs@wch.cn)具體看一下


已發(fā)送,望查收,期待您的解答。個人信息保護,已隱藏


您好,已郵件回復(fù),注意創(chuàng)建任務(wù)時設(shè)置的優(yōu)先級要在rtconfig.h文件中設(shè)置的優(yōu)先級值的范圍內(nèi)。后續(xù)問題可繼續(xù)通過郵箱溝通。


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频