Trouble compiling and linking a simple app

Joel Sherrill joel.sherrill at oarcorp.com
Wed Sep 3 23:17:32 UTC 2014


CC'ing Daniel Hellstrom since I think these are Aeroflex Gaisler tools.


On 9/3/2014 4:49 PM, Ricardo Derbes wrote:
> Hello, this is a newbie's question:
>
> I'm having trouble trying to build a test application using RTEMS
> 4.10.2 for a sparc (erc32) project.
> I have downloaded sparc-rtems-4.10 toolchain rpm's and installed them
> using yum on my OS (fedora20 x86-64), downloaded
> rtems-4.10.2 and ran bootstrap, configure & make install without a glitch.
> My configuration options are:
> --target=sparc-rtems4.10 \
> --disable-multiprocessing \
> --disable-posix \
> --disable-itron \
> --disable-networking \
> --disable-cxx \
> --enable-rtems-debug \
> --enable-tests \
> --enable-rtemsbsp=erc32 \
> --prefix=/home/dev/rtems/
> rtemsproduct_erc32 \
> CFLAGS_FOR_TARGET='-mcpu=cypress -g -O4'
>
> From installed directory
> /home/dev/rtems/rtemsproduct_erc32/sparc-rtems4.10/erc32/lib, I've
> copied librtemscpu.a, librtemsbsp.a, linkcmds, linkcmds.base,
> start.o and include/ directory to my workspace lib/ directory
>
> I wrote a short test application:
>
> #define CONFIGURE_INIT
> #include "system.h"
> #include <stdio.h>
> rtems_task Init(rtems_task_argument ignored)
> {
>     uint32_t count = 0;
>     while(1)
>     {
>         printf("%lu: Hello world, I'm an erc32 application!  \n", count);
>         count++;
>         rtems_task_wake_after(100);
>     }
>     rtems_task_delete(RTEMS_SELF);
> }
>
> where system.h is:
>
> #include <rtems.h>
> #include <bsp.h>
>
> #ifndef SYSTEM_H_
> #define SYSTEM_H_
>
> #define STACK_SIZE_MULTIPLIER 2
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_MAXIMUM_TASKS             11
> #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES    20
> #define CONFIGURE_MAXIMUM_SEMAPHORES        25
> #define CONFIGURE_MAXIMUM_PARTITIONS        1
> #define CONFIGURE_MAXIMUM_PERIODS           10
> #define CONFIGURE_MICROSECONDS_PER_TICK     10000
> #define CONFIGURE_EXTRA_TASK_STACKS         (CONFIGURE_MAXIMUM_TASKS *
> ((RTEMS_MINIMUM_STACK_SIZE *
> STACK_SIZE_MULTIPLIER)-RTEMS_MINIMUM_STACK_SIZE))
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
> #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
>
> #include <rtems/confdefs.h>
> rtems_task Init(rtems_task_argument argument);
> #endif /* SYSTEM_H_ */
>
>
> Compilation -> raises some warnings:
> sparc-rtems-gcc -I../lib/include -O0 -g3 -Wall -Wextra -c
> -fmessage-length=0 -MMD -MP -MFmain.d -MTmain.d -o main.o ../main.c

This looks like you are using the Aeroflex tools and I don't know the
invocation
for them. My guess is that you didn't specify a BSP to link against.

I don't recall ever seeing those warnings in object.inl on the community
source.

> In file included from ../lib/include/rtems/score/object.h:898,
>                  from ../lib/include/rtems/rtems/types.h:28,
>                  from ../lib/include/rtems.h:50,
>                  from ../system.h:7,
>                  from ../main.c:8:
> ../lib/include/rtems/score/object.inl: In function '_Objects_Is_local_id':
> ../lib/include/rtems/score/object.inl:165: warning: unused parameter 'id'
> ../lib/include/rtems/score/object.inl: In function '_Objects_Open_string':
> ../lib/include/rtems/score/object.inl:337: warning: unused parameter 'name'
> ../main.c: In function 'Init':
> ../main.c:12: warning: unused parameter 'ignored'
>
> Linking:
> sparc-rtems-gcc -L/opt/rtems-4.10/lib/gcc/sparc-rtems4.10/4.4.7
> -L/opt/rtems-4.10/sparc-rtems4.10/lib -L../lib -T ../lib/linkcmds -e
> start -Wl,--start-group -lgcc -lrtemscpu -lrtemsbsp -Wl,--end-group -o
> erc32Project  ./main.o ../lib/start.o
> ./main.o: In function `Init':
> /home/dev/workspace/erc32Project/Debug/../main.c:19: undefined
> reference to `rtems_task_wake_after'
> ./main.o:(.data+0x20): undefined reference to `bsp_boot_cmdline'
> ./main.o:(.data+0x24): undefined reference to `console_initialize'
> ./main.o:(.data+0x28): undefined reference to `console_open'
> ./main.o:(.data+0x2c): undefined reference to `console_close'
> ./main.o:(.data+0x30): undefined reference to `console_read'
> ./main.o:(.data+0x34): undefined reference to `console_write'
> ./main.o:(.data+0x38): undefined reference to `console_control'
> ./main.o:(.data+0x3c): undefined reference to `Clock_initialize'
> ./main.o:(.data+0x54): undefined reference to `newlib_create_hook'
> ./main.o:(.data+0x60): undefined reference to `newlib_delete_hook'
> ./main.o:(.data+0xc0): undefined reference to `bsp_idle_thread'
> ./main.o:(.data+0xec): undefined reference to
> `_RTEMS_tasks_Initialize_user_tasks_body'
> ../lib/start.o: In function `trap_table':
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:64:
> undefined reference to `window_overflow_trap_handler'
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:64:
> undefined reference to `window_overflow_trap_handler'
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:65:
> undefined reference to `window_underflow_trap_handler'
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:65:
> undefined reference to `window_underflow_trap_handler'
> ../lib/start.o: In function `CLOCK_SPEED':
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:158:
> undefined reference to `syscall'
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:158:
> undefined reference to `syscall'
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:160:
> undefined reference to `window_flush_trap_handler'
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:160:
> undefined reference to `window_flush_trap_handler'
> ../lib/start.o: In function `zerobss':
> /home/dev/rtems/rtems-4.10.2/c/src/lib/libbsp/sparc/erc32/../../sparc/shared/start.S:333:
> undefined reference to `boot_card'
> collect2: ld returned 1 exit status
>
> In cannot find what I am doing wrong, please help
> Thank you very much
>
> Ricardo
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985




More information about the users mailing list