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 16:49:16 UTC 2005


Shadi T. Khasawneh wrote:
>>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.
> 
> 
> I have installed the 4.6.2 version on a new machine, and copying the
> pmc694 files from the old machine with 4.5.0.
> 
> RAMiX (which was bought by GE Fanuc) used to support RTEMS up to 4.5. They
> stopped the support for RTEMS now. They support response was:
> "The RTEMS development for the PMC694 went no further than version 4.5.0
> of the OS. The BSP files that you have a link to is no different from the
> last developed for the device. We have done no furhter development on the
> driver."
> 
> They do support other RTOS's, but we would rather use RTEMS. That's why it
> would be great if pmc694 can be included!

It is up to you (assuming they permit their code to be merged).  Once 
you have tested it on 4.6, you will need to progress to the CVS head.

Once a BSP is in the RTEMS distribution, general maintenance activities
and horizontal changes will include that BSP.  It will continue to build 
although it is possible a horizontal change might have functionality 
broken it.

> The same linkcmds file (startup/linkcmds) was copied from the working 4.5
> version.

The tools are newer and gcc generated more sections.  See some other
PowerPC BSP in the same RTEMS version for where to stick the .eh_frame.

There may be other sections.  New sections are added periodically.  Ralf 
and I just added some to some SH BSPs on the head recently.

> 
>>>../../../../../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'

bootcard.c is now shared. See libbsp/shared/bootcard.c to check for any 
local differences in your BSP and then use the shared.

RTEMS no longer owns the symbol main().  It can be in user space as
it should be.

>>>../../../../../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'

If these are in the BSP, then the wrapup Makefile might not be correct.
Check what is being added to the BSP library to see if it what you think
should be there is.  Then add a -v to the gcc command which links the 
program and make sure you are linking against the libraries you think
you should.

>>These are not in RTEMS AFAIK so I suspect you are not managing to link
> 
> against both librtemscpu and librtemsbsp
> 
> I have already changed it in bsp_specs, is that correct?

It should be being picked up by the tools themselves now.  Try building
another PowerPC BSP that has a CPU model that is close and comparing
against it.

It should NOT be necessary to put "*lib" in the bsp_specs any longer.

> ---------------------------------------
> *lib:
> %{!qrtems: %(old_lib)} %{qrtems: --start-group -lc -lgcc -lrtemsbsp
> -lrtemscpu --end-group}
> ---------------------------------------
> 
> 
>>>../../../../../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.
> 
> 
> 1) In pmc694/Makefile.am (already added the excpetion tag - NOT in 4.5)
> SUBDIRS = .... @exceptions@ wrapup
> 
> 2) in pmc694/configure.ac (RTEMS_PPC_EXCEPTIONS([old]) (already added)

Compare to psim in 4.6.2 then.

> 3) In pmc694/wrapup/Makefile (as in score603e/wrapup/Makefile.am)
> I have added ../@exceptions@/$(ARCH)/*.rel to the end of OBJ
> (I did NOT add this before)
> 
> 4) Executed bootstrap & compiled!
> 
> There error now (after making this changes & other changes mentioned
> elsewhere):
> -----------------------------------------------------------------------
> 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
> -D_OLD_EXCEPTIONS  -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
> -D_OLD_EXCEPTIONS  -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
> ../../../../../pmc694/lib/no-event.rel: In function `s.got':
> no-event.c(*ABS*+0x100064): multiple definition of `_etext'
> no-event.c(*ABS*+0x100064): multiple definition of `_edata'
> ../../../../../pmc694/lib/no-event.rel: In function `_end':
> no-event.c(*ABS*+0x108068): multiple definition of `_end'
> ../../../../../pmc694/lib/no-event.rel: In function `s.got':
> no-event.c(*ABS*+0x100064): multiple definition of `s.got'
> ../../../../../pmc694/lib/no-msg.rel: In function `s.got':
> no-msg.c(*ABS*+0x100214): multiple definition of `_etext'
> no-msg.c(*ABS*+0x100214): multiple definition of `_edata'
> ../../../../../pmc694/lib/no-msg.rel: In function `_end':
> no-msg.c(*ABS*+0x108218): multiple definition of `_end'
> ../../../../../pmc694/lib/no-msg.rel: In function `s.got':
> no-msg.c(*ABS*+0x100214): multiple definition of `s.got'
> ../../../../../pmc694/lib/no-mp.rel: In function `s.got':
> no-mp.c(*ABS*+0x100000): multiple definition of `_etext'
> no-mp.c(*ABS*+0x100000): multiple definition of `_edata'
> ../../../../../pmc694/lib/no-mp.rel: In function `_end':
> no-mp.c(*ABS*+0x108008): multiple definition of `_end'
> ../../../../../pmc694/lib/no-mp.rel: In function `s.got':
> no-mp.c(*ABS*+0x100000): multiple definition of `s.got'
> ../../../../../pmc694/lib/no-signal.rel: In function `s.got':
> no-signal.c(*ABS*+0x100064): multiple definition of `_etext'
> no-signal.c(*ABS*+0x100064): multiple definition of `_edata'
> ../../../../../pmc694/lib/no-signal.rel: In function `_end':
> no-signal.c(*ABS*+0x108068): multiple definition of `_end'
> ../../../../../pmc694/lib/no-signal.rel: In function `s.got':
> no-signal.c(*ABS*+0x100064): multiple definition of `s.got'
> ../../../../../pmc694/lib/no-timer.rel: In function `s.got':
> no-timer.c(*ABS*+0x100154): multiple definition of `_etext'
> no-timer.c(*ABS*+0x100154): multiple definition of `_edata'
> ../../../../../pmc694/lib/no-timer.rel: In function `_end':
> no-timer.c(*ABS*+0x108158): multiple definition of `_end'
> ../../../../../pmc694/lib/no-timer.rel: In function `s.got':
> no-timer.c(*ABS*+0x100154): multiple definition of `s.got'
> ../../../../../pmc694/lib/no-rtmon.rel: In function `s.got':
> no-rtmon.c(*ABS*+0x100150): multiple definition of `_etext'
> no-rtmon.c(*ABS*+0x100150): multiple definition of `_edata'
> ../../../../../pmc694/lib/no-rtmon.rel: In function `_end':
> no-rtmon.c(*ABS*+0x108150): multiple definition of `_end'
> ../../../../../pmc694/lib/no-rtmon.rel: In function `s.got':
> no-rtmon.c(*ABS*+0x100150): multiple definition of `s.got'

I think there is something wrong with your linkcmds OR
the command being used to generate -rel files is wrong.
Try for grins to just use the score603e or psim linkcmds
and see if it fixes it.

> ../../../../../pmc694/lib/librtemsbsp.a(bcopy.o): In function `strlen':
> bcopy.o(.text+0x94): multiple definition of `strlen'
> /opt/rtems-4.6/lib/gcc-lib/powerpc-rtems/3.2.3/../../../../powerpc-rtems/lib/m603e/roe/libc.a(strlen.o):/home/rtems/src/packages/BUILD/rtems-4.6-powerpc-rtems-gcc-newlib-gcc3.2.3newlib1.11.0/build/powerpc-rtems/m603e/roe/newlib/libc/string/../../../../../../../gcc-3.2.3/newlib/libc/string/strlen.c:71:
> first defined here
> ../../../../../pmc694/lib/librtemsbsp.a(bcopy.o): In function `memset':
> bcopy.o(.text+0xac): multiple definition of `memset'
> /opt/rtems-4.6/lib/gcc-lib/powerpc-rtems/3.2.3/../../../../powerpc-rtems/lib/m603e/roe/libc.a(memset.o):/home/rtems/src/packages/BUILD/rtems-4.6-powerpc-rtems-gcc-newlib-gcc3.2.3newlib1.11.0/build/powerpc-rtems/m603e/roe/newlib/libc/string/../../../../../../../gcc-3.2.3/newlib/libc/string/memset.c:65:
> first defined here
> ../../../../../pmc694/lib/librtemsbsp.a(bcopy.o): In function `memmove':
> bcopy.o(.text+0x118): multiple definition of `memmove'

You shouldn't have your own memset in the BSP.

> /opt/rtems-4.6/lib/gcc-lib/powerpc-rtems/3.2.3/../../../../powerpc-rtems/lib/m603e/roe/libc.a(memmove.o):/home/rtems/src/packages/BUILD/rtems-4.6-powerpc-rtems-gcc-newlib-gcc3.2.3newlib1.11.0/build/powerpc-rtems/m603e/roe/newlib/libc/string/../../../../../../../gcc-3.2.3/newlib/libc/string/memmove.c:93:
> first defined here
> ../../../../../pmc694/lib/librtemsbsp.a(rtems-cpu.rel): In function `s.got':
> <built-in>(*ABS*+0x1009bc): multiple definition of `_etext'
> ../../../../../pmc694/lib/librtemsbsp.a(rtems-cpu.rel): In function `_edata':
> <built-in>(*ABS*+0x1009c4): multiple definition of `_edata'
> ../../../../../pmc694/lib/librtemsbsp.a(rtems-cpu.rel): In function `_end':
> <built-in>(*ABS*+0x1089c8): multiple definition of `_end'
> ../../../../../pmc694/lib/librtemsbsp.a(rtems-cpu.rel): In function `s.got':
> <built-in>(*ABS*+0x1009bc): multiple definition of `s.got'
> /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'
> ../../../../../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'

Looks like something is not being added in the libbsp/wrapup

> ../../../../../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'
> collect2: ld returned 1 exit status

Again your *startfile in the bsp_specs isn't right.  Check psim.

Build psim and capture the log so you have a comparison of a working
BSP. :)

> 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
> -----------------------------------------------------------------------
> 
>>>../../../../../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
> 
> It seems that the rtems_crti was added only in the new version. Among all
> the BSP's, it seems that motorola_powerpc is the only one using it (in
> start/Makefile.am. But the files are in powerpc/shared/start/
> 
> How can I know that the pmc694 needs it?

It is part of having C++ support and the symbols are just expected to be 
provided.

I went to Owego on a business trip years ago which meant I had to fly
into Binghamton.  Is the airport there still terribly small?

--joel



More information about the users mailing list