From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30406 invoked by alias); 30 Nov 2005 23:17:25 -0000 Received: (qmail 30399 invoked by uid 22791); 30 Nov 2005 23:17:25 -0000 X-Spam-Check-By: sourceware.org Received: from mailgw2a.lmco.com (HELO mailgw2a.lmco.com) (192.91.147.7) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Nov 2005 23:17:23 +0000 Received: from emss03g01.ems.lmco.com (relay3.ems.lmco.com [141.240.4.144]) by mailgw2a.lmco.com (8.12.10/8.12.10) with ESMTP id jAUNHLle023529 for ; Wed, 30 Nov 2005 18:17:21 -0500 (EST) Received: from CONVERSION-DAEMON.lmco.com by lmco.com (PMDF V6.1-1X6 #30875) id <0IQS00I01JCXMS@lmco.com> for gdb@sources.redhat.com; Wed, 30 Nov 2005 18:17:21 -0500 (EST) Received: from cui1.lmms.lmco.com ([129.197.1.64]) by lmco.com (PMDF V6.1-1X6 #30875) with ESMTP id <0IQS00H7UJCVBJ@lmco.com> for gdb@sources.redhat.com; Wed, 30 Nov 2005 18:17:20 -0500 (EST) Received: from lmco.com (obligato.lmms.lmco.com [129.197.113.45]) by cui1.lmms.lmco.com (8.11.7p1+Sun/8.9.2) with ESMTP id jAUNHFt00165; Wed, 30 Nov 2005 15:17:19 -0800 (PST) Date: Wed, 30 Nov 2005 23:33:00 -0000 From: Barry Wealand Subject: Using PSIM To: gdb@sources.redhat.com Cc: "Krimsley, David A" , "Ke, Jinshan" , "Furgal, Jason" Message-id: <438DC220.9090404@lmco.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2005-11/txt/msg00640.txt.bz2 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