This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using PSIM


Hello -

I'm trying to set up a PowerPC development environment based on GCC and GDB with PSIM. The desired environment is similar to what the PSIM documentation calls BUG/OEA - to support embedded software development.

For my first attempt, I built and installed binutils-2.16.1, gcc-3.4.4, newlib-1.13.0, and gdb-6.3 for a powerpc-eabi target, on sparc-sun-solaris2.8 and i686-pc-linux-gnu hosts. Using as-built (newlib) libraries and initially using no linker script, attempting to build the traditional "hello" program leads to the following:

% setenv PPCLIB ~/GCC/tools/H-sparc-sun-solaris2.8/powerpc-eabi/lib
% powerpc-eabi-gcc -c hello.c
% powerpc-eabi-gcc -o hello hello.o ${PPCLIB}/sim-crt0.o -lc -lsim
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o): In function `__eabi':
/u00/users/bwealand/GCC/build/powerpc/gcc/gcc/eabi.S:232: undefined reference to `__init'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x8): undefined reference to `__SDATA_START__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0xc): undefined reference to `__SBSS_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x14): undefined reference to `__SDATA2_START__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x18): undefined reference to `__SBSS2_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x1c): undefined reference to `__GOT_START__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x28): undefined reference to `__GOT_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x2c): undefined reference to `__GOT2_START__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x30): undefined reference to `__GOT2_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x34): undefined reference to `__FIXUP_START__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x38): undefined reference to `__FIXUP_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x3c): undefined reference to `__CTOR_LIST__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x40): undefined reference to `__CTOR_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x44): undefined reference to `__DTOR_LIST__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x48): undefined reference to `__DTOR_END__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x4c): undefined reference to `__EXCEPT_START__'
/u00/users/bwealand/GCC/tools/H-sparc-sun-solaris2.8/lib/gcc/powerpc-eabi/3.4.4/libgcc.a(eabi.o):(.got2+0x50): undefined reference to `__EXCEPT_END__'
collect2: ld returned 1 exit status


In my experience, this seems to suggest the use of a linker script that would define all of these various labels. A number of such scripts are supplied with newlib, e.g., mbx.ld. However, none of these scripts define most of the above symbols. So I created a new script, based on mbx.ld, called sim.ld, and placed statements similar to:

PROVIDE (__GOT2_START__ = .);

at my best guess at the correct location for each missing label mentioned above. The only two that didn't seem to go anywhere in particular were __EXCEPT_START__ and __EXCEPT_END__. For these, I used:

PROVIDE(__EXCEPT_START__ = 0x0);

(and similarly for __EXCEPT_END__).

This left the one undefined label __init, which (as best I can tell) is expected to be a function that executes all of the static constructors and destructors. I don't see this defined anywhere (e.g., in any *crt0.S files), and am not sure where it typically does get defined. In any event, since this is a C program (not C++), I assumed that no constructors or destructors exist, and took the liberty of defining a dummy __init() function, also in hello.c:

void __init() { }

Now the program builds successfully:

% powerpc-eabi-gcc -T sim.ld -o hello hello.o ${PPCLIB}/sim-crt0.o -lc -lsim
%

But if I attempt to run it, either in gdb, or using powerpc-eabi-run, I get the following output:

emul-bugapi: unimplemented bugapi Unknown bug call 0xffffffff from address 0xa408


This seems like a lot of required changes to get things this far along, so now I'm wondering if PSIM can even be used with these versions of gcc, newlib, etc. The available documentation calls out binutils-2.7, gcc-2.7.2.1, and newlib-1.7.0. I had thought that maybe I should try building these versions of the tools, in the interest of following the available directions to the letter. But then I went looking for the patch files mentioned in this documentation:


newlib-1.7.0+float+ppc-asm.tar.gz
newlib-1.7.0+ppc-fix.diff.gz

These are no longer at the site mentioned, and also not (as far as I can tell) at the specified new site. So it's not clear what the next step should be.

Any assistance would be greatly appreciated!

Thanks!

Barry Wealand
barry.wealand@lmco.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]