Embedded Programming with Android: Bringing Up an Android System from Scratch

Book description

The First Practical, Hands-On Guide to Embedded System Programming for Android

Today, embedded systems programming is a more valuable discipline than ever, driven by fast-growing, new fields such as wearable technology and the Internet of Things. In this concise guide, Roger Ye teaches all the skills you’ll need to write the efficient embedded code necessary to make tomorrow’s Android devices work.

The first title in Addison-Wesley’s new Android™ Deep Dive series for intermediate and expert Android developers, Embedded Programming with Android™ draws on Roger Ye’s extensive experience with advanced projects in telecommunications and mobile devices. Step by step, he guides you through building a system with all the key components Android hardware developers must deliver to manufacturing. By the time you’re done, you’ll have the key programming, compiler, and debugging skills you’ll need for real-world projects.

First, Ye introduces the essentials of bare-metal programming: creating assembly language code that runs directly on hardware. Then, building on this knowledge, he shows how to use C to create hardware interfaces for booting a Linux kernel with the popular U-Boot bootloader. Finally, he walks you through using filesystem images to boot Android and learning to build customized ROMs to support any new Android device. Throughout, Ye provides extensive downloadable code you can run, explore, and adapt.

You will

  •  Build a complete virtualized environment for embedded development

  • Understand the workflow of a modern embedded systems project

  • Develop assembly programs, create binary images, and load and run them in the Android emulator

  • Learn what it takes to bring up a bootloader and operating system

  • Move from assembler to C, and explore Android’s goldfish hardware interfaces

  • Program serial ports, interrupt controllers, real time clocks, and NAND flash controllers

  • Integrate C runtime libraries

  • Support exception handling and timing

  • Use U-Boot to boot the kernel via NOR or NAND flash processes

  • Gain in-depth knowledge for porting U-Boot to new environments

  • Integrate U-Boot and a Linux kernel into an AOSP and CyanogenMod source tree

  • Create your own Android ROM on a virtual Android device

  • Table of contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. About the Android Deep Dive Series
      1. About the Series Editor
    5. Dedication Page
    6. Contents in Brief
    7. Contents
    8. Preface
      1. Who Should Read This Book
      2. How This Book Is Organized
      3. Example Code
        1. Conventions Used in This Book
    9. Acknowledgments
    10. About the Author
    11. I: Bare Metal Programming
      1. 1. Introduction to Embedded System Programming
        1. What Is an Embedded System?
        2. Bare Metal Programming
        3. Learning Embedded System Programming
        4. Software Layers in an Embedded System
        5. Tools and Hardware Platform
        6. The Difference between Virtual Hardware and Real Hardware
        7. Summary
      2. 2. Inside Android Emulator
        1. Overview of the Virtual Hardware
        2. Configuring Android Virtual Devices
        3. Hardware Interfaces
        4. Serial
        5. Timer
        6. Summary
      3. 3. Setting Up the Development Environment
        1. The Host and Client Environments
        2. Development Environment Setup
        3. Downloading and Installing Android SDK
        4. Downloading and Installing the GNU Toolchain for ARM
        5. Integrated Development Environment
        6. Your First ARM Program
        7. Building the Binary
        8. Running in the Android Emulator
        9. makefile for the Example Projects
        10. Summary
      4. 4. Linker Script and Memory Map
        1. Memory Map
        2. Linker
          1. Symbol Resolution
          2. Relocation
          3. Section Merging
          4. Section Placement
        3. Linker Script
          1. Linker Script Example
        4. Initializing Data in RAM
          1. Specifying Load Address
          2. Copying .data to RAM
        5. Summary
      5. 5. Using the C Language
        1. C Startup in a Bare Metal Environment
          1. Stack
          2. Global Variables
          3. Read-Only Data
          4. Startup Code
        2. Calling Convention
          1. Calling C Functions from Assembly Language Code
          2. Calling Assembly Language Functions from C Code
        3. Goldfish Serial Port Support
          1. Check Data Buffer
          2. Data Input and Output
          3. Unit Test of Serial Functions
        4. Summary
      6. 6. Using the C Library
        1. C Library Variants
          1. C Library Variants in an Operating System
          2. C Library Variants in Bare Metal Environment
        2. Newlib C Library
        3. Common Startup Code Sequence
        4. CS3 Linker Scripts
        5. Customized CS3 Startup Code for the Goldfish Platform
        6. System Call Implementations
        7. Running and Debugging the Library
        8. Using Newlib with QEMU ARM Semihosting
          1. Semihosting Support in Newlib C
          2. Semihosting Example Code
        9. Summary
      7. 7. Exception Handling and Timer
        1. Goldfish Interrupt Controller
        2. The Simplest Interrupt Handler
          1. Interrupt Support Functions
          2. Implementation of the Simplest Interrupt Handler
        3. Nested Interrupt Handler
          1. Implementation of the Nested Interrupt Handler
          2. Testing Nested Interrupts and Discovering the Processor Mode Switch
        4. Testing System Calls/Software Interrupts
        5. Timer
          1. Goldfish-Specific Timer Functions
          2. U-Boot API
        6. Real-Time Clock
          1. Unit Test of Timer and RTC
        7. Summary
      8. 8. NAND Flash Support in Goldfish
        1. Android File System
        2. NAND Flash Properties
        3. NAND Flash Programming Interface in the Goldfish Platform
        4. Memory Technology Device Support
        5. MTD API
          1. U-Boot API to Support NAND Flash
          2. Goldfish NAND Flash Driver Functions
        6. NAND Flash Programming Interface Test Program
          1. NAND Flash Information from the Linux Kernel
          2. NAND Flash Test Program
        7. Summary
    12. II: U-Boot
      1. 9. U-Boot Porting
        1. Introducing U-Boot
        2. Downloading and Compiling U-Boot
        3. Debugging U-Boot with GDB
        4. Porting U-Boot to the Goldfish Platform
          1. Creating a New Board
          2. Processor-Specific Changes
          3. Board-Specific Changes
          4. Device Driver Changes
        5. Summary
      2. 10. Using U-Boot to Boot the Goldfish Kernel
        1. Building the Goldfish Kernel
        2. Prebuilt Toolchain and Kernel Source Code
        3. Running and Debugging the Kernel in the Emulator
        4. Booting Android from NOR Flash
          1. Creating the RAMDISK Image
          2. Creating the Flash Image
          3. Booting Up the Flash Image
          4. Source-Level Debugging of the Flash Image
        5. Booting Android from NAND Flash
          1. Preparing system.img
          2. Booting from NAND Flash
        6. Summary
    13. III: Android System Integration
      1. 11. Building Your Own AOSP and CyanogenMod
        1. Introducing AOSP and CyanogenMod
        2. Setting Up an Android Virtual Device
        3. AOSP Android Emulator Build
          1. AOSP Build Environment
          2. Downloading the AOSP Source
          3. Building AOSP Android Emulator Images
          4. Testing AOSP Images
        4. CyanogenMod Android Emulator Build
          1. Downloading the CyanogenMod Source
          2. Building CyanogenMod Android Emulator Images
          3. Testing CyanogenMod Images
        5. Summary
      2. 12. Customizing Android and Creating Your Own Android ROM
        1. Supporting New Hardware in AOSP
          1. Building the Kernel with AOSP
          2. Building U-Boot with AOSP
          3. Booting Android with U-Boot from NAND Flash
        2. Supporting New Hardware in CyanogenMod
          1. Building the Kernel with CyanogenMod
          2. Building U-Boot and Booting Up CyanogenMod
        3. Summary
    14. IV: Appendixes
      1. A. Building the Source Code for This Book
        1. Setting Up the Build Environment
        2. Setting Up a Virtual Machine
        3. Organization of Source Code
        4. Source Code for Part I
          1. Building and Testing from the Command Line
          2. Building and Testing in Eclipse
        5. Source Code for Part II
        6. Source Code for Part III
          1. Building AOSP
          2. Building CyanogenMod
      2. B. Using Repo in This Book
        1. Resources for Repo
        2. Syncing a New Source Tree In Minutes
        3. Downloading Git Repositories Using Local Manifest
    15. Index
    16. Code Snippets

    Product information

    • Title: Embedded Programming with Android: Bringing Up an Android System from Scratch
    • Author(s):
    • Release date: August 2015
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780134030920