Regarding Simple Makefile

robe0413 at flinders.edu.au robe0413 at flinders.edu.au
Mon Jul 17 07:15:42 UTC 2006


Hi, I'm trying to create a very simple makefile to build my application. At
present the application only is a simple hello world program, which will be
extended once I get this working. The configuration is for a i386 CPU and PC104
BSP.

The following is the error I get when I get to compile and link my application
using my makefile.

$ make
/home/vipre/david/rtems-cc/bin/i386-rtems-gcc -c -o init.o init.c
-I/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/
In file included from
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/stdint.h:16,
                 from
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/rtems/rtems/types.h:26,
                 from
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/rtems.h:39,
                 from init.h:6,
                 from init.c:2:
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/rtems/stdint.h:21:
warning: redefinition of `int8_t'
/home/vipre/david/rtems-cc/i386-rtems/include/machine/types.h:18: warning:
`int8_t' previously declared here
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/rtems/stdint.h:22:
warning: redefinition of `int16_t'
/home/vipre/david/rtems-cc/i386-rtems/include/machine/types.h:17: warning:
`int16_t' previously declared here
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/rtems/stdint.h:23:
warning: redefinition of `int32_t'
/home/vipre/david/rtems-cc/i386-rtems/include/machine/types.h:15: warning:
`int32_t' previously declared here
/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/rtems/stdint.h:24:
warning: redefinition of `int64_t'
/home/vipre/david/rtems-cc/i386-rtems/include/machine/types.h:11: warning:
`int64_t' previously declared here
/home/vipre/david/rtems-cc/bin/i386-rtems-gcc -o init init.o
-I/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/
/home/vipre/david/rtems-cc/bin/../lib/gcc-lib/i386-rtems/3.2.3/../../../../i386-rtems/bin/ld:
warning: cannot find entry symbol _start; defaulting to 08048080
init.o(.data+0x4): undefined reference to `miniIMFS_ops'
init.o(.data+0x38): undefined reference to `console_initialize'
init.o(.data+0x3c): undefined reference to `console_open'
init.o(.data+0x40): undefined reference to `console_close'
init.o(.data+0x44): undefined reference to `console_read'
init.o(.data+0x48): undefined reference to `console_write'
init.o(.data+0x4c): undefined reference to `console_control'
/home/vipre/david/rtems-cc/bin/../lib/gcc-lib/i386-rtems/3.2.3/../../../../i386-rtems/lib/libc.a(exit.o):
In function `exit':
/home/vipre/david/rtems/tools/b-gcc/i386-rtems/newlib/libc/stdlib/../../../../../gcc-3.2.3/newlib/libc/stdlib/exit.c:80:
undefined reference to `_exit'
collect2: ld returned 1 exit status
make: *** [init] Error 1


The following is my makefile.
    # Cross compiler
    CC=/home/vipre/david/rtems-cc/bin/i386-rtems-gcc

    # Object files
    OBJ=init.o

    # Dependicies 
    DEP=init.h

    # Executable name
    EXE=init

    # Flags and includes
    CFLAGS=-I/home/vipre/david/rtems-os/i386-rtems/pc386/lib/include/

    %.o: %.c $(DEP)
	$(CC) -c -o $@ $< $(CFLAGS)

    $(EXE): $(OBJ)
    	$(CC) -o $(EXE) $(OBJ) $(CFLAGS)

    clean:
	rm -f $(OBJ) $(EXE)


the main application init.c file

    #include "init.h"

    rtems_task Init(rtems_task_argument arg)
    {
      printf("Hello World\n");
      exit(0);
    }



and finally the header init.h file

    /* c libraries */
    #include <stdio.h>
    #include <stdlib.h>

    /* rtems libraries */
    #include <rtems.h>

    /* initialisation function */
    /*#define CONFIGURE_INIT_TASK_ENTRY_POINT "Init"
    */
    rtems_task Init(rtems_task_argument arg);

    /* configuration information */
    #ifndef CONFIGURE_INIT
    #define CONFIGURE_INIT
    #endif /* CONFIGURE_INIT */
    #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
    #define CONFIGURE_MAXIMUM_TASKS            1
    #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    #include <confdefs.h>


I believe the problem is at the linking stage, but I'm not sure what needs to be
done. I have a look through the documentation will no success and have also
looked at the makefiles of the sample test applications. So if anyone knows
what needs to be done it would be greatly appreciated.

Regards,
David Roberts






More information about the users mailing list