VxWorks 653 在 START 命令后重新启动

VxWorks 653 Restart after START command

使用 VxWorks 653 2.5.0.2 作为 P2020RDB-PC 目标,使用 BSP1.0/4

我有一个非常简单的测试应用程序

void usrAppInit (void)
{
RETURN_CODE_TYPE errCode;

printf("\n I am alive!");

PROCESS_ATTRIBUTE_TYPE processAttributes;
PROCESS_ID_TYPE thandle;
processAttributes.BASE_PRIORITY = 10;
processAttributes.DEADLINE = SOFT;
processAttributes.ENTRY_POINT = (SYSTEM_ADDRESS_TYPE)task;
strncpy(processAttributes.NAME, "TASK", MAX_NAME_LENGTH);
processAttributes.PERIOD = INFINITE_TIME_VALUE;
processAttributes.STACK_SIZE = 1024;
processAttributes.TIME_CAPACITY = INFINITE_TIME_VALUE;
CREATE_PROCESS(&processAttributes, &thandle, &errCode);

if(errCode != NO_ERROR)
{
  printf("Just had an error creating the task: %d", errCode);
}

else
{
  START(thandle, &errCode);
  if(errCode != NO_ERROR)
  {
    printf("Just had an error starting the task: %d", errCode);
  }
}

SET_PARTITION_MODE (NORMAL, &errCode);
if (errCode != NO_ERROR){
  printf("\nError changing partition mode: %d", errCode);
}
while(1);

}

void task()
{
  printf("\nI am a process.");
  while(1);
}

当程序到达 START 行时,它会重新启动。如果我注释掉 START 行,它会一直执行到 main 结束并且显然什么都不做。我尝试增加分区内存,并将 APEX 组件添加到 makefile。 可能是什么原因造成的?

PS: 系统输出

VxWorks 653 System Boot

Copyright (c) 1984-2016 Wind River Systems, Inc.

CPU: Freescale P2020E - Security Engine
Version: 2.5.0.2
BSP version: 1.0/4
Creation date: Apr 29 2020, 15:00:10

Press any key to stop auto-boot...
0
auto-booting...

boot device : mottsec
unit number : 0
processor number : 0
host name : felipe
file name : D:\Projects\WindRiver\helloWorld\boot.txt
inet on ethernet (e) : 192.168.1.172
host inet (h) : 192.168.1.75
gateway inet (g) : 192.168.1.1
user (u) : felipe
ftp password (pw) : pass
flags (f) : 0x0
target name (tn) : board

Attached TCP/IP interface to mottsec0.
Warning: netmask value is 0.
Attaching interface lo0...done
Loading D:\Projects\WindRiver\helloWorld\boot.txt

sm0=D:\Projects\WindRiver\helloWorld\configRecord.reloc
0x00001a00 + (0x000fe600)

sm1=D:\Projects\WindRiver\helloWorld\coreOS.sm
0x00050e08 + 0x00007130 + 0x00006084 + 0x00015cac

sm2=D:\Projects\WindRiver\helloWorld\vxSysLib.sm
0x00031078 + 0x00004b20 + 0x00000918 + 0x00001d90

sm3=D:\Projects\WindRiver\helloWorld\fsl_p2020_rdb_part1.sm
0x000027c8 + 0x000000d0 + 0x00000010 + 0x00000008
Starting at 0x100000...

在此之后,它returns从头开始并一直重复这个过程

因此,如果其他人遇到类似问题来到这里,就我而言,有两个主要因素会影响功能。

首先,在usrAppInit()函数中,不能在函数末尾定义while(1)循环。与其他 ARINC-653 系统相反,分区主分区与用户主分区相同,对于 VxWorks 似乎并非如此。这样,在SET_PARTITION_MODE之后,就不能再定义其他了。

其次,进程的堆栈大小太小。这非常适合不同的目标和 ARINC RTOS(内部 OS,在 ARMv7 目标上执行),但对于 P2020 目标上的 VxWorks,它需要更大的堆栈。在本例中,我使用了 4096。

这是完整的示例代码,现在可以使用,以备不时之需。

void usrAppInit (void)
{
RETURN_CODE_TYPE errCode;

printf("\n I am alive!");

PROCESS_ATTRIBUTE_TYPE processAttributes;
PROCESS_ID_TYPE thandle;
processAttributes.BASE_PRIORITY = 10;
processAttributes.DEADLINE = SOFT;
processAttributes.ENTRY_POINT = (SYSTEM_ADDRESS_TYPE)task;
strncpy(processAttributes.NAME, "TASK", MAX_NAME_LENGTH);
processAttributes.PERIOD = INFINITE_TIME_VALUE;
processAttributes.STACK_SIZE = 4096;
processAttributes.TIME_CAPACITY = INFINITE_TIME_VALUE;
CREATE_PROCESS(&processAttributes, &thandle, &errCode);

if(errCode != NO_ERROR)
{
  printf("Just had an error creating the task: %d", errCode);
}

else
{
  START(thandle, &errCode);
  if(errCode != NO_ERROR)
  {
    printf("Just had an error starting the task: %d", errCode);
  }
}

SET_PARTITION_MODE (NORMAL, &errCode);
if (errCode != NO_ERROR){
  printf("\nError changing partition mode: %d", errCode);
}

}

void task()
{
  printf("\nI am a process.");
  while(1);
}