Beruflich Dokumente
Kultur Dokumente
Systems
– Chaitannya Mahatme
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Definition
● The usual development tools available on a GNU/Linux workstation is
a native toolchain
● This toolchain runs on your workstation and generates code for your
workstation, usually x86
● For embedded system development, it is usually impossible or not
interesting to use a native toolchain
– The target is too restricted in terms of storage and/or memory
– The target is very slow compared to your workstation
– You may not want to install all development tools on your target.
● Therefore, crosscompiling toolchains are generally used. They run on
your workstation but generate code for your target.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Definition
Source code
Compilation
Crosscompiling machine
Native toolchain
toolchain
x86
x86 binary Execution
ARM binary
machine
x86 ARM
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Components
Binutils Kernel headers
C/C++ libraries GCC compiler
GDB debugger
(optional)
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Binutils
● Binutils is a set of tools to generate and manipulate
binaries for a given CPU architecture
– as, the assembler
– ld, the linker
– ar, ranlib, to generate .a archives, used for libraries
– objdump, readelf, size, nm, strings, to inspect binaries.
Very useful analysis tools !
– strip, to strip useless parts of binaries in order to reduce
their size
● http://www.gnu.org/software/binutils/
● GPL license
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
GCC compiler
● GNU C Compiler, the famous free software
compiler
● Can compile C, C++, Ada, Fortran, Java, Objective
C, ObjectiveC++, and generate code for a large
number of CPU architectures, including ARM,
AVR, Blackfin, Atmel, Xtensa, etc.
● http://gcc.gnu.org/
●
Available under the GPL license, libraries under
the LGPL.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
C library
● The C library is an essential
component of a Linux system
– Bridge between the user space and Kernel
the kernel space.
– Provides the wellknown standard C
C Library
API to ease application development
● Several C libraries are available: Applications
glibc, uClibc, eglibc, dietlibc,
newlib, etc.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
glibc
http://www.gnu.org/software/libc/
● License: LGPL
● C library from the GNU project
● Designed for performance, standards compliance and
portability
● Found on all GNU / Linux host systems
● Of course, actively maintained
● Quite big for small embedded systems: approx 2.5 MB
on arm (version 2.9 libc: 1.5 MB, libm: 750 KB)
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
uClibc
http://www.uclibc.org/ from CodePoet Consulting
● License: LGPL
● Lightweight C library for small embedded systems
– High configurability: many features can be enabled or
disabled through a menuconfig interface
– Works only with Linux/uClinux, works on most embedded
architectures
– No stable ABI, different ABI depending on the library
configuration
– Focus on size rather than performance
– Small compile time
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Getting a precompiled toolchain
● Solution that most people choose, because it is the simplest
and most convenient solution.
● Many toolchains are freely available precompiled on the
Web
– CodeSourcery, http://www.codesourcery.com, is a
reference in that area, but they only provide glibc
toolchains.
– See also http://elinux.org/Toolchains
● You should preferably use toolchain released by the chip
vendor of your target board, in order utilize all the hardware
features on the chip.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Installing a precompiled toolchain
● Follow the installation procedure proposed by
the vendor
● Usually, it is simply a matter of extracting a
tarball at the proper place
●
Then, add the path to toolchain binaries in your PATH:
export PATH=/path/to/toolchain/bin/:$PATH
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Overview of ARM architectures.
● ARM 7
● ARM 9
● ARM 11
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
ARM7TDMI
● ARM7TDMI
(ARM7+Thumb+Debug+Multiplier+ICE)
● This generation introduced the Thumb 16
bit instruction set
Audio controller in the SEGA Dreamcast
● DLink DSL604+ Wireless ADSL Router.
● iPod ,iRiver
● Most of Nokia's mobile phone range.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
ARM 9
●
ARM moved from a von Neumann
architecture (Princeton architecture) to a
Harvard architecture with separate
instruction and data bus (and caches),
significantly increasing its potential speed.
● Most important change was introduction of
MMU, so that POSIX complaint OS (Linux,
window CE, etc) could be ported.
● All smart phones
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
ARM 11
● SIMD instructions which can double MPEG4
and audio digital signal processing algorithm
speed
● Cache is physically addressed, solving many
cache aliasing problems and reducing context
switch overhead.
● TI OMAP2 series processors.
●
All touch based smart phones.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Steps of CrossCompilation
●
gcc: Run the crosscompiler on the host
machine to produce assembler files for the
target machine.
● as: Assemble the files produced by the
crosscompiler.
● ld: Link those files to make an executable.
You can do this either with a linker on the
target machine, or with a crosslinker on
the host machine.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Specifing target for your toolchain
●
armlinux
● Armv4l : This makes support for the ARM
v4 architecture, as used in the StrongARM,
ARM7TDMI, ARM8, ARM9.
● Armv5l : This makes support for the ARM
v5 architecture, as used in the XScale and
ARM10.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
EABI for Linux
● GNU EABI is a new Application Binary
Interface (ABI) for Linux a.k.a Embedded ABI.
It's a standard for compiler, just like we have
POSIX standard for OS.
● EABI specifies standard conventions for file
formats, data types, register usage, stack frame
organization, and function parameter passing
of an embedded software program.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
EABI target
Some sample toolchains.
● Armeabi : This means it's a EABI compliant
toolchain.
● armnoneeabi: Here none means it's
architecture neutral.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Other EABI options
●
armnonegnueabi: this is the name as arm
noneeabi (specific to GNU compiler).
● armunknowneabi: bare metal
● armlinuxeabi: Designed to be used to
build programs with glibc under a Linux
environment. This would what you would
use to build programs for an embeded
linux ARM device.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
CPU options
●
arm7, arm7tdmi, arm720t,
● arm9', arm9e, arm920, arm920t
● arm1136js, arm1176jzs
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Other configure options
●
enableinterwork This allows for
assembling Thumb and ARM code mixed
into the same binaries (for those chips that
support that)
● enablemultilib Multilib allows the use of
libraries that are compiled multiple times
for different targets/build types.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Why switch to EABI?
●
Compilers that support the EABI create
object code that is compatible with code
generated by other such compilers, thus
you can link libraries generated with with
object code generated with a different
compiler.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
●
Allows use of optimized hardfloat
functions with the system's softfloat
libraries
● Uses a more efficient syscall convention,
hence faster performance.
● Since it's a newly adopted standard, will be
more compatible with future tools.
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
Compilation process
● Binutils
● glibc
● gcc
● gdb
http://www.embeddednirvana.org http://wiki.embeddednirvana.org
That's all Folks … Thank you
http://www.embeddednirvana.org http://wiki.embeddednirvana.org