初级会员
- 积分
- 105
- 金钱
- 105
- 注册时间
- 2020-3-18
- 在线时间
- 23 小时
|
2金钱
本帖最后由 风吹屁屁冷 于 2020-3-19 11:09 编辑
如题
stm32cubemx 版本5.6.0
keil版本5.29.0
freertos.c中代码
/* Includes ------------------------------------------------------------------*/
#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "cmsis_os.h"
#include "can.h"
#include "gpio.h"
#include "KincoServo.h"
osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
.name = "defaultTask",
.priority = (osPriority_t) osPriorityNormal,
.stack_size = 128 * 4
};
osThreadId_t myTask02_LedHandle;
const osThreadAttr_t myTask02_Led_attributes = {
.name = "myTask02_Led",
.priority = (osPriority_t) osPriorityLow,
.stack_size = 128 * 4
};
osThreadId_t myTask03_MotorHandle;
const osThreadAttr_t myTask03_Motor_attributes = {
.name = "myTask03_Motor",
.priority = (osPriority_t) osPriorityLow,
.stack_size = 128 * 4
};
osThreadId_t myTask04_CanTxHandle;
const osThreadAttr_t myTask04_CanTx_attributes = {
.name = "myTask04_CanTx",
.priority = (osPriority_t) osPriorityLow,
.stack_size = 128 * 4
};
osMessageQueueId_t myQueue01Handle;
const osMessageQueueAttr_t myQueue01_attributes = {
.name = "myQueue01"
};
void StartDefaultTask(void *argument);
void StartTask02_LedFunction(void *argument);
void StartTask03_MotorFunction(void *argument);
void StartTask04_CanTxFunction(void *argument);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
void MX_FREERTOS_Init(void) {
myQueue01Handle = osMessageQueueNew (16, sizeof(uint16_t), &myQueue01_attributes);
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
myTask02_LedHandle = osThreadNew(StartTask02_LedFunction, NULL, &myTask02_Led_attributes);
myTask03_MotorHandle = osThreadNew(StartTask03_MotorFunction, NULL, &myTask03_Motor_attributes);
myTask04_CanTxHandle = osThreadNew(StartTask04_CanTxFunction, NULL, &myTask04_CanTx_attributes);
}
void StartDefaultTask(void *argument)
{
for(;;)
{
osDelay(1);
}
}
void StartTask02_LedFunction(void *argument)
{
for(;;)
{
HAL_GPIO_TogglePin(LED0_GPIO_Port,LED0_Pin);
osDelay(1000);
HAL_GPIO_TogglePin(LED1_GPIO_Port,LED1_Pin);
}
}
void StartTask03_MotorFunction(void *argument)
{
FindOrigin(1);
osDelay(2000);
GetStates(1);
SetInterpolationModeType();
osMessagePut(myQueue01Handle,1,osWaitForever);
for(;;)
{
osDelay(1);
}
}
void StartTask04_CanTxFunction(void *argument)
{
for(;;)
{
osDelay(1);
}
}
敲代码的时候 能自动补全,也没有报错 osMessagePut(myQueue01Handle,1,osWaitForever);
但编译的时候报错了 ,提示没有定义
test\test.axf: Error: L6218E: Undefined symbol osMessagePut (referred from freertos.o).
是我用的方法不对吗,求大神指导
|
最佳答案
查看完整内容[请看2#楼]
问题解决了,记录一下吧。之前keil用的是pack 是Keil.STM32F4xx_DFP.2.13.0.pack,卸载装了2.14版本的,结果报错更多了!!!没办法卸载装回2.13版本的,编译居然通过了!!!莫名其妙搞得
|