vxWorks 警告:变量 <task> 在设置其值之前被使用

vxWorks warning: variable <task> is used before its value is set

这是我的问题warning (etoa:4549): variable "T1" is used before its value is set

当我 运行 这个 debugger 打开!

我不知道哪里出了问题,我不能运行这个!

CPU: Windows 6.1. Processor #0. Memory Size: 0x1f00000 (31Mb). BSP version 6.9/0. Created: Jul 17 2012, 10:12:44 ED&R Policy Mode: Deployed WDB Comm Type: WDB_COMM_PIPE WDB: Ready.

-> Exception !
Vector 13 : Access Violation
Program Counter:        0x00000000
Access Address (read):  0x00000000
Status Register:        0x00010246
Task: 0x1044e2d0 "T3"
0x1044e2d0 (T3): task 0x1044e2d0 has had a failure and has been stopped.
0x1044e2d0 (T3): fatal kernel task-level exception!
Exception !
Vector 13 : Access Violation
Program Counter:        0x00000000
Access Address (read):  0x00000000
Status Register:        0x00010246
Task: 0x1044dce0 "T1"
0x1044dce0 (T1): task 0x1044dce0 has had a failure and has been stopped.
0x1044dce0 (T1): fatal kernel task-level exception!
Exception !
Vector 13 : Access Violation
Program Counter:        0x00000000
Access Address (read):  0x00000000
Status Register:        0x00010246
Task: 0x1044dfd8 "T2"
0x1044dfd8 (T2): task 0x1044dfd8 has had a failure and has been stopped.
0x1044dfd8 (T2): fatal kernel task-level exception!

您有一个变量 int task_1 以及一个同名函数 void task_1(void)。因此,当您打算将函数指针作为参数传递给 taskSpawn 时,您实际上传递的是 int 变量 task_1。这会导致您在分配 task_1 之前使用它的警告。

您应该更改其中一项的名称,以免发生冲突。

int task_id_1, task_id_2, task_id_3, msgQueueId;

task_id_1 = taskSpawn(..., (FUNCPTR)task_1, ...);