R2_NEW/User/task/user_task.c

72 lines
1.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
保存任务属性,生成任务时使用。
堆栈大小取决于自己设定,堆栈溢出(分配的内存过小)可能导致陀螺仪解算的欧拉角出问题。
堆栈分配过大可能导致各个线程跑飞(怀疑是内存不够导致的)。
!!!如果出现各种跑飞和奇怪的问题,请合理怀疑是否是堆栈内存分配的问题。
对于内存分配的一些理论规则:
此处堆栈存放的都是一些局部变量和全局变量,需要根据线程自身的需求大小进行设定。
涉及上下层的消息队列,不使用多个任务读取同一消息队列的方式
建立各自使用的消息队列避免影响涉及cmd控制can消息
*/
/* Includes ----------------------------------------------------------------- */
#include "task\user_task.h"
Task_Runtime_t task_runtime;
/* 各个任务的参数属性 */
const osThreadAttr_t attr_init = {
.name = "init",
.priority = osPriorityRealtime,
.stack_size = 256 * 4,
};
const osThreadAttr_t attr_atti_esti = {
.name = "atti_esti",
.priority = osPriorityRealtime,
.stack_size = 256 * 4,
};
const osThreadAttr_t attr_chassis = {
.name = "chassis",
.priority = osPriorityAboveNormal,
.stack_size = 512 * 4,
};
const osThreadAttr_t attr_can = {
.name = "can",
.priority = osPriorityRealtime,
.stack_size = 256 * 4,
};
const osThreadAttr_t attr_cmd = {
.name = "cmd",
.priority = osPriorityHigh,
.stack_size = 256 *4,
};
const osThreadAttr_t attr_nuc = {
.name = "nuc",
.priority = osPriorityRealtime,
.stack_size = 128 *4,
};
const osThreadAttr_t attr_error_detect = {
.name = "error_detect",
.priority = osPriorityLow,
.stack_size = 128 *4,
};
const osThreadAttr_t attr_rc = {
.name = "dr16",
.priority = osPriorityRealtime,
.stack_size = 128 *4,
};
const osThreadAttr_t attr_up = {
.name = "up",
.priority = osPriorityRealtime,
.stack_size = 512 * 4,
};