Embedded Programming With Android: Bringing Up An Android System From Scratch

Paperback | August 13, 2015

byRoger Ye

not yet rated|write a review
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


Pricing and Purchase Info

$45.97 online
$45.99 list price
In stock online
Ships free on orders over $25

From the Publisher

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...

Roger Ye is a long-time embedded system programmer who currently leads a team of Android app developers at Intel Security. He has served as engineering manager for Intel, Motorola, and Emerson. At Motorola and Emerson he was extensively involved in embedded systems projects for mobile devices and telecom infrastructures.

other books by Roger Ye

Beyond Harvard
Beyond Harvard

Kobo ebook|Apr 19 2007

$7.69 online$9.99list price(save 23%)
Format:PaperbackDimensions:400 pages, 8.9 × 7 × 1 inPublished:August 13, 2015Publisher:Pearson EducationLanguage:English

The following ISBNs are associated with this title:

ISBN - 10:0134030001

ISBN - 13:9780134030005


Extra Content

Table of Contents

Preface         xv

Acknowledgments          xxi

About the Author          xxiii


Part I: Bare Metal Programming         1

Chapter 1: Introduction to Embedded System Programming         3

What Is an Embedded System?   3

Bare Metal Programming   3

Learning Embedded System Programming   5

Software Layers in an Embedded System   7

Tools and Hardware Platform   11

The Difference between Virtual Hardware and Real Hardware   11

Summary   12


Chapter 2: Inside Android Emulator         13

Overview of the Virtual Hardware   13

Configuring Android Virtual Devices   14

Hardware Interfaces   17

Serial   18

Timer   18

Summary   24


Chapter 3: Setting Up the Development Environment          25

The Host and Client Environments   25

Development Environment Setup   26

Downloading and Installing Android SDK   27

Downloading and Installing the GNU Toolchain for ARM   27

Integrated Development Environment   29

Your First ARM Program   29

Building the Binary   30

Running in the Android Emulator   32

makefile for the Example Projects   36

Summary   38


Chapter 4: Linker Script and Memory Map         39

Memory Map   39

Linker   41

Linker Script   51

Linker Script Example 53

Initializing Data in RAM   56

Summary   61


Chapter 5: Using the C Language         63

C Startup in a Bare Metal Environment   63

Calling Convention   78

Goldfish Serial Port Support   81

Summary   92


Chapter 6: Using the C Library         93

C Library Variants   93

Newlib C Library   96

Common Startup Code Sequence   97

CS3 Linker Scripts   97

Customized CS3 Startup Code for the Goldfish Platform   103

System Call Implementations   104

Running and Debugging the Library   112

Using Newlib with QEMU ARM Semihosting   116

Summary   122


Chapter 7: Exception Handling and Timer           125

Goldfish Interrupt Controller   125

The Simplest Interrupt Handler   128

Nested Interrupt Handler   140

Testing System Calls/Software Interrupts   163

Timer   164

Real-Time Clock   172

Summary   181


Chapter 8: NAND Flash Support in Goldfish          183

Android File System   183

NAND Flash Properties   185

NAND Flash Programming Interface in the Goldfish Platform   187

Memory Technology Device Support   188

MTD API   189

NAND Flash Programming Interface Test Program   206

Summary   216


Part II: U-Boot         217

Chapter 9: U-Boot Porting   219

Introducing U-Boot   219

Downloading and Compiling U-Boot   220

Debugging U-Boot with GDB   224

Porting U-Boot to the Goldfish Platform   227

Summary   246


Chapter 10: Using U-Boot to Boot the Goldfish Kernel          249

Building the Goldfish Kernel   249

Prebuilt Toolchain and Kernel Source Code   250

Running and Debugging the Kernel in the Emulator   252

Booting Android from NOR Flash   254

Booting Android from NAND Flash   270

Summary   280


Part III: Android System Integration         281

Chapter 11: Building Your Own AOSP and CyanogenMod          283

Introducing AOSP and CyanogenMod   283

Setting Up an Android Virtual Device   284

AOSP Android Emulator Build   288

CyanogenMod Android Emulator Build   297

Summary   307


Chapter 12: Customizing Android and Creating Your Own Android ROM          309

Supporting New Hardware in AOSP   309

Supporting New Hardware in CyanogenMod   332

Summary   338


Part IV: Appendixes           339

Appendix A: Building the Source Code for This Book         341

Setting Up the Build Environment   341

Setting Up a Virtual Machine   344

Organization of Source Code   344

Source Code for Part I   345

Source Code for Part II   350

Source Code for Part III   352


Appendix B: Using Repo in This Book          355

Resources for Repo   355

Syncing a New Source Tree In Minutes   355

Downloading Git Repositories Using Local Manifest   356


Index            359