Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Barry Wealand <barry.wealand@lmco.com>
To: gdb@sources.redhat.com
Cc: "Krimsley, David A" <david.a.krimsley@lmco.com>,
	        "Ke, Jinshan" <jinshan.ke@lmco.com>,
	        "Furgal, Jason" <jason.furgal@lmco.com>
Subject: Using PSIM
Date: Wed, 30 Nov 2005 23:33:00 -0000	[thread overview]
Message-ID: <438DC220.9090404@lmco.com> (raw)

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



             reply	other threads:[~2005-11-30 23:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 23:33 Barry Wealand [this message]
     [not found] ` <20051130233303.GA31583@nevyn.them.org>
2005-12-01  1:11   ` Barry Wealand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438DC220.9090404@lmco.com \
    --to=barry.wealand@lmco.com \
    --cc=david.a.krimsley@lmco.com \
    --cc=gdb@sources.redhat.com \
    --cc=jason.furgal@lmco.com \
    --cc=jinshan.ke@lmco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox