How to provide main task?
Leon Pollak
leonp at plris.com
Mon Oct 20 10:15:59 UTC 2003
Hello.
This must be primitive, but I do not succeed to follow the structure of
includes...
I created C++ application with the following main.cpp content:
------------------------------------------
#define CONFIGURE_INIT
#include "system.h"
#include <stdio.h>
#include <confdefs.h>
#undef CONFIGURE_INIT
#include <rtems.h>
extern "C" {
rtems_task Init(rtems_task_argument);
}
rtems_task Init( rtems_task_argument ){
printf( "\n*** My Main Init Task Entry. ***\n" );
while(1);
}
------------------------------------------
The system.h file contains:
extern "C" {
rtems_task Init(rtems_task_argument);
}
#include <bsp.h> /* for device driver prototypes */
/* #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER */
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_ENTRY_POINT Init
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R')
#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_TICKS_PER_TIMESLICE 1
#include <confdefs.h>
------------------------------------------------
The problem is that linker says:
powerpc-rtems-g++ -B/opt/rtems/powerpc-rtems/mybsp/ -specs bsp_specs \
-qrtems -mcpu=860 -Dmpc860 -qrtems_debug -Wno-unused -ggdb -g \
-Wall -ansi -fasm -qnolinkcmds -o op /opt/FDR/OP/Build/main.o \
-T linkcmds -Xlinker -Map -Xlinker map.map
/opt/rtems/rtems-bin/powerpc-rtems/FDR_GEN/lib/librtemscpu_g.a(dummy.o): In
function `Init':
/opt/rtems/rtems-src/cpukit/libmisc/dummy/dummy.c:23: multiple definition of
`Init'
/opt/FDR/OP/Build//main.o:/opt/FDR/OP/main.cpp:64: first defined here
/opt/rtems/lib/gcc-lib/powerpc-rtems/3.2.2/../../../../powerpc-rtems/bin/ld:
Warning: size of symbol `Init' changed from 40 to 32 in
/opt/rtems/rtems-bin/powerpc-rtems/FDR_GEN/lib/librtemscpu_g.a(dummy.o)
/opt/rtems/rtems-bin/powerpc-rtems/FDR_GEN/lib/librtemscpu_g.a(dummy.o)(.data+0x20):
undefined reference to `main'
Any help will be highly appreciated.
--
leonp at plris dot com
More information about the users
mailing list