对P2020RDB-PC目标使用VxWorks 653 2.5.0.2,使用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:ProjectsWindRiverhelloWorldboot.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:ProjectsWindRiverhelloWorldboot.txt
sm0=D:ProjectsWindRiverhelloWorldconfigRecord.reloc
0x00001a00 + (0x000fe600)
sm1=D:ProjectsWindRiverhelloWorldcoreOS.sm
0x00050e08 + 0x00007130 + 0x00006084 + 0x00015cac
sm2=D:ProjectsWindRiverhelloWorldvxSysLib.sm
0x00031078 + 0x00004b20 + 0x00000918 + 0x00001d90
sm3=D:ProjectsWindRiverhelloWorldfsl_p2020_rdb_part1.sm
0x000027c8 + 0x000000d0 + 0x00000010 + 0x00000008
Starting at 0x100000...
在这之后,它返回开始并永远重复这个过程
因此,如果有其他人带着类似的问题来这里,在我的情况下,有两件主要的事情会影响功能。
首先,在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);
}