Tuesday, April 13, 2010
Strange link errors when building load modules
Q: One of our customers is trying to build pbench as a load module with BSP_MPC8377_OSE5.4 and getting link errors. We can build the same lm on the same release and bsp without errors. What is going on?
$ make lm
/home/user1/OSE/BSP_MPC8377_OSE5.4/refsys/modules/pbench
--- Preprocessing linker control file obj/powerpc/debug/gcc_lm.lcf ../../compilers/gcc_lm.lcf
--- Linking obj/powerpc/debug/unconfigured (pass 1)
--- Linking obj/powerpc/debug/unconfigured (pass 2)
obj/powerpc/debug/unconfigured_ro: In function `clib_pointer':
stdout.c:(.text+0xac54): undefined reference to `_SDA2_BASE_'
obj/powerpc/debug/unconfigured_ro: In function `zzinit_OSE': (.text+0xacae): undefined reference to `_SDA_BASE_'
obj/powerpc/debug/unconfigured_ro: In function `zzinit_OSE':
(.text+0xacb2): undefined reference to `_SDA_BASE_'
make: *** [obj/powerpc/debug/unconfigured] Error 1
A: These bizarre errors, which leave no clue as to their true cause, can occur if the user doesn't use the toolchain version that is shipped for the corresponding OSE version. In other words, newer or older compilers may present unforseen problems. In this case, toolchain is GNU, and the _SDA_BASE_ and similiar vars are already part of our CRT library but weren't being pulled in due to a later GNU ld version of 2.19 instead of the 2.16.1 version we ship for OSE5.4.1. A quick version check is always useful:
$ which powerpc-eabi-ld
/cygdrive/c/OSE/OSE5.4.1_PPC/gcc_win32_powerpc_4.2.3/bin/powerpc-eabi-ld
$ powerpc-eabi-ld -v
GNU ld version 2.16.1
$ make lm
/home/user1/OSE/BSP_MPC8377_OSE5.4/refsys/modules/pbench
--- Preprocessing linker control file obj/powerpc/debug/gcc_lm.lcf ../../compilers/gcc_lm.lcf
--- Linking obj/powerpc/debug/unconfigured (pass 1)
--- Linking obj/powerpc/debug/unconfigured (pass 2)
obj/powerpc/debug/unconfigured_ro: In function `clib_pointer':
stdout.c:(.text+0xac54): undefined reference to `_SDA2_BASE_'
obj/powerpc/debug/unconfigured_ro: In function `zzinit_OSE': (.text+0xacae): undefined reference to `_SDA_BASE_'
obj/powerpc/debug/unconfigured_ro: In function `zzinit_OSE':
(.text+0xacb2): undefined reference to `_SDA_BASE_'
make: *** [obj/powerpc/debug/unconfigured] Error 1
A: These bizarre errors, which leave no clue as to their true cause, can occur if the user doesn't use the toolchain version that is shipped for the corresponding OSE version. In other words, newer or older compilers may present unforseen problems. In this case, toolchain is GNU, and the _SDA_BASE_ and similiar vars are already part of our CRT library but weren't being pulled in due to a later GNU ld version of 2.19 instead of the 2.16.1 version we ship for OSE5.4.1. A quick version check is always useful:
$ which powerpc-eabi-ld
/cygdrive/c/OSE/OSE5.4.1_PPC/gcc_win32_powerpc_4.2.3/bin/powerpc-eabi-ld
$ powerpc-eabi-ld -v
GNU ld version 2.16.1
Labels: gcc, linker, lm, OSE5.4, OSE5.4.1
Friday, December 18, 2009
Compiling load modules for soft kernel?
Q: I want to try a load module in my soft kernel before putting it on the real target. How can I build this? The sfk-win32 ARCH target doesn't work.
A: The trick to getting the LMs to build for sfk is to use ARCH=x86 instead. E.g.:
$ C:/OSE/BSP_SFK_OSE5.4.1/refsys/modules/pingpong
$ make ARCH=x86 all
--- Compiling src/ping.c
--- Compiling src/pong.c
--- Compiling ../../modules/src/libwhat.c for obj/x86/debug/libwhat.o
--- Building lib/x86/debug/libpingpong.a
--- Compiling src/debug_friendly.c
--- Compiling src/pingpong_main.c
--- Concatenating osemain.con fragments
--- Compiling c:/OSE/ose5.4.1_ppc/src/osemain.c
--- Compiling c:/OSE/ose5.4.1_ppc/src/crt0_lm.c
--- Compiling c:/OSE/ose5.4.1_ppc/src/ose_confd.c
--- Linking obj/x86/debug/unconfigured (pass 1)
--- Linking obj/x86/debug/unconfigured (pass 2)
--- Stripping load module from symbol and debug information
--- Postlinking obj/x86/debug/unconfigured
--- Inserting configuration ../../modules/src/default.lmconf
--- Sizing bin/x86/pingpong_debug.elf
Size of text : 29704 (29K) (t)
Size of initdata : 0 (0K) (id)
Size of data : 2084 (2K) (d)
Size of bss : 344 (0K) (b)
ROM footprint : 31788 (31K) (t+d)
RAM footprint : 36864 (36K) (t+id+d+b)
The resulting elf file is located in :
C:/OSE/BSP_SFK_OSE5.4.1/refsys/modules/pingpong/bin/x86/pingpong_debug.elf
This applies for OSE5.4.1 but holds for older releases as well. To upload it, remember that the directory for sfk is mounted locally (for newer OSE5 releases) so you don't need the /tftp/ in the pathname. The default pathname is /host, which represents your root C: level. Just create a temp directory from your C: top-level directory and mount from there, e.g. create C:/oselm, copy the elf file over there, then download it to the rtose for sfk-win32 with:
rtose@softwin> pm_install pingpong /host/oselm/pingpong_debug.elf
rtose@softwin> pm_create pingpong
rtose@softwin> pm_lminfo
core_module
pingpong
A: The trick to getting the LMs to build for sfk is to use ARCH=x86 instead. E.g.:
$ C:/OSE/BSP_SFK_OSE5.4.1/refsys/modules/pingpong
$ make ARCH=x86 all
--- Compiling src/ping.c
--- Compiling src/pong.c
--- Compiling ../../modules/src/libwhat.c for obj/x86/debug/libwhat.o
--- Building lib/x86/debug/libpingpong.a
--- Compiling src/debug_friendly.c
--- Compiling src/pingpong_main.c
--- Concatenating osemain.con fragments
--- Compiling c:/OSE/ose5.4.1_ppc/src/osemain.c
--- Compiling c:/OSE/ose5.4.1_ppc/src/crt0_lm.c
--- Compiling c:/OSE/ose5.4.1_ppc/src/ose_confd.c
--- Linking obj/x86/debug/unconfigured (pass 1)
--- Linking obj/x86/debug/unconfigured (pass 2)
--- Stripping load module from symbol and debug information
--- Postlinking obj/x86/debug/unconfigured
--- Inserting configuration ../../modules/src/default.lmconf
--- Sizing bin/x86/pingpong_debug.elf
Size of text : 29704 (29K) (t)
Size of initdata : 0 (0K) (id)
Size of data : 2084 (2K) (d)
Size of bss : 344 (0K) (b)
ROM footprint : 31788 (31K) (t+d)
RAM footprint : 36864 (36K) (t+id+d+b)
The resulting elf file is located in :
C:/OSE/BSP_SFK_OSE5.4.1/refsys/modules/pingpong/bin/x86/pingpong_debug.elf
This applies for OSE5.4.1 but holds for older releases as well. To upload it, remember that the directory for sfk is mounted locally (for newer OSE5 releases) so you don't need the /tftp/ in the pathname. The default pathname is /host, which represents your root C: level. Just create a temp directory from your C: top-level directory and mount from there, e.g. create C:/oselm, copy the elf file over there, then download it to the rtose for sfk-win32 with:
rtose@softwin> pm_install pingpong /host/oselm/pingpong_debug.elf
rtose@softwin> pm_create pingpong
rtose@softwin> pm_lminfo
core_module
pingpong
Labels: lm, load module, OSE5, sfk
free invisible web counter

