290 likes | 389 Views
Cross Development. Building & Porting Operating Systems. What is a tool chain?. A set of software utilities used to perform an operation. GNU Toolchain - a blanket term for a collection of programming tools produced by the GNU Project. Used for OS and application development.
E N D
Cross Development Building & Porting Operating Systems
What is a tool chain? A set of software utilities used to perform an operation. GNU Toolchain- a blanket term for a collection of programming tools produced by the GNU Project. Used for OS and application development.
For Embedded Systems Usual development tools available on a GNU/Linux workstation is a native toolchain Embedded systems typically run on one platform while building applications for another. Therefore, cross-compiling toolchains are generally used. They run on your workstation but generate code for your target.
Embedded Systems x86 Source code Compilation machine Cross-compiling toolchain Native toolchain x86 ARM x86 binary Execution machine ARM binary
build host target build host target Native build used to build the normal gcc of a workstation Cross build used to build a toolchain that runs on your workstation but generates binaries for the target The most common solution in embedded build host target build host target Canadian build used to build on architecture A atoolchain that runs on architecture B and generates binaries for architecture C Cross-native build used to build a toolchain that runs on your target and generates binaries for the target
What is it composed of? Binutils Kernel headers C/C++ libraries GCC compiler GDB debugger (optional) Source: free-electrons.com
Binutils • Binutils set of tools to generate and manipulate binaries for a given CPU architecture. The main ones are: • ld - the linker. • as - the assembler. • Ar, ranlib - A utility for creating, modifying and extracting from archives. • c++filt - Filter to demangle encoded C++ symbols. • addr2line - Converts addresses into filenames and line numbers. • Others: Gprof,Nlmconv,nm,objcopy,objdump,ranlib, Readelf, Size,Strings, strip,windres
C library • Interface between the applications and the kernel • Provides the well-known standard C API to ease application development • Several C libraries are available:glibc, uClibc, eglibc, dietlibc, newlib, etc. • The choice of the C library must be made at the time of the cross-compiling toolchain generation, as the GCC compiler is compiled against a specific C library. Kernel C Library Applications
Kernel headers • The C library and compiled programs needs to interact with the kernel • Available system calls and their numbers • Constant definitions • Data structures, etc. • Therefore, compiling the C library requires kernel headers, and many applications also require them. Kernel Kernel headers C Library Applications Available in <linux/...> and <asm/...> and a few other directories corresponding to the ones visible in include/ in the kernel sources
GCC compiler • GCC: GNU C Compiler, the famous free software compiler • Can compile C, C++, Ada, Fortran, Java, Objective-C, Objective-C++, and generate code for a large number of CPU architectures, including ARM, AVR, Blackfin, CRIS, FRV, M32, MIPS, MN10300, PowerPC, SH, v850, i386, x86_64, IA64, Xtensa, etc. • Available under the GPL license, libraries under the LGPL.
GDB debugger • The debugger on GNU/Linux,available for most embedded architectures. • Console interface or GUI available, also gdbserver • Can be used to control the execution of a program, set breakpoints or change internal variables. Can also see memory images, useful if system crashes. • Use of terminal emulators – Ensure you can access the serial port (/dev/ttys0) (chmod to change rights of files)– Minicom most commonly used, usually installed in distribution, Others include UUCP cu and C-Kermit
Using ‘make’ Video: Compiling ARM • make – used after every tool if built from scratch • Brings all of the tools together, and makes use of them to build the project • Processes a makefile that dictates the build procedure • Generated files depend on source files, if a source file is updated so is the generated file! • Likewise, if a source is not updated, and the generated file already exists... It isn’t re-built • Pseudo targets, allow for install and clean etc.. Tip: Use SVN/Configuration facility
Where does it fit in? Basic example of a typical self-build GNU toolchain Source: eejournal.com
Cross Development Environment • In today’s embedded development or development as a whole, is rare that developers develop & write code on the devices themselves. • Because of this, it means there is a need for cross development environments which differ dependent on the target hardware. • Mobile Applications – Android, iOS, Windows, all have different cross development environments – which enable programmers to develop for there chosen platform.
Device Development • When developing system software for embedded devices, one of the important facts is figuring out how to the code on the board, and proceeding with the code execution. • The deployment of code on devices can be achieved in many ways which depends on the target product device that the build was built for and its on board features. • With most of ‘OUR’ late embedded development experiences, it was achieved by populating an micro SD card with kernel/boot loader images along with file systems which are recognized by the boards CPU’s and booted accordingly. • Difficulties – Errors downloading from git repositories • Bad or corrupt repos
Data Transfers • Ethernet Cables • Year 2, Configuring Puppeteer boards • COM Ports • Virtual USB COM port • RS-232 • Micro SD Cards & Reader • Loading Kernel Images, boot loaders & File systems
BUILDROOT • Build root is a set of Makefiles and patches which make it easy to generate a complete embedded Linux system. • It is very useful for people working with embedded systems using various CPU architectures: ARM, x86, MIPS, PowerPC and more. • Automating the build process for your chosen embedded system & easing the cross compilation generation.
The “Make” Command • The ‘Make’ Utilities purpose is to determine automatically which pieces of a large program need to be recompiled & then issue certain commands to recompile them. • Using makerequires Makefiles to be written, which describes relationships amongst files in your program – stating commands for updating each file. • Once a Makefile exists, each time source files are changed the simple shell command make performs all necessary recompilations, executing commands in the Makefile to update one or more target names. • Few Make Options: ( -b, -C dir, -d, -e, -f file, -j jobs, -k and many more) • The GNU implantation of the make command was written by Richard Stallman and Roland McGrath.
Debugging • Embedded systems development relies on debuggers talking to chips to perform operating like single stepping & break pointing. Debugging stages may be performed at different levels, depending on facilities that are available to the debugger. • It can be achieved in two ways , internallyor externally. • Internal Debugging by Running pieces of software through tools viewing the code running on the processor. Allowing the starting or stopping operations , which can be done using emulators.
Debugging External • Using serial ports (RS232/USB COM PORT) and JTAG(Joint Test Action Group) hardware interfaces. • JTAG adapters uses JTAG as the transport mechanism to access on-chip debug modules inside the CPU. These modules let developers debug the software directly at machine instruction level. • Most Digital electronic products today's such as mobile phonesor a wireless access point generally have no other debug or test interfaces.
SOFTWARE DEVELOPMENT KIT (SDK) • Set of software development tools that allows for the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system or similar platform • A software engineer typically receives the SDK from the target system developer • Providers of SDKs for specific systems or subsystems may sometimes substitute a more specific term instead of software. For instance, both Microsoft and Apple provide driver development kits (DDK) for developing device drivers
WINDOWS SDK • Microsoft Windows SDK, Platform SDK and .NET Framework SDK • Platform SDK specializes in developing applications for Windows 2000, XP and Windows Server 2003. .NET Framework SDK is dedicated to developing applications for .NET Framework 1.1 and .NET Framework 2.0. Windows SDK is the successor of the two and supports developing applications for Windows XP, Windows Vista, Windows 7, Windows Server 2008, .NET Framework 3.0, .NET Framework 3.5, and .NET Framework 4.0.
THE WINDOWS SDK CONTAINS THE FOLLOWING • For Win32 development: • 1,915 Headers • 348 Libraries • 100 Tools • For .NET (managed code) development: • 14 Reference Assemblies supporting .NET, Tablet PC, Windows PowerShell, MMC, etc. • 33 Intellisense Files • 70 .NET 2.0 Tools + 10 .NET 3.0 Tools + 35 .NET 4.0 Tools • For Visual Studio 2005/2008/2010 integration • Utilities to enable Visual Studio 2005/2008 to easily use Windows SDK headers and libraries • Visual Studio 2005/2008 Wizards for creating Windows Media Player applications
ANDROID SDK AND ECLIPSE • Latest version of JDK ( Java Development Kit) • Eclipse IDE • SDK Starter Package (it includes only the core SDK Tools) • ADT Plugin for Eclipse • Android SDK and AVD Manager (a tool included in the SDK starter package) to download essential SDK components into your development environment.
Android SDK Tools • Android EmulatorA QEMU-based device-emulation tool that you can use to design, debug, and test your applications in an actual Android run-time environment.Hierarchy Viewer (hierarchyviewer)Lets you debug and optimize an Android application's user interface.layoutoptLets you quickly analyse your application's layouts in order to optimize them for efficiency.MksdcardHelps you create a disk image that you can use with the emulator, to simulate the presence of an external storage card (such as an SD card).MonkeyRuns on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.
Android SDK Tools • Monkey runnerProvides an API for writing programs that control an Android device or emulator from outside of Android code.ProGuardShrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names.sqlite3Lets you access the SQL Lite data files created and used by Android applications.traceviewProvides a graphical viewer for execution logs saved by your application.zipalignOptimizes .apk files by ensuring that all uncompressed data starts with a particular alignment relative to the start of the file. This should always be used to align .apk files after they have been signed.