Building RTEMS. Targets and overrides...

Per Dalgas Jakobsen pdjpub at
Thu Aug 4 21:49:16 UTC 2005

Ralf Corsepius wrote:
> On Thu, 2005-08-04 at 16:34 +0200, Per Dalgas Jakobsen wrote:

PDJ>>>> I'm trying to build RTEMS-4.6.2 on a Cygwin host for a Pentium
PDJ>>>> I have successfully made a cross-toolchain for i586-rtems:
PDJ>>>> binutils-2.16.1, newlib (CVS from yesterday) and gcc-3.4.4

RC>>> Are you sure you did? How did you configure the toolchain?

PDJ>> By successfully, I meant no compilation errors, and is able to
compile a
PDJ>> small program with:

RC> That's not what I wanted to know. I had wanted to see the command line
RC> you passed to binutils and gcc's configure scripts.

binutils was configured like this:
configure --prefix=/opt/i586-rtems --target=i586-rtems --enable-libada
and made by:
make && make info && make install

gcc (with newlib implanted) was configured like this:
configure --prefix=/opt/i586-rtems --target=i586-rtems --with-gnu-as
--with-gnu-ld --with-newlib --enable-threads --enable-libada
--disable-nls --enable-languages=c,ada
and made by:
make all && make info && make install

In both cases the build-tree were located outside the source-tree (as 
they should).

PDJ>>>> Unfortunately it seems not so easy to configure RTEMS for an
PDJ>>>> 586-optimized toolchain/compiler.
PDJ>>>> Any good reasons for that?

RC>>> Yes, because it doesn't make much sense.
RC>>> i586 is treated as a cpu variant of the i386 architecture (some call
RC>>> this the "base architecture"), i.e. as
RC>>> "i386-rtems-gcc -mtune=pentium"

PDJ>> Then why not streamline it so i586 is working as expected?

RC> What streamlining are you talking about? There is no such thing.

Well, binutils, gcc and newlib doesn't seem to mind declaring a i586
cross-target. One could argue that RTEMS ought to accept the i586
target, but really just treat it as an i386 (but accepting the
i586-rtems toolchain).

However, I think, I'm beginning to understand; I gain nothing by making
an i586 toolchain as opposed to an i386 toolchain. By using
"-march=i586" flag when compiling the RTEMS applications, I would get my
code optimized for the pentium as I expect.

<snipped: a good explanation, which made me understand more>

RC>>> No, you used --target=i386-rtems, i.e. you asked it to look
RC>>> for i386-rtems-<tool>.

PDJ>> Yes, but I explicitely asked it to prefix all tools with
PDJ>> "--program-prefix=i586-rtems-"... But it doesn't seem to honour that.

RC> Yes, we don't honor it, because its meaning is unclear in general (Is it
RC> supposed to be the prefix of the tools to be used or the prefix being
RC> prepended to tools being installed, and how does it interact with
RC> --program-suffix, rsp. --transform-name) and conflicts with other
RC> conventions on cross compilation (is it the prefix of the host, build,
RC> or target tools?).

Hmmm, I see the ambiguity... Perhaps the options should be removed, to
avoid "noise", but I don't know autoconf enough to know if/how that can
be done.

>> Perhaps I misunderstood something here?!?
> I think so. 

Yep, however I think I got something set straight now, thanks :-)

> Unless you hit a bug in binutils or gcc, configuring both with
> --target=i586-rtems should do what you want.

Ehh, now you've got me confused again. That was exactly what I did, but
I couln't get the RTEMS configure-script to use the result. Perhaps if I
combined --target=i586-rtems --program-prefix=i386-rtems...

Naah, I will just use i386-rtems for the entire toolchain and use
-march=i586 when the time comes for applications.

Thanks for the explanations.


More information about the users mailing list