Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
Kernel
rtthread内核移植到stm32f427调度不到main线程
发布于 2019-10-30 22:27:51 浏览:1817
订阅该版
移植以后可以串口通过rt_kprintf打印version信息,但是调度器不能调度到初始化的main线程。main线程已经初试化,steup成功。
查看更多
5
个回答
默认排序
按发布时间排序
WillianChan
2019-10-31
我不是专家,每天也在学习 ^_^ 难题问谷歌、简单的去百度、玄学问热心网友
请尽可能提供移植过程,最好有相关你觉得有问题的代码能提供出来,方便大家帮你找原因。
bpdwn
2019-11-01
这家伙很懒,什么也没写!
[code]/* RT-Thread Kernel */ #define RT_NAME_MAX 8 #define RT_ALIGN_SIZE 4 #define RT_THREAD_PRIORITY_32 #define RT_THREAD_PRIORITY_MAX 32 #define RT_TICK_PER_SECOND 1000 #define RT_USING_OVERFLOW_CHECK #define RT_USING_HOOK #define RT_USING_IDLE_HOOK #define RT_IDEL_HOOK_LIST_SIZE 4 #define IDLE_THREAD_STACK_SIZE 1024 #define RT_DEBUG #define RT_DEBUG_COLOR /* Inter-Thread communication */ #define RT_USING_SEMAPHORE #define RT_USING_MUTEX #define RT_USING_EVENT #define RT_USING_MAILBOX #define RT_USING_MESSAGEQUEUE /* Memory Management */ #define RT_USING_MEMPOOL #define RT_USING_MEMHEAP #define RT_USING_SMALL_MEM #define RT_USING_HEAP /* Kernel Device Object */ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" /* RT-Thread Components */ #define RT_USING_COMPONENTS_INIT #define RT_USING_USER_MAIN #define RT_MAIN_THREAD_STACK_SIZE 2048 #define RT_MAIN_THREAD_PRIORITY 10[/code] [code]int rtthread_startup(void) { rt_hw_interrupt_disable(); /* board level initalization * NOTE: please initialize heap inside board initialization. */ rt_hw_board_init(); /* show RT-Thread version */ rt_show_version(); /* timer system initialization */ rt_system_timer_init(); /* scheduler system initialization */ rt_system_scheduler_init(); #ifdef RT_USING_SIGNALS /* signal system initialization */ rt_system_signal_init(); #endif /* create init_thread */ rt_application_init(); /* timer thread initialization */ rt_system_timer_thread_init(); /* idle thread initialization */ rt_thread_idle_init(); /* start scheduler */ rt_system_scheduler_start(); /* never reach here */ return 0; }[/code] [code]void rt_application_init(void) { rt_thread_t tid; #ifdef RT_USING_HEAP tid = rt_thread_create("main", main_thread_entry, RT_NULL, RT_MAIN_THREAD_STACK_SIZE, RT_MAIN_THREAD_PRIORITY, 20); RT_ASSERT(tid != RT_NULL); #else rt_err_t result; tid = &main_thread; result = rt_thread_init(tid, "main", main_thread_entry, RT_NULL, main_stack, sizeof(main_stack), RT_MAIN_THREAD_PRIORITY, 20); RT_ASSERT(result == RT_EOK); /* if not define RT_USING_HEAP, using to eliminate the warning */ (void)result; #endif rt_thread_startup(tid); }[/code] [code]void rt_hw_board_init() { /* HAL_Init() function is called at the beginning of program after reset and before * the clock configuration. */ HAL_Init(); /* Clock Config: * System Clock : 80M * HCLK : 80M * PCLK1 : 80M * PCLK2 : 80M * SDMMC1 : 48M * USART1 : PCLK2 */ SystemClock_Config(); /* Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / RT_TICK_PER_SECOND); /* Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); /* SysTick_IRQn interrupt configuration */ HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); #ifdef RT_USING_HEAP rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); #endif //bsp_led_init(); bsp_uart_init(); }[/code] 运行工程开启DEBUG打印的日志 [code]Press Ctrl+C to enter Boot Menu 0 \ | / - RT - Thread Operating System / | \ 3.1.0 build Nov 1 2019 2006 - 2018 Copyright by rt-thread team start scheduler: max priority 0x20 startup a thread:main with priority:10 thread resume: main insert thread[main], the priority: 10 startup a thread:tidle with priority:31 thread resume: tidle insert thread[tidle], the priority: 31 current thread:main, status:1[/code]
bpdwn
2019-11-01
这家伙很懒,什么也没写!
[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=468159&ptid=422430][color=#999999]WillianChan 发表于 2019-10-31 09:42[/color][/url][/size] 请尽可能提供移植过程,最好有相关你觉得有问题的代码能提供出来,方便大家帮你找原因。 ...[/quote] 您好,下面是运行后打印的日志。代码放在上一个回复里面了。线程应该是起来了,但是调度器没有调度。 [code]Press Ctrl+C to enter Boot Menu 0 \ | / - RT - Thread Operating System / | \ 3.1.0 build Nov 1 2019 2006 - 2018 Copyright by rt-thread team start scheduler: max priority 0x20 startup a thread:main with priority:10 thread resume: main insert thread[main], the priority: 10 startup a thread:tidle with priority:31 thread resume: tidle insert thread[tidle], the priority: 31 current thread:main, status:1[/code]
bpdwn
2019-11-01
这家伙很懒,什么也没写!
[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=468159&ptid=422430][color=#999999]WillianChan 发表于 2019-10-31 09:42[/color][/url][/size] 请尽可能提供移植过程,最好有相关你觉得有问题的代码能提供出来,方便大家帮你找原因。 ...[/quote] 根据《嵌入式实时操作系统rt-thread 设计与实现》第10章 内核移植 操作的
bpdwn
2019-11-01
这家伙很懒,什么也没写!
[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=468159&ptid=422430][color=#999999]WillianChan 发表于 2019-10-31 09:42[/color][/url][/size] 请尽可能提供移植过程,最好有相关你觉得有问题的代码能提供出来,方便大家帮你找原因。 ...[/quote] [attach]12036[/attach] [attach]12035[/attach] [attach]12034[/attach] [attach]12033[/attach] [attach]12032[/attach] [attach]12031[/attach]
撰写答案
登录
注册新账号
关注者
0
被浏览
1.8k
关于作者
bpdwn
这家伙很懒,什么也没写!
提问
2
回答
8
被采纳
0
关注TA
发私信
相关问题
1
cpu使用率分析
2
选择FreeRTOS, 还是RT-Thread。
3
thread heap stack overflow ?
4
rtt消息队列delay问题
5
释放被删除线程的内存地方在哪里啊
6
请教:各线程结束后,释放其中的内存的连续性问题
7
STM32F103中断关于信号量、邮箱问题
8
RTT中的线程栈大小如何控制
9
关于线程由执行态变为挂起态的代码实现,,,
10
rt_malloc(rt_size_t size)内存分配函数最小分配尺寸问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
机器人操作系统 (ROS2) 和 RT-Thread 通信
4
五分钟玩转RT-Thread新社区
5
国产MCU移植系列教程汇总,欢迎查看!
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
ulog组件多端绑定的demo案例
2
记录rt-thread消息队列的调试方法
3
AT32的ADC使用
4
aht10 终端:The aht10 is under an abnormal status
5
github高阶加速,速度可达带宽峰值,测试到146Mbit/s
热门标签
RT-Thread Studio
串口
LWIP
Env
AT
SPI
Bootloader
FinSH
ART-Pi
CAN总线
Hardfault
USB
文件系统
RT-Thread
DMA
SCons
线程
MQTT
RT-Thread Nano
STM32
RTC
rt-smart
ESP8266
flash
ota在线升级
WIZnet_W5500
FAL
I2C
packages_软件包
UART
cubemx
freemodbus
潘多拉开发板_Pandora
定时器
BSP
PWM
ADC
socket
中断
rt_mq_消息队列_msg_queue
keil_MDK
SDIO
Debug
AB32VG1
MicroPython
C++_cpp
编译报错
msh
ulog
QEMU
本月问答贡献
出出啊
1500
个答案
338
次被采纳
小小李sunny
1390
个答案
276
次被采纳
张世争
715
个答案
157
次被采纳
crystal266
522
个答案
153
次被采纳
whj467467222
1216
个答案
146
次被采纳
本月文章贡献
出出啊
1
篇文章
12
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
2
篇文章
2
次点赞
crystal266
2
篇文章
5
次点赞
whj467467222
2
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部