How to provide main task?

Thomas Doerfler Thomas.Doerfler at imd-systems.de
Mon Oct 20 10:28:42 UTC 2003


Hello Leon,

I think the module "dummy.o" should NEVER be 
pulled into a real application. The reason that 
might lead to it being pulled in might be, that 
you define your configuration table (inside of 
"confdefs.h" in a C++ context. 

So maybe (i never used C++ in RTEMS) you should 
surround your "include confdefs.h" with a extern 
"C" wrapper?

wkr,
	Thomas.


> 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

--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler           Herbststrasse 8
D-82178 Puchheim          Germany
email:    Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_keys.htm




More information about the users mailing list