Problems upgrading a BSP from RTEMS 4.5 to 4.6.2

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Thu May 19 13:41:10 UTC 2005


Shadi T. Khasawneh wrote:
> Hello all,
> 
> Thanks in advance for any help and suggestions.
> 
> I'm working on a research project using the RTEMS 4.6.2 on a RAMiX PMC694
> card. The BSP is working fine under the 4.5, but the RTEMS is not
> compiling under the 4.6.2.
> 
> This is what I have done so far (Please let me know if there is a better
> way do do it):
> 1) Copied the old pmc694.cfg into make/custom, and modifed it to reflect
> the new changes in 4.6.2 (based on some posts on this list).
> 2) Added the pmc694.cfg into make/custom/Makefile.am
> 3) Copied the pmc694 folder into c/src/lib/libbsp/powerpc/pmc694
> 3) Modifed the bsp_specs in pmc694/ to reflect the changes.
> 4) Created new Makefile.am and configure.ac files in pmc694/ and
> Makefile.am files in the subfolders (the old version only had Makefile.in
> files).
> 5) I have made a lot of changes/fixes to the Makefiles, and at the end I'm
> stuck with the following error:

There are a lot of tool differences between 4.5 and 4.6.2.  I assume
you upgraded tools.

This would also be a nice BSP to be submitted against the CVS head.

> gmake[5]: Entering directory
> `/shadi/rtems/bb/powerpc-rtems/c/pmc694/tests/samples/hello'
> mkdir o-optimize
> mkdir -p -- ../../../../../pmc694/tests
> powerpc-rtems-gcc --pipe -B../../../../../lib/
> -B../../../../../pmc694/lib/ -specs bsp_specs -qrtems
> -DPACKAGE_NAME=\"rtems-c-src-tests-samples\"
> -DPACKAGE_TARNAME=\"rtems-c-src-tests-samples\"
> -DPACKAGE_VERSION=\"4.6.2\" -DPACKAGE_STRING=\"rtems-c-src-tests-samples\
> 4.6.2\" -DPACKAGE_BUGREPORT=\"rtems-bugs at rtems.com\"    -isystem
> ../../../../../pmc694/lib/include     -mcpu=603e
> -DDONT_OFFLOAD_RX_CHECKSUM -DDONT_OFFLOAD_TX_CHECKSUM -Dppc603e  -O4
> -fno-keep-inline-functions -g -Wall -ansi -fasm  -o o-optimize/init.o -c
> ../../../../../../../rtems-4.6.2/c/src/tests/samples/hello/init.c
> powerpc-rtems-gcc --pipe -B../../../../../lib/
> -B../../../../../pmc694/lib/ -specs bsp_specs -qrtems    -mcpu=603e
> -DDONT_OFFLOAD_RX_CHECKSUM -DDONT_OFFLOAD_TX_CHECKSUM -Dppc603e  -O4
> -fno-keep-inline-functions -g -Wall -ansi -fasm 
> -Wl,-Map,o-optimize/hello.map -o o-optimize/hello.elf o-optimize/init.o
> ../../../../../pmc694/lib/no-dpmem.rel
> ../../../../../pmc694/lib/no-event.rel
> ../../../../../pmc694/lib/no-msg.rel ../../../../../pmc694/lib/no-mp.rel
> ../../../../../pmc694/lib/no-part.rel
> ../../../../../pmc694/lib/no-signal.rel
> ../../../../../pmc694/lib/no-timer.rel
> ../../../../../pmc694/lib/no-rtmon.rel
> /opt/rtems-4.6/lib/gcc-lib/powerpc-rtems/3.2.3/../../../../powerpc-rtems/bin/ld:
> warning: no memory region specified for section `.eh_frame'

missing section in linkcmds.

> ../../../../../pmc694/lib/librtemsbsp.a(bootcard.o): In function `boot_card':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/lib/libbsp/powerpc/pmc694/startup/../../../../../../../../../rtems-4.6.2/c/src/lib/libbsp/powerpc/pmc694/startup/bootcard.c:128:
> undefined reference to `main'
> ../../../../../pmc694/lib/librtemsbsp.a(Hwr_init.o): In function `init_BAT':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/lib/libbsp/powerpc/pmc694/startup/../../../../../../../../../rtems-4.6.2/c/src/lib/libbsp/powerpc/pmc694/startup/Hwr_init.c:149:
> undefined reference to `rxPciConfWrite'
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/lib/libbsp/powerpc/pmc694/startup/../../../../../../../../../rtems-4.6.2/c/src/lib/libbsp/powerpc/pmc694/startup/Hwr_init.c:151:
> undefined reference to `rxPciConfWrite'
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/lib/libbsp/powerpc/pmc694/startup/../../../../../../../../../rtems-4.6.2/c/src/lib/libbsp/powerpc/pmc694/startup/Hwr_init.c:159:
> undefined reference to `rxPciConfWrite'

These are not in RTEMS AFAIK so I suspect you are not managing to
link against both librtemscpu and librtemsbsp

> ../../../../../pmc694/lib/librtemscpu.a(exinit.o): In function
> `rtems_initialize_executive_early':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/sapi/../../../../../../rtems-4.6.2/cpukit/sapi/src/exinit.c:151:
> undefined reference to `_CPU_Initialize'
> ../../../../../pmc694/lib/librtemscpu.a(exinit.o): In function
> `rtems_shutdown_executive':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/sapi/../../../../pmc694/lib/include/rtems/score/thread.inl:32:
> undefined reference to `_CPU_Context_switch'

Hmmmm... double check your BSP configuratin and Makefile's against a BSP 
using the same exception model.  This indicates you are missing
getting the code in either libbsp/powerpc/support/... .  And I warn you
now that "old exception processing" is gone for all PowerPC CPUs except
4xx on the CVS head.

> ../../../../../pmc694/lib/librtemscpu.a(interr.o): In function
> `_Internal_error_Occurred':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/score/../../../../../../rtems-4.6.2/cpukit/score/src/interr.c:57:
> undefined reference to `_BSP_Fatal_error'
> ../../../../../pmc694/lib/librtemscpu.a(intrcatch.o): In function
> `rtems_interrupt_catch':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/rtems/../../../../../../rtems-4.6.2/cpukit/rtems/src/intrcatch.c:51:
> undefined reference to `BSP_panic'

More PowerPC shared code you are missing.

> ../../../../../pmc694/lib/librtemscpu.a(threadhandler.o): In function
> `_Thread_Handler':
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/score/../../../../../../rtems-4.6.2/cpukit/score/src/threadhandler.c:112:
> undefined reference to `_init'
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/score/../../../../../../rtems-4.6.2/cpukit/score/src/threadhandler.c:112:
> undefined reference to `_init'
> /shadi/rtems/bb/powerpc-rtems/c/pmc694/exec/score/../../../../../../rtems-4.6.2/cpukit/score/src/threadhandler.c:113:
> undefined reference to `_init'

Doesn't look like you have .init/.fini sections of the rtems_crti/crtn 
code included

> collect2: ld returned 1 exit status
> gmake[5]: *** [o-optimize/hello.exe] Error 1
> gmake[5]: Leaving directory
> `/shadi/rtems/bb/powerpc-rtems/c/pmc694/tests/samples/hello'
> gmake[4]: *** [all-recursive] Error 1
> gmake[4]: Leaving directory
> `/shadi/rtems/bb/powerpc-rtems/c/pmc694/tests/samples'
> gmake[3]: *** [all-recursive] Error 1
> gmake[3]: Leaving directory `/shadi/rtems/bb/powerpc-rtems/c/pmc694/tests'
> gmake[2]: *** [all-recursive] Error 1
> gmake[2]: Leaving directory `/shadi/rtems/bb/powerpc-rtems/c/pmc694'
> gmake[1]: *** [all-recursive] Error 1
> gmake[1]: Leaving directory `/shadi/rtems/bb/powerpc-rtems/c'
> gmake: *** [all-recursive] Error 1
> 
> -------------------------------------------------------------------------
> => bsp_specs (modified file):
> %rename lib old_lib
> %rename endfile old_endfile
> %rename startfile old_startfile
> %rename link old_link
> 
> *lib:
> %{!qrtems: %(old_lib)} %{!nostdlib: %{qrtems: --start-group \
> %{!qrtems_debug: -lrtemsbsp -lrtemscpu} %{qrtems_debug: -lrtemsbsp_g
> -lrtemscpu_g} \
> -lc -lgcc --end-group \
> %{!qnolinkcmds: -T linkcmds%s}}}
> 
> *startfile:
> %{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems:  ecrti%O%s \
> %{!qrtems_debug: start.o%s} \
> %{qrtems_debug: start_g.o%s}}}
> 
> *endfile:
> %{!qrtems: %(old_endfile)} %{qrtems: ecrtn%O%s}
> 
> *link:
> %{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -e _start -u __vectors}
> 
> 
> --------------------------------------------------------------------------
> 
> => pmc694.cfg (modified file)
> 
> #
> #  Config file for a MPC8240 based RAMiX PMC694 intelligent ethernet card.
> #
> #  $Id: pmc694.cfg,v 1.1 2002/02/11 10:09:21 johnc Exp $
> #
> 
> RTEMS_CPU=powerpc
> RTEMS_CPU_MODEL=ppc603e
> #PROJECT_TOOLS=$(PROJECT_ROOT)/c/build-tools/scripts
> 
> 
> # This is the actual bsp directory used during the build process.
> RTEMS_BSP_FAMILY=pmc694
> RTEMS_BSP=pmc694
> 
> include $(RTEMS_ROOT)/make/custom/default.cfg
> 
> #
> # We can use DEFINES to enable debugging macros
> #
> DEFINES = # -DDEBUG_INCR
> 
> #  This section makes the target dependent options file.
> 
> #  NDEBUG (C library)
> #     if defined asserts do not generate code.  This is commonly used
> #     as a command line option.
> #
> #  RTEMS_TEST_NO_PAUSE (RTEMS tests)
> #     do not pause between screens of output in the rtems tests
> #
> #  STACK_CHECKER_ON (RTEMS support code)
> #     If defined, stack bounds checking is enabled.
> #
> #  STACK_CHECKER_REPORT_USAGE (RTEMS support code)
> #     If this and STACK_CHECKER_ON are defined, then a report on stack usage
> #     per task is printed when the program exits.
> #
> #  RTEMS_DEBUG (RTEMS)
> #     If defined, debug checks in RTEMS and support library code are enabled.
> #
> #  CONSOLE_USE_INTERRUPTS (pmc694_bsp)
> #     The pmc694 console driver has the structure to operate in either
> #     polled or interrupt mode.  However both modes only trap to the
> #     monitor currently.
> #
> #  PPC_USE_DATA_CACHE (RTEMS PowerPC port)
> #     If defined, then the PowerPC specific code in RTEMS will use
> #     data cache instructions to optimize the context switch code.
> #     This code can conflict with debuggers or emulators.
> #
> #  PPC_VECTOR_FILE_BASE (ppc)
> #     This defines the base address of the exception table.
> #     NOTE: Vectors are actually at 0xFFF00000 but file starts at offset
> 0x0100
> #
> #  PPC_ABI (ppc)
> #     This defines the calling convention (Application Binary Interface)
> #     used in this configuration.  EABI is the only one supported.
> #
> #  PPC_ASM (ppc)
> #     This defines the assembly language format used in this configuration.
> #     ELF is the only one supported.
> #
> #  PPC_USE_SPRG (RTEMS PowerPC port)
> #     If defined, then the PowerPC specific code in RTEMS will use some
> #     of the special purpose registers to slightly optimize interrupt
> #     response time.  The use of these registers can conflict with
> #     other tools like debuggers.
> #
> 
> define make-target-options
>         @echo "/* #define NDEBUG 1 */ "                              >>$@
>         @echo "#define RTEMS_TEST_NO_PAUSE 1"                        >>$@
>         @echo "/* #define STACK_CHECKER_ON  1 */"                         
> 
>>>$@
> 
>         @echo "/* #define STACK_CHECKER_REPORT_USAGE  1 */"               
> 
>>>$@
> 
>         @echo "/* #define RTEMS_DEBUG  1 */"                         >>$@
>         @echo "#define CONSOLE_USE_INTERRUPTS 4"                     >>$@
>         @echo "#define INITIALIZE_COM_PORTS 1"                       >>$@
>         @echo "#define PPC_USE_DATA_CACHE 0"                         >>$@
>         @echo "#define PPC_VECTOR_FILE_BASE 0x0100"                  >>$@
>         @echo "#define PPC_ABI PPC_ABI_EABI"                         >>$@
>         @echo "#define PPC_ASM PPC_ASM_ELF"                          >>$@
>         @echo "#define PPC_USE_SPRG  0"                              >>$@
> endef
> 
> #  This contains the compiler options necessary to select the CPU model
> #  and (hopefully) optimize for it.
> #
> # Modified by Shailesh to disable DMA Copying..
> CPU_CFLAGS = -mcpu=603e \
>                         -DDONT_OFFLOAD_RX_CHECKSUM
> -DDONT_OFFLOAD_TX_CHECKSUM -Dppc603e
> 
> #CPU_CFLAGS = -mcpu=603 \
> #                       -DDONT_OFFLOAD_RX_CHECKSUM
> -DDONT_OFFLOAD_TX_CHECKSUM \
> #                       -DNO_USERSPACE_COPY
> 
> 
> # optimize flag: typically -0, could use -O4 or -fast
> # -O4 is ok for RTEMS
> # NOTE: some level of -O may be actually required by inline assembler
> CFLAGS_OPTIMIZE_V=-O4 -fno-keep-inline-functions
> # CFLAGS_OPTIMIZE_V=-O0
> 
> # This target does not support the ka9q tcp/ip stack so ignore requests
> # to enable it.
> HAS_NETWORKING=yes
> 
> # The following is a linkcmds file which will work without using the
> # -specs system in gcc 2.8.
> #       $(LD) $(XLDFLAGS) -T $(LINKCMDS) \
> #         -o $@ -u atexit -u __vectors -u download_entry $(LINK_FILES)
> #       $(LD) $(XLDFLAGS) -Ttext 0x20000 \
> #         -o $@ -u atexit -u __vectors -u download_entry $(LINK_FILES)
> 
> #ifeq ($(RTEMS_USE_GCC272),yes)
> #define make-exe
> #       @echo gcc 2.7.2 style linking not supported by score603e
> #       @exit 1
> #endef
> #else
> define make-exe
>         $(CC) $(CPPFLAGS) $(CFLAGS) -Wl,-Map,$(basename $@).map \
>         -o $(basename $@).elf $(LINK_OBJS) $(LINK_LIBS)
>         $(NM) -g -n $(basename $@).elf > $(basename $@).num
>         $(SIZE) $(basename $@).elf
>         $(OBJCOPY) -O binary $(basename $@).elf $(basename $@).bin
>         sed -e 's/.$$//' $(basename $@).bin | \
>           $(PACKHEX) >$(basename $@).exe
>         #rm -f $(basename $@).s1
>         rm -f *.o
> endef
> 
> #define make-exe
> #        ar x $(PROJECT_ROOT)/$(RTEMS_BSP_FAMILY)/lib/libbsp.a
> #        $(LD) -u _sbrk $(LDFLAGS) -Map $(basename $@).map -N -T
> $(LINKCMDS) -o $(basename $@).exe \
> #             $(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS)
> --end-group
> #        $(NM) -g -n $(basename $@).exe > $(basename $@).num
> #        $(LD) -u _sbrk $(LDFLAGS) -oformat binary -N -T $(LINKCMDS) -o
> $(basename $@).bin \
> #             $(START_FILE) $(LINK_OBJS) --start-group $(LINK_LIBS)
> --end-group
> #        $(SIZE) $(basename $@).exe
> #        rm -f *.o
> #endef
> 
> #endif
> 
> # Miscellaneous additions go here
> 
> # No start file
> START_BASE=
> 
> DRIVER_ARCHITECTURE=
> 
> -------------------
> 
> Thanks,
> 
> Shadi
> 
> ______________________________________
> Shadi T. Khasawneh
> Graduate Research Associate/Endicott Interconnect Technologies
> Department of Computer Science
> State University of New York at Binghamton
> P.O. Box 6000
> Binghamton, New York 13902-6000
> 
> E-mail: skhasaw1 at binghamton.edu
> 


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel 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