• Save
Upcoming SlideShare
Loading in...5







Total Views
Views on SlideShare
Embed Views



10 Embeds 3,346

http://sysplay.in 2082
http://profession.sarika-pugs.com 1238
http://localhost 8
http://www.linkedin.com 6
url_unknown 4
http://www.sysplay.in 3
https://www.linkedin.com 2
http://shrishti 1
http://www.slideshare.net 1 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.


11 of 1

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Toolchain Toolchain Presentation Transcript

    • Toolchain© 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
    • What to Expect?Ws of a ToolchainWs & Hows of Cross Toolchain?Building a Cross ToolchainTesting a Cross Toolchain © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 2 All Rights Reserved.
    • What is a Toolchain?Collection of ToolsIn Embedded context Collection of C Compiler & its FriendsCategorized under 3 umbrella C Compiler (gcc) Set of C Libraries (e.g. glibc, uClibc) Binary Utilities (binutils) © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 3 All Rights Reserved.
    • Check on gccHow do you do the following? Generate Object Code Generate Assembly Code Generate Pre-processed Code Generate a Shared Library Adding Header Path Adding Library Path Linking a Library Excluding standard includes & libraries Adding a “#define” © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 4 All Rights Reserved.
    • gcc Internals gcc gcc -c gcc -S gcc -E.c .i ICG IC (parse trees, ...) ICG .S .o .exe Pre Assembler Linker (machine (machine Processor (as) (ld) independent) dependent) gcc core gcc wrapper © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 5 All Rights Reserved.
    • Set of C LibrariesGenerally useful Libraries C, Math, Thread, Socket, …Various Options glibc Complete featured but heavy on memory Highly standard compatible uClibc Light-weight with mostly same features But not that much standards compatible Diet libc Similar to uClibc, just that this has been done from scratch Emphasis on minimizing size & optimizing performance © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 6 All Rights Reserved.
    • Binary Utilitiesas – GNU Assemblerld – GNU Linkergasp – GNU Assembler Pre-processorar – Creates & Manipulates Archivesnm – Lists the symbols in an Object fileobjcopy – Copies & Translates Object filesobjdump – Displays info about Content of the Object filesranlib – Generates an index to the content of Object filesreadelf – Displays info about an ELF format Object filesize – Lists the sizes of sections within an Object filestrings – Prints the strings of printable characters in Object filesstrip – Strips symbols from Object filesc++filt – Converts low-level, mangled assembly labels resulting from overloadedC++ functions to their user-level namesaddr2line – Converts addresses into line numbers within original source files © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 7 All Rights Reserved.
    • What is Cross? gcc prog Example: gcc vs cross gcc src srcHost Host Tgt Target Crossexe Native exe Native gccprog gcc prog gcc Host Target © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 8 All Rights Reserved.
    • What is a Cross Toolchain?Toolchain which has all “cross” tools © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
    • Why we need a Cross Toolchain?Embedded Systems are constrained Toolchain demands heavy memory & performance May not always have a console interface Even if there, may be minimalEase of Development Complete accustomed Development Environment on the Host Favourite Editors, GUIs, … © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 10 All Rights Reserved.
    • How to get a Cross Toolchain?Get it pre-compiled from vendors Popular: Code sourcery Local: Requirement specificBuild your own Doing it manually is a complicated process Inter Package version compatibility is the biggest challenge But various automated tools are available today to simplify the process © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 11 All Rights Reserved.
    • Automated Build ToolsFor glibc based Toolchain crosstool ptxdistFor uClibc based Toolchain buildroot © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 12 All Rights Reserved.
    • Cross Toolchain Building OverviewBuild of various GNU Packages involvedTypical Build Steps for these Packages Download & Unpack the source of the Package Configure the Package for Cross-Platform Development Build the Package (make) Install the Package (make install)Configuring involves setting up build, host, target ./configure build=... host=... target=...Using Triplet: cpu[-manufacturer][-kernel][-os/obj_file_fmt]Examples: i386-pc-linux-gnu, xscale-sun-solaris2.5/elfTool Prefix: Same as the triplet © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 13 All Rights Reserved.
    • Cross Toolchain Headers User Linux extract Specific Kernel Headers Headers UserFrom theKernel SpaceSources Headers C Library /usr/include Headers © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 14 All Rights Reserved.
    • Cross Toolchain Component Dependency kernel Cross hdrs Native Full gcc gcc library (gcc, g++) hdrs Target gcc Libraries Cross library Cross bootstrap binutils gcc (xgcc)binutils src Source Code © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 15 All Rights Reserved.
    • Cross Toolchain Building StepsSet up Linux Kernel Headers Ideally from the Kernel version being used Commands make ARCH=<arch> headers_check make ARCH=<arch> INSTALL_HDR_PATH=install_dir/ headers_installBuild Binary UtilitiesBuild the bootstrap Compiler (The C only Compiler)Build the C LibraryBuild the full Compiler © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 16 All Rights Reserved.
    • Testing a Cross ToolchainCompile a C program to various stages Pre-process only Get Assembly Get Object Get ExecutableCompile a C program with headersCompile a C program with linking librariesCreate a C Program with floating point operationsExecute & Test the generated target programsToolchain “Self Contained” Test © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 17 All Rights Reserved.
    • What all have we learnt?Ws of a Toolchain Compiler Binary Utilities Set of C LibrariesWs & Hows of Cross Toolchain?Building a Cross Toolchain Building Steps Automated Build ToolsTesting a Cross Toolchain © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 18 All Rights Reserved.
    • Any Queries?© 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 19 All Rights Reserved.