0

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

在此之后,它返回开始并永远重复该过程

4

1 回答 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);
}
于 2020-05-12T16:43:07.573 回答