Subject:
|
Re: Problem with asm statement in loader.c
|
Newsgroups:
|
lugnet.robotics.rcx.legos
|
Date:
|
Fri, 19 Nov 1999 11:26:53 GMT
|
Viewed:
|
1422 times
|
| |
| |
Klaus Kinateder wrote:
>
> hi,
>
> as many others, i also want to succeed in building legOS (0.2.2). :)
>
> i also used gcc 2.8.1, but the same error appears. so at this point, i want
> to ask martin: "how did you made it?".
>
> thanks, klaus
Hi Klaus,
first:
forget gcc-2.95.2 for CROSS-compiling for the moment, it does NOT work
with legOS-0.2.2. You can compile legOS using it, but legOS will hang
immediately when you try to download any user program. I guess only
Markus is able to figure out what's wrong here, so start by building
egcs-1.1.2 as cross compiler -- and don't forget to apply the interrupt
patch. This does not mean you cannot use gcc-2.95.x as linux compiler,
at least 2.95.1 works fine for me ( Luis however seems to have problems
).
second:
i'll first try to explain what's the problem...
look at the Makefile in legOS/util/dll-src/Makefile. There is a line
CFLAGS=-O2 -Wall -I/usr/include -I. -I../../include
you might wonder about the -I/usr/include directive if you knew that gcc
uses this directory by default when searching for header files. However,
there is a good reason for this directive:
The utilities need the headers describing lnp, that is: lnp.h and
lnp-logical.h, therefore ../../include must also be searched (this
actually is legOS/include). Unfortunately, the headers that make up
legOS's mini-libc also live in this directory, and -- they have the same
names as the glibc headers.
Thus, if you don't mention -I/usr/include before -I../../include, the
legOS libc-headers will be used for compilation of linux programs, what
does not work -- not yet 8-). The -I/usr/include forces the glibc header
files to be used in preference of identically named legOS headers,
what's essential when compiling for the linux architecture.
However, one of the glibc header files, actually
/usr/include/selectbits.h, is not working with recent versions of gcc
(2.95.x ?). It defines the FD_ZERO macro using inline assembler in a way
that obviously conflicts with the register allocation of recent gcc
versions. You might wonder then, why at all you can compile applications
on your linux box that use FD_ZERO. Well, gcc uses a similar workaround:
It provides it's own version of FD_ZERO in one of it's private header
files, which by default are searched BEFORE /usr/include. However, the
-I/usr/include directive forces /usr/include to be searched very first,
and makes gcc-2.95.x fail compiling the utils.
My workaround for this problem: We must separate the lnp-related headers
from the libc stuff. Doing so, we can tell gcc where the lnp-headers
live without having to expicitly mention /usr/include. Unfortunately,
i'm currently at work and can't access my machine at home, so i cannot
send you a patch. But the procedure is quite simple:
- create a subdirectory under legOS/include named lnp, and move lnp.h
and
lnp-logical.h from legOS/include to this directory.
- create a subdirectory named sys under this directory, and move
irq.h, lnp.h and lnp-logical.h from legOS/include/sys to this
directory.
- Change the CINC variable definition in legOS/Makefile.common to
CINC =-I$(LEGOS_ROOT)include -I$(LEGOS_ROOT)include/lnp -I.
- Change the CFLAGS definition in legOS/util/dll-src/Makefile to
CFLAGS=-O2 -Wall -I. -I../../include/lnp
make realclean ; make depend ; make all should work now..
good luck, Martin
|
|
Message is in Reply To:
| | Problem with asm statement in loader.c
|
| hi, as many others, i also want to succeed in building legOS (0.2.2). :) my platform is linux, kernel 2.0.38, glibc1. i've builded binutils-2.9.1.0.25 and gcc-2.95.2 as described in the howto. version 0.1.7 works just fine, but if i attempt to build (...) (25 years ago, 19-Nov-99, to lugnet.robotics.rcx.legos)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|