This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: Setting up crt0 and libs for arm-unknown-coff


Richard Earnshaw writes:
>
>> Scott Karlin writes:
>>
>> I am trying to build a cross-gcc/newlib environment for an 
>> arm-unknown-coff target on a linux host.
>> 
>> [...snip...]
>> 
>> Here are some observations which may or may not help isolate 
>> the remaining things I need to do:
>> 
>> 1. The first few lines of output from the build-cross.sh
>>    script are troubling:
>>       ./build-cross.sh: started Mon May  8 15:38:54 EDT 2000
>>       ./build-cross.sh: configure for arm-unknown-coff.
>>       Configuring for a i686-pc-linux-gnu host.
>>       *** This configuration is not supported in the following
>>       subdirectories:
>>            target-libgloss
>>           (Any other directories should still work fine.)
>>       Created "Makefile" in /home/CrossGCC/b-arm-unknown-coff
>> 
>>    Is this a problem?  Do I need to modify the configuration
>>    files so that libgloss can be made?
>> 
>
>This shouldn't be a problem.  I don't think you need anything from 
>libgloss.
>
>
>> 
>> 2. When I compile an empty main() program, I get a couple of
>>    errors:
>>       $ cat main.c
>>       int main(void) { return 0; }
>>       $ arm-unknown-coff-gcc -I. -mcpu=strongarm110 -mapcs-32
>>         -mno-sched-prolog -fvolatile -fno-builtin -Wall
>>         -Wstrict-prototypes -O2 -c main.c -o main.o
>>       $ arm-unknown-coff-ld -o main.coff main.o -X -N
>>         -Ttext 00001000 -lc
>>       arm-unknown-coff-ld: warning: cannot find entry symbol
>>       _start; defaulting to 00001000
>>       main.o(.text+0xc):fake: undefined reference to `__gccmain'
>> 
>>    Where should __gccmain be resolved?  In crt0.o or a library?
>>    What type of object is it?  (Or, is there a way to prevent
>>    it from being generated if that is more appropriate?)
>> 
>
>It's normally better to use gcc to do your linking (at least until you 
>really need to control the linker in a much finer manner).  In this case, 
>you need to add gcc's runtime support library (libgcc); but gcc will add 
>that automatically.
>
>Try:
>   arm-unknown-coff-gcc -o main.coff main.o
>
>adding -v to the above will force gcc to show you the command line that it 
>passes to the linker.

Thank you, this helps a lot:

$ cat main.c
#include <stdio.h>

int main(void)
{
   puts("Hello, World");
   return 0;
}

$ arm-unknown-coff-gcc -v -o main.coff main.o
Reading specs from /usr/xcc/arm/lib/gcc-lib/arm-unknown-coff/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/xcc/arm/lib/gcc-lib/arm-unknown-coff/2.95.2/collect2 -X -o main.coff /usr/xcc/arm/arm-unknown-coff/lib/crt0.o -L/usr/xcc/arm/lib/gcc-lib/arm-unknown-coff/2.95.2 -L/usr/xcc/arm/arm-unknown-coff/lib main.o -lgcc -lc -lgcc


There are no link errors.  However, I know that my UART code is not
in the executable.  When I run the code, I get a "software interrupt".
My guess is that the library is making some incorrect assumptions
about the underlying environment.  (This software interrupt sounds
suspiciously like a system call.)

How can I use my simple little polling UART routines for stdio?

Thanks,

-Scott


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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