<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I am creating a c++ rtems application. I have already been able to run a hello world application. In my current application, I declare a class object in the task function. This class has been defined in other .h and .cpp files which have been included in
the current application. The application compiles successfully but when I run the application, I get the following error:</p>
<p><br>
</p>
<p></p>
<div>I am in Init <br>
declaring class object
<br>
<br>
*** FATAL *** <br>
fatal source: 1 (INTERNAL_ERROR_RTEMS_API) <br>
fatal code: 4026597379 (0xf0010003) <br>
RTEMS version: 5.0.0.f3e0c73594aee72ba32eccf1c622364a8e72fda4 <br>
RTEMS tools: 7.4.1 20190514 (RTEMS 5, RSB cd67edb7ca371c79b72223496393813457afd)<br>
executing thread ID: 0x08a010002 <br>
executing thread name: APP1 <br>
</div>
<div><br>
</div>
<div>To verify if it is not the problem in declaration, I created a test class in .h and .cpp file which I am including. If I declare this class object, the app compiles and runs successfully. I think, there might be a problem in this particular class but how
can I find this problem. Does the fatal code gives me a hint? Here is my source code:</div>
<div><br>
</div>
<div>
<div>#include <rtems.h><br>
#include <stdio.h><br>
#include <stdlib.h><br>
#include <unistd.h><br>
#include <myapp.h><br>
<br>
rtems_task user_application(rtems_task_argument argument);<br>
<br>
//class test1{<br>
//<br>
//public:<br>
// test1()<br>
// {<br>
// printf("constructor created\n");<br>
// }<br>
//};<br>
extern "C" {<br>
rtems_task Init(<br>
rtems_task_argument ignored<br>
);<br>
};<br>
rtems_task Init(<br>
rtems_task_argument ignored<br>
)<br>
{<br>
rtems_id tid;<br>
rtems_status_code status;<br>
rtems_name name;<br>
<br>
name = rtems_build_name( 'A', 'P', 'P', '1' );<br>
<br>
status = rtems_task_create(<br>
name, 1, RTEMS_MINIMUM_STACK_SIZE,<br>
RTEMS_PREEMPT, RTEMS_FLOATING_POINT, &tid<br>
);<br>
if ( status != RTEMS_SUCCESSFUL ) {<br>
printf( "rtems_task_create failed with status of %d.\n", status );<br>
exit( 1 );<br>
}<br>
printf("I am in Init\n");<br>
status = rtems_task_start( tid, user_application, 0 );<br>
if ( status != RTEMS_SUCCESSFUL ) {<br>
printf( "rtems_task_start failed with status of %d.\n", status );<br>
exit( 1 );<br>
}<br>
sleep(10);<br>
status = rtems_task_delete( tid ); /* should not return */<br>
<br>
printf( "rtems_task_delete returned with status of %d.\n", status );<br>
exit( 1 );<br>
}<br>
<br>
rtems_task user_application(rtems_task_argument argument)<br>
{<br>
<br>
printf("declaring spw device\n");<br>
usleep(50);<br>
MyClass obj;<br>
/* application specific initialization goes here */<br>
while ( 1 ) { /* infinite loop */<br>
/* APPLICATION CODE GOES HERE<br>
*<br>
* This code will typically include at least one<br>
* directive which causes the calling task to<br>
* give up the processor.<br>
*/<br>
printf("Hello\n");<br>
int x = sleep(1);<br>
printf("%d\n", x);<br>
}<br>
}<br>
<br>
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER<br>
/* The Clock Driver supplies the clock tick. */<br>
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>
#define CONFIGURE_MAXIMUM_TASKS 4<br>
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'E', 'X', 'A', 'M' )<br>
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE<br>
#define CONFIGURE_INIT<br>
#include <rtems/confdefs.h></div>
</div>
<div><br>
</div>
<div>Regards</div>
<div>Vishav<br>
</div>
<br>
<p></p>
</div>
</body>
</html>