SlideShare a Scribd company logo
1 of 21
Toolchain 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 
All Rights Reserved.
What to Expect? 
W's of a Toolchain 
W's & How's of Cross Toolchain? 
Building a Cross Toolchain 
Testing a Cross Toolchain 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 2 
All Rights Reserved.
What is a Toolchain? 
Collection of Tools 
In Embedded context 
Collection of C Compiler & its Friends 
Categorized under 3 umbrella 
C Compiler (gcc) 
Set of C Libraries (e.g. glibc, uClibc) 
Binary Utilities (binutils) 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 3 
All Rights Reserved.
Check on gcc 
How 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-14 SysPlay Workshops <workshop@sysplay.in> 4 
All Rights Reserved.
gcc Internals 
.c .i IC (parse trees, ...) .S .o .exe 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 5 
All Rights Reserved. 
Pre 
Processor 
ICG 
(machine 
independent) 
ICG 
(machine 
dependent) 
Assembler 
(as) 
Linker 
(ld) 
gcc core 
gcc wrapper 
gcc -S 
gcc -c 
gcc 
gcc -E
Set of C Libraries 
Generally 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-14 SysPlay Workshops <workshop@sysplay.in> 6 
All Rights Reserved.
Binary Utilities 
as – GNU Assembler 
ld – GNU Linker 
gasp – GNU Assembler Pre-processor 
ar – Creates & Manipulates Archives 
nm – Lists the symbols in an Object file 
objcopy – Copies & Translates Object files 
objdump – Displays info about Content of the Object files 
ranlib – Generates an index to the content of Object files 
readelf – Displays info about an ELF format Object file 
size – Lists the sizes of sections within an Object file 
strings – Prints the strings of printable characters in Object files 
strip – Strips symbols from Object files 
c++filt – Converts low-level, mangled assembly labels resulting from overloaded 
C++ functions to their user-level names 
addr2line – Converts addresses into line numbers within original source files 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 7 
All Rights Reserved.
What is Cross? 
gcc Example: gcc vs cross gcc 
src 
Host 
Native 
gcc 
Target 
Native 
gcc 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 8 
All Rights Reserved. 
Host 
prog 
src 
Host 
exe 
prog 
Target 
Tgt 
exe 
prog 
Cross 
gcc
What is a Cross Toolchain? 
Toolchain which has all “cross” tools 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 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 minimal 
Ease of Development 
Complete accustomed Development 
Environment on the Host 
Favourite Editors, GUIs, … 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 10 
All Rights Reserved.
How to get a Cross Toolchain? 
Get it pre-compiled from vendors 
Popular: Code sourcery 
Local: Requirement specific 
Build 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-14 SysPlay Workshops <workshop@sysplay.in> 11 
All Rights Reserved.
Automated Build Tools 
Crosstool 
crosstool-ng.org 
Buildroot 
buildroot.org 
Ptxdist 
ptxdist.org 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 12 
All Rights Reserved.
Cross Toolchain Building 
Overview 
Build of various GNU Packages involved 
Typical 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/elf 
Tool Prefix: Same as the triplet 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 13 
All Rights Reserved.
Cross Toolchain Headers 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 14 
All Rights Reserved. 
Linux 
Kernel 
Headers 
User 
Specific 
Headers 
extract 
C Library 
Headers 
User 
Space 
Headers 
From the 
Kernel 
Sources 
/usr/include
Cross Toolchain Component 
Dependency 
Cross 
Full gcc 
(gcc, g++) 
kernel 
hdrs 
library 
hdrs 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 15 
All Rights Reserved. 
Native 
gcc 
Cross 
binutils 
Cross 
bootstrap 
gcc 
(xgcc) 
Target 
Libraries 
binutils 
gcc 
library 
Source Code 
src
Cross Toolchain Building Steps 
Set 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_install 
Build Binary Utilities 
Build the bootstrap Compiler (The C only Compiler) 
Build the C Library 
Build the full Compiler 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 16 
All Rights Reserved.
Building a Toolchain using 
Crosstool 
Install the Crosstool 
cd cross-tool-ng 
./configure –prefix=/opt/board/ 
make 
make install 
cp ct-ng.comp /etc/bash_completion.d/ 
export PATH=$PATH:/opt/board/bin/ 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 17 
All Rights Reserved.
Building a Toolchain using 
Crosstool 
Build the Toolchain 
mkdir ct-build src 
cd ct-build/ 
mkdir .build 
cp Templates/Toolchain/sources.tgz .build/ 
(available from Downloads section of http://sysplay.in) 
ct-ng menuconfig 
ct-ng build 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 18 
All Rights Reserved.
Testing a Cross Toolchain 
Compile a C program to various stages 
Pre-process only 
Get Assembly 
Get Object 
Get Executable 
Compile a C program with headers 
Compile a C program with linking libraries 
Create a C Program with floating point operations 
Execute & Test the generated target programs 
Toolchain “Self Contained” Test 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 19 
All Rights Reserved.
What all have we learnt? 
W's of a Toolchain 
Compiler 
Binary Utilities 
Set of C Libraries 
W's & How's of Cross Toolchain? 
Building a Cross Toolchain 
Building Steps 
Automated Build Tools 
Testing a Cross Toolchain 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 20 
All Rights Reserved.
Any Queries? 
© 2010-14 SysPlay Workshops <workshop@sysplay.in> 21 
All Rights Reserved.

More Related Content

What's hot

Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Linux Kernel Crashdump
Linux Kernel CrashdumpLinux Kernel Crashdump
Linux Kernel CrashdumpMarian Marinov
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDBLinaro
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Tushar B Kute
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux Mohammad Golyani
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Linaro
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linuxVicent Selfa
 

What's hot (20)

U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Linux Booting Steps
Linux Booting StepsLinux Booting Steps
Linux Booting Steps
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Linux Kernel Crashdump
Linux Kernel CrashdumpLinux Kernel Crashdump
Linux Kernel Crashdump
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDB
 
Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)Part 01 Linux Kernel Compilation (Ubuntu)
Part 01 Linux Kernel Compilation (Ubuntu)
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Architecture Of The Linux Kernel
Architecture Of The Linux KernelArchitecture Of The Linux Kernel
Architecture Of The Linux Kernel
 
Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux
 
What is Bootloader???
What is Bootloader???What is Bootloader???
What is Bootloader???
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
 
Install and configure linux
Install and configure linuxInstall and configure linux
Install and configure linux
 

Similar to Toolchain

From gcc to the autotools
From gcc to the autotoolsFrom gcc to the autotools
From gcc to the autotoolsThierry Gayet
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008guestd9065
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemLinaro
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application DevelopmentRamesh Prasad
 
Embedding Qt
Embedding QtEmbedding Qt
Embedding QtFSCONS
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Henry Schreiner
 
Dot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonDot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonRichard Rabins
 
The Ten (10) Best C/C++ Productivity Tools, Plugins and Libraries
The Ten (10) Best C/C++ Productivity Tools, Plugins and LibrariesThe Ten (10) Best C/C++ Productivity Tools, Plugins and Libraries
The Ten (10) Best C/C++ Productivity Tools, Plugins and Librarieslivecoding123
 
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuXPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuThe Linux Foundation
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 
Autotools pratical training
Autotools pratical trainingAutotools pratical training
Autotools pratical trainingThierry Gayet
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developermpaproductions
 

Similar to Toolchain (20)

gcc and friends
gcc and friendsgcc and friends
gcc and friends
 
From gcc to the autotools
From gcc to the autotoolsFrom gcc to the autotools
From gcc to the autotools
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008Purdue CS354 Operating Systems 2008
Purdue CS354 Operating Systems 2008
 
An Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating SystemAn Overview of the IHK/McKernel Multi-kernel Operating System
An Overview of the IHK/McKernel Multi-kernel Operating System
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
Embedding Qt
Embedding QtEmbedding Qt
Embedding Qt
 
Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024Software Quality Assurance Tooling - Wintersession 2024
Software Quality Assurance Tooling - Wintersession 2024
 
Dot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonDot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soon
 
The Ten (10) Best C/C++ Productivity Tools, Plugins and Libraries
The Ten (10) Best C/C++ Productivity Tools, Plugins and LibrariesThe Ten (10) Best C/C++ Productivity Tools, Plugins and Libraries
The Ten (10) Best C/C++ Productivity Tools, Plugins and Libraries
 
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, FujitsuXPDDS18: A dive into kbuild - Cao jin, Fujitsu
XPDDS18: A dive into kbuild - Cao jin, Fujitsu
 
Linux Internals Part - 2
Linux Internals Part - 2Linux Internals Part - 2
Linux Internals Part - 2
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 
C programming first_session
C programming first_sessionC programming first_session
C programming first_session
 
C programming first_session
C programming first_sessionC programming first_session
C programming first_session
 
C# tutorial
C# tutorialC# tutorial
C# tutorial
 
Autotools pratical training
Autotools pratical trainingAutotools pratical training
Autotools pratical training
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
Dotnet basics
Dotnet basicsDotnet basics
Dotnet basics
 

More from Anil Kumar Pugalia (20)

File System Modules
File System ModulesFile System Modules
File System Modules
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Processes
ProcessesProcesses
Processes
 
System Calls
System CallsSystem Calls
System Calls
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
References
ReferencesReferences
References
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
 
Power of vi
Power of viPower of vi
Power of vi
 
"make" system
"make" system"make" system
"make" system
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
 
RPM Building
RPM BuildingRPM Building
RPM Building
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

Toolchain

  • 1. Toolchain © 2010-14 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved.
  • 2. What to Expect? W's of a Toolchain W's & How's of Cross Toolchain? Building a Cross Toolchain Testing a Cross Toolchain © 2010-14 SysPlay Workshops <workshop@sysplay.in> 2 All Rights Reserved.
  • 3. What is a Toolchain? Collection of Tools In Embedded context Collection of C Compiler & its Friends Categorized under 3 umbrella C Compiler (gcc) Set of C Libraries (e.g. glibc, uClibc) Binary Utilities (binutils) © 2010-14 SysPlay Workshops <workshop@sysplay.in> 3 All Rights Reserved.
  • 4. Check on gcc How 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-14 SysPlay Workshops <workshop@sysplay.in> 4 All Rights Reserved.
  • 5. gcc Internals .c .i IC (parse trees, ...) .S .o .exe © 2010-14 SysPlay Workshops <workshop@sysplay.in> 5 All Rights Reserved. Pre Processor ICG (machine independent) ICG (machine dependent) Assembler (as) Linker (ld) gcc core gcc wrapper gcc -S gcc -c gcc gcc -E
  • 6. Set of C Libraries Generally 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-14 SysPlay Workshops <workshop@sysplay.in> 6 All Rights Reserved.
  • 7. Binary Utilities as – GNU Assembler ld – GNU Linker gasp – GNU Assembler Pre-processor ar – Creates & Manipulates Archives nm – Lists the symbols in an Object file objcopy – Copies & Translates Object files objdump – Displays info about Content of the Object files ranlib – Generates an index to the content of Object files readelf – Displays info about an ELF format Object file size – Lists the sizes of sections within an Object file strings – Prints the strings of printable characters in Object files strip – Strips symbols from Object files c++filt – Converts low-level, mangled assembly labels resulting from overloaded C++ functions to their user-level names addr2line – Converts addresses into line numbers within original source files © 2010-14 SysPlay Workshops <workshop@sysplay.in> 7 All Rights Reserved.
  • 8. What is Cross? gcc Example: gcc vs cross gcc src Host Native gcc Target Native gcc © 2010-14 SysPlay Workshops <workshop@sysplay.in> 8 All Rights Reserved. Host prog src Host exe prog Target Tgt exe prog Cross gcc
  • 9. What is a Cross Toolchain? Toolchain which has all “cross” tools © 2010-14 SysPlay Workshops <workshop@sysplay.in> 9 All Rights Reserved.
  • 10. 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 minimal Ease of Development Complete accustomed Development Environment on the Host Favourite Editors, GUIs, … © 2010-14 SysPlay Workshops <workshop@sysplay.in> 10 All Rights Reserved.
  • 11. How to get a Cross Toolchain? Get it pre-compiled from vendors Popular: Code sourcery Local: Requirement specific Build 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-14 SysPlay Workshops <workshop@sysplay.in> 11 All Rights Reserved.
  • 12. Automated Build Tools Crosstool crosstool-ng.org Buildroot buildroot.org Ptxdist ptxdist.org © 2010-14 SysPlay Workshops <workshop@sysplay.in> 12 All Rights Reserved.
  • 13. Cross Toolchain Building Overview Build of various GNU Packages involved Typical 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/elf Tool Prefix: Same as the triplet © 2010-14 SysPlay Workshops <workshop@sysplay.in> 13 All Rights Reserved.
  • 14. Cross Toolchain Headers © 2010-14 SysPlay Workshops <workshop@sysplay.in> 14 All Rights Reserved. Linux Kernel Headers User Specific Headers extract C Library Headers User Space Headers From the Kernel Sources /usr/include
  • 15. Cross Toolchain Component Dependency Cross Full gcc (gcc, g++) kernel hdrs library hdrs © 2010-14 SysPlay Workshops <workshop@sysplay.in> 15 All Rights Reserved. Native gcc Cross binutils Cross bootstrap gcc (xgcc) Target Libraries binutils gcc library Source Code src
  • 16. Cross Toolchain Building Steps Set 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_install Build Binary Utilities Build the bootstrap Compiler (The C only Compiler) Build the C Library Build the full Compiler © 2010-14 SysPlay Workshops <workshop@sysplay.in> 16 All Rights Reserved.
  • 17. Building a Toolchain using Crosstool Install the Crosstool cd cross-tool-ng ./configure –prefix=/opt/board/ make make install cp ct-ng.comp /etc/bash_completion.d/ export PATH=$PATH:/opt/board/bin/ © 2010-14 SysPlay Workshops <workshop@sysplay.in> 17 All Rights Reserved.
  • 18. Building a Toolchain using Crosstool Build the Toolchain mkdir ct-build src cd ct-build/ mkdir .build cp Templates/Toolchain/sources.tgz .build/ (available from Downloads section of http://sysplay.in) ct-ng menuconfig ct-ng build © 2010-14 SysPlay Workshops <workshop@sysplay.in> 18 All Rights Reserved.
  • 19. Testing a Cross Toolchain Compile a C program to various stages Pre-process only Get Assembly Get Object Get Executable Compile a C program with headers Compile a C program with linking libraries Create a C Program with floating point operations Execute & Test the generated target programs Toolchain “Self Contained” Test © 2010-14 SysPlay Workshops <workshop@sysplay.in> 19 All Rights Reserved.
  • 20. What all have we learnt? W's of a Toolchain Compiler Binary Utilities Set of C Libraries W's & How's of Cross Toolchain? Building a Cross Toolchain Building Steps Automated Build Tools Testing a Cross Toolchain © 2010-14 SysPlay Workshops <workshop@sysplay.in> 20 All Rights Reserved.
  • 21. Any Queries? © 2010-14 SysPlay Workshops <workshop@sysplay.in> 21 All Rights Reserved.