VxWorks 653 Restart after START command

0

Using VxWorks 653 2.5.0.2 for P2020RDB-PC target, using BSP1.0/4

I have a very simple test application

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);
}

When the program gets to the START line, it reboots. If I comment out the START line, it executes till the end of the main and obviously does nothing. I have tried to increase partition memory and I am adding the APEX components to the makefile. What could be causing this?

PS: system output

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

After this, it returns to the beggining and repeats the process forever

rtos
vxworks
arinc
asked on Stack Overflow May 10, 2020 by Felipe GM • edited May 12, 2020 by Felipe GM

1 Answer

0

So, in case anyone else drops here with similar issue, in my case there were two main things affecting the functionality.

First, in the usrAppInit() function, one cannot define the while(1) loop in the end of the function. On opposite to other ARINC-653 systems, where the partition main is the same as the user main, for VxWorks it does not seems to be the case. This way, after SET_PARTITION_MODE, nothing else can be defined.

Second, the stack size for the process was too small. That fit perfectly for different targets and ARINC RTOS (in-house OS, executing on ARMv7 target), but for VxWorks on the P2020 target it requires a bigger stack. In this case, I've used 4096.

Here is the complete example code, now functional, in case anyone needs this.

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);
}
answered on Stack Overflow May 12, 2020 by Felipe GM

User contributions licensed under CC BY-SA 3.0