Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
rt_thread_creadt
新建动态线程出现如下问题
发布于 2020-12-10 14:58:51 浏览:1155
订阅该版
#include
#include"gpio.h" #define DBG_TAG "main" #define DBG_LVL DBG_LOG #include
#define THREAD_PRIORITY 25 #define THREAD_STACK_SIZE 512 #define THREAD_TIMESLICE 5 static rt_thread_t tid1 = RT_NULL; /* 线程1的入口函数 */ static void thread1_entry(void *parameter) { while(1) { LED1_ON; rt_thread_mdelay(1000); LED1_OFF; rt_thread_mdelay(1000); } } ALIGN(RT_ALIGN_SIZE) static char thread2_stack[1024]; static struct rt_thread thread2; /* 线程2的入口函数 */ static void thread2_entry(void *parameter) { while(1) { LED2_ON; rt_thread_mdelay(500); LED2_OFF; rt_thread_mdelay(500); } } int thread_sample(void) { tid1 = rt_thread_create("thread1", thread1_entry, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE); if(tid1 != RT_NULL) rt_thread_startup(tid1); /* 初始化线程2, 名称是thread2, 入口是thread2_entry */ rt_thread_init(&thread2, "thread2", thread2_entry, RT_NULL, &thread2_stack[0], sizeof(thread2_stack), THREAD_PRIORITY-1, THREAD_TIMESLICE); rt_thread_startup(&thread2); return 0; } int main(void) { // int count = 1; MX_GPIO_Init(); thread_sample(); // while (count++) // { // LOG_D("Hello RT-Thread!"); // rt_thread_mdelay(1000); // } return RT_EOK; } 编译时报错:arm-none-eabi-gcc "../applications/main.c" linking... ./applications/main.o: In function `thread_sample': D:\RT-ThreadStudio\workspace\Test\Debug/../applications/main.c:53: undefined reference to `rt_thread_create' collect2.exe: error: ld returned 1 exit status make: *** [makefile:53: rtthread.elf] Error 1 "make -j4 all" terminated with exit code 2. Build might be incomplete. 14:57:01 Build Failed. 2 errors, 0 warnings. (took 491ms)
查看更多
2
个回答
默认排序
按发布时间排序
张世争
2020-12-10
学以致用
全局搜索一下: rt_thread_create,为什么找不到定义?
WQ炑
2021-03-08
这家伙很懒,什么也没写!
在RT-Thread studio中,打开RT-Thread Setting,然后找到内核里面的内存管理,有个使能动态内存,使能一下,再次编译就可以了
撰写答案
登录
注册新账号
关注者
0
被浏览
1.2k
关于作者
suwenli401
这家伙很懒,什么也没写!
提问
1
回答
0
被采纳
0
关注TA
发私信
相关问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
机器人操作系统 (ROS2) 和 RT-Thread 通信
4
国产MCU移植系列教程汇总,欢迎查看!
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RT-Thread Vision Board - Bare Metal Project with VSCode/PyOCD/Cortex-Debug
2
【学习分享】libc切换 -- 从newlib切换到mlibc
3
FRDM-MCXN947开发板之i2c应用
4
esp32 s3使用cherryusb cdc
5
【Vision Board 创客营】Vision Board上的DAC实践
热门标签
RT-Thread Studio
串口
LWIP
SPI
Env
Bootloader
AT
ART-Pi
Hardfault
CAN总线
FinSH
USB
文件系统
DMA
RT-Thread
SCons
线程
RT-Thread Nano
MQTT
STM32
RTC
FAL
rt-smart
ESP8266
ota在线升级
WIZnet_W5500
I2C_IIC
UART
flash
cubemx
packages_软件包
freemodbus
潘多拉开发板_Pandora
PWM
定时器
ADC
BSP
中断
编译报错
socket
keil_MDK
GD32
MicroPython
msh
Debug
ulog
SFUD
flashDB
SDIO总线
rt_mq_消息队列_msg_queue
本月问答贡献
用户名由3_15位
18
个答案
3
次被采纳
xiaorui
7
个答案
3
次被采纳
sakumisu
4
个答案
3
次被采纳
踩姑娘的小蘑菇
15
个答案
2
次被采纳
三世执戟
32
个答案
1
次被采纳
本月文章贡献
比特饼干
3
篇文章
8
次点赞
Z_Y
2
篇文章
5
次点赞
Alipay
2
篇文章
3
次点赞
xusiwei1236
2
篇文章
3
次点赞
yinxiangxv
2
篇文章
3
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部