Thursday, May 28, 2009

More on toolchains … from Booboo!

Booboo sent me the following; thanks Booboo:


I think I can add some clarification to the toolchain concept. Your
post is not technically wrong but is a bit misleading.
In a programming context a toolchain is the group of tools needed to
write a program. If the program is interpreted (Python for example)
the toolchain would include a simple text editor used to create the
program and the runtime environment (the Python interpreter and
libraries) for the target system. If the program is compiled (C, C++),
the toolchain usuarrly refers only to the compiler, linker, some other
auxiliary tools and a minimal set of libraries needed to build basic
programs (libc in linux).
Toolchains can be "native" or "cross". A toolchain "native" runs in
one platform and produces code for the SAME platform. This is the case
of the gcc/ld and friends found in most linux distributions. A cross
toolchain runs in one platform (PC) but produces code and executables
for a completely different platform. This is the kind of toolchain we
need for A320 programming. The programs compiled with this toolchain
cannot be run in the PC, must be transferred and executed on the A320.
That said, Ingenic provides a FULL WORKING toolchain for the JZ4740
processor which is usable for the A320. This toolchain includes the
most basic libraries (libc, for example) and some other useful
libraries. I compiled some others like the SDL which are not included
in the Ingenic toolchain but are almost mandatory if you want to
program games and emulators.
The Ingenic toolchain together with some extra libraries is all we
need right now to compile programs for the A320 (well, that and a
linux kernel supporting the hardware).
What about the uclibc toolchain?
Well... the Ingenic toolchain is based on the libc library. This is
the very foundation of each program and is VERY large because it
supports every function needed in a linux desktop or server system. As
a consequence, this is a quite large library which consumes lots of
memory. 4MB is nothing in a modern desktop but is a quite sizeable
chunk of the A320 available memory.
So, there is an alternative "base" library called uclibc. As the name
suggests, it s a libc optimized for size and resource usage, that
doesn't include advanced functions which are usually not needed in
embedded systems. We cannot just replace the libc in the Ingenic
toolchain by a compiled uclibc, because this base library (libc or
uclibc) is so tightly bound to the compile process that a compiler
will work only with a base library, but not with the other. Or better
said, a gcc-libc compiler will produce executables that will only run
in a system which has the libc, and a gcc-uclibc compiler will produce
executables that will only run in a system which has the uclibc in the
root filesystem.
That said, I must insist that getting a uclibc based toolchain is an
OPTIMIZATION, not a requirement in order to get a working linux on the
A320. As of now, coders can build and test programs for the A320, and
we could eventually just go with the libc based toolchain provided by
Ingenic. However, having and using an uclibc based toolchain would
allow us to squeeze up to the last drop of power out of the A320.

It’s all starting to make sense!

1 comment :

  1. This is a great clarification. And I must say Booboo if English isn't your first language you certainly do a great job with it. Thanks for all the hard work..I can't wait to see linux on the Dingoo.