VxWorks 653 START命令后重新启动。

问题描述 投票:0回答:1

使用VxWorks 653 2.5.0.2用于P2020RDB-PC目标,使用BSP1.04。

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

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结束,显然什么也不做。我试着增加了分区内存,并且在makefile中加入了APEX组件。是什么原因造成了这种情况?

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...

在这之后,它将返回到起点,并永远重复这个过程。

rtos vxworks arinc
1个回答
0
投票

所以,如果有其他人遇到类似的问题,在我的例子中,有两个主要的东西影响了功能。

首先,在usrAppInit()函数中,不能在函数末尾定义while(1)循环。在其他 ARINC-653 系统中,分区主函数和用户主函数是一样的,而在 VxWorks 中,似乎不是这样的。这样,在SET_PARTITION_MODE之后,就不能再定义其他的东西了。

其次,进程的栈大小太小。这对于不同的目标和ARINC RTOS(内部操作系统,在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);
}
© www.soinside.com 2019 - 2024. All rights reserved.