GCC for Embedded Engineers
The collection of programs necessary to compile and link an application is called the toolchain, and GCC, the compiler, is only one part. A complete toolchain consists of three separate parts: binutils, language-specific standard libraries and the compiler. Notably absent is the debugger, which is frequently supplied with the toolchain but is not a necessary component.
binutils (binary utilities), performs the grunt work of manipulating files in a way that's appropriate for the target machine. Key parts of the toolchain, such as the linker and assembler, reside in the binutils Project and aren't part of the GCC Project.
Hidden inside the binutils Project is another nifty bit of software, the BFD library, which technically is a separate project. The BFD, Binary Descriptor Library (the actual acronym unpacks to something too bawdy for this publication), provides an abstract, consistent interface to object files, such as handling details like address relocation, symbol translation and byte order. Because of the features supplied by BFD, most tools that need to read or manipulate binaries for target reside in the binutils Project to best take advantage of what BFD has to offer.
For the record, binutils contains the following programs:
addr2line: given a binary with debugging information and an address, returns the line and file of that address.
ar: a program for creating code archives that are a collection of object files.
c++filt: demangles symbols. With classes and overloading, the linker can't depend on the underlying language to provide unique symbol names. c++filt will turn _ZN5pointC1ERKS_ into something readable. A godsend when debugging.
gprof: produces reports based on data collected when running code with profiling enabled.
nlmconv: converts an object file into a Netware Loadable Module (NLM). If you've ever worked with NLMs, you probably did so with your collar turned up and cringed when seeing ABEND on your terminal. It's noted here because nlmconv is rarely, if ever, distributed with a toolchain.
nm: given an object file, lists symbols such as those in the public section.
objcopy: translates a file from one format to another, used in the embedded file to generate S-Records from ELF binaries.
objdump/readelf: reads and prints out information from a binary file. readelf performs the same function; however, it can work only with ELF-formatted files.
ranlib: a complement to ar. Generates an index of the public symbols in an archive to speed link time. Users can get the same effect by using ar -s.
size: prints out the size of various components of a binary file.
strings: extracts the strings from a binary, performing correct target host byte order translation. It's frequently used as the slacker's way of seeing what libraries a binary links to, as ldd doesn't work for cross-compiled programs: strings <binary> | grep lib.
strip: removes symbols or sections, typically debugging information, from files.
The C language specification contains only 32 keywords, give or take a few, depending on the compiler's implementation of the language. Like C, most languages have the concept of a standard library supplying common operations, such as string manipulation, and an interface to the filesystem and memory. The majority of the programming that happens in C involves interacting with the C library. As a result, much of the code in the project isn't written by the engineers, but rather is supplied by the standard libraries. Picking a standard library that has been designed to be small can have a drastic impact on the final size of the project.
Most embedded engineers opt for using a C library other than the standard GNU C Library, otherwise known as glibc, to conserve resources. glibc was designed for portability and compatibility, and as such, it contains code for cases not encountered or that can be sacrificed on an embedded system. One example is the lack of binary compatibility between releases of the library. Although glibc rarely breaks an interface once published, embedded standard libraries do so without any qualms.
Table 1 outlines the most frequently used C libraries, with the pros and cons of each.
Table 1. Pros and Cons of Most Frequently Used C Libraries
| Library | Pros | Cons |
|---|---|---|
| glibc | The canonical C library; contains the greatest amount of support for all C features; very portable; support for the widest number of architectures. | Size; configurability; can be hard to cross-build. |
| uClibc | Small (but not the smallest); very configurable; widely used; active development team and community. | Not well supported on all architectures; handles only UTF-8 multibyte characters. |
| DietLibC | Small, small, small; excellent support for ARM and MIPS. | Least functionality; no dynamic linking; documentation. |
| NewLib | Well supported by Red Hat; best support for math functions; great documentation. | Smallish community; not updated frequently. |
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- Tech Tip: Really Simple HTTP Server with Python
- Roll your own dynamic dns
4 hours 4 min ago - Please correct the URL for Salt Stack's web site
7 hours 15 min ago - Android is Linux -- why no better inter-operation
9 hours 31 min ago - Connecting Android device to desktop Linux via USB
9 hours 59 min ago - Find new cell phone and tablet pc
10 hours 57 min ago - Epistle
12 hours 26 min ago - Automatically updating Guest Additions
13 hours 35 min ago - I like your topic on android
14 hours 21 min ago - This is the easiest tutorial
20 hours 57 min ago - Ahh, the Koolaid.
1 day 2 hours ago




Comments
Tabela
Geçtiğimiz yerlerde her üç adımda bir gördüğümüz Tabela lar caddeleri renklendiren unsurlardır. Tabela lar caddeleri renklendirirken aynı zamandada insanların aradıkları yerleri bulmalarında son derece yardımcıdırlar. Geçen bir tatil yöresinde gezerken çok renkli, ışıklı çok güzel bir Tabela gördüm ve bayıldım.
Resmini çekeyim şu Tabela nın derken fotoğraf makinemin pili bitmiş ve çekemedim. Önümüzdeki sene gidebilirsem yine aynı şekilde bu Tabela nın resmini çekmeyi planlıyorum kimbilir belki önümüzdeki sene kısmet olur...
http://www.dikkatdizi.com
http://www.dikkatdizi.com
That's what i was looking for
That's what i was looking for =) Thanks
Medrano
You have given much
You have given much descriptive information,Thanks...
Sinema,Vizyondakiler,Sinemalar
really
You have given much descriptive information,Thanks...
Sinema,Vizyondakiler,Sinemalar
thanks for document
thanks for document
Thank you for the article.
Thank you for the article.
thank you
thanks for document
my page: www.yuhoha.com
türkçe rap müzik
Rap,Hiphop
rap dinle
free Beat
Linux
thanks for document
Bravo
Thanks for an excellent article on a subject affect many embedded engineers.