Professional Embedded ARM Development (2014)
IN THE WORLD OF EMBEDDED SYSTEMS, you can’t work for long without working on an ARM CPU. ARM CPUs are known for their low electric power consumption, making them ideal for mobile embedded systems. Since 2012, virtually all PDAs and smartphones contain ARM CPUs, and ARMs account for 75 percent of all 32-bit embedded systems and 90 percent of embedded RISC systems. In 2005, 98 percent of more than one billion mobile phones sold used at least one ARM processor. You can find ARM processors in mobile phones, tablets, MP3 players, handheld games consoles, calculators, and even computer peripherals such as Bluetooth chips and hard disk drives.
With more than 1 billion ARM processors shipped every 2 months, it is surprising to know that ARM does not actually make processors, but rather designs the core, and ARM partners use those designs to make their own processors, adding external devices and peripherals or modifying the core for speed or power consumption benefits. By working closely with manufacturers, ARM has created a huge ecosystem. The result is an amazing range of processors, used for all types of devices in all classes of devices, and all running using a common architecture, enabling developers to switch easily from one processor to another.
ARM processors are by no means tiny processors with limited performance; they range from micro-controller devices used in the smallest of systems all the way to 64-bit processors used in servers.
This book introduces you to embedded ARM systems, how to get them up and running, how to develop for this platform, and some of the devices available in this huge ecosystem.
WHO THIS BOOK IS FOR
This book is primarily for developers who want to start in the embedded field. A basic understanding of C is required for most examples, but no assembly knowledge is required.
This book is also for developers who want better knowledge of the internals of a processor and to understand what goes on deep inside the core.
WHAT THIS BOOK COVERS
This book covers the advances in technology for ARM processors and focuses on the more recent ARMv7 architecture, for Cortex-A, Cortex-R, and Cortex-M devices. If you use the Cortex range of processors, you will feel at home, but if you use ARM Classic cores, you can also find information and a listing of the differences between architectures and platforms.
HOW THIS BOOK IS STRUCTURED
This book is designed to give as much information as possible to someone who does not have working experience with ARM processors. To understand ARM’s philosophy, it is necessary to understand where ARM came from and how the ARM processor was born. This book then covers all aspects of an embedded project: understanding the processor and the extensions, understanding assembler, creating your first program using a more familiar C, and then continuing to debugging and optimization.
Chapter 1, “The History of ARM,” gives an outline of the fascinating history of ARM; where it came from and why it is where it is today.
Chapter 2, “ARM Embedded Systems,” gives an explanation on what an embedded system is and a presentation of the strong points of an ARM system.
Chapter 3, “ARM Architecture,” lists the different elements that compose an ARM processor and how to use them effectively.
Chapter 4, “ARM Assembly Language,” gives an introduction to ARM assembly and explains why understanding assembly is so important.
Chapter 5, “First Steps,” presents some simulators and real-world cards to write programs, both to get an ARM processor started and to use as a basis for more complex programs. This chapter also presents some real-world scenario projects.
Chapter 6, “Thumb Instruction Set,” presents the Thumb mode and also the Thumb-2 extension. Cortex-M processors use only Thumb mode, but Thumb can also be used on every modern processor where code density is important.
Chapter 7, “Assembly Instructions,” presents a list of assembly instructions in ARM’s Unified Assembly Language, and explains their use with easy-to-follow programs.
Chapter 8, “NEON,” presents NEON, ARM’s advanced Single Instruction Multiple Data processor and shows how you can use it to accelerate mathematically intensive routines.
Chapter 9, “Debugging,” describes debugging, what is required to debug a program, and what you can achieve. It uses several real-world examples.
Chapter 10, “Writing Optimized C,” describes the final part of any application—optimization. With some simple examples, you will learn how to write optimized code, and understand what happens deep inside the processor to implement further optimization.
Appendix A, “Terminology,” explains some of the words and terms you will encounter when working on embedded systems, and more specifically, ARM embedded systems.
Appendix B, “ARM Architecture Versions,” lists the different ARM Architectures that exist, and explain what each version brought in terms of technological advancement, but also which processor belongs to which architecture.
Appendix C, “ARM Core Versions,” looks closer at the ARM cores, and presents the changes in each processor. Discussing briefly each processor from ARM6 onwards, it goes into more detail for modern Cortex-class processors.
Appendix D, “Neon Intrinsics and Instructions,” lists the different instructions available for ARM’s NEON engine, and also presents the intrinsics used to perform NEON calculation in an optimized way, using C.
Appendix E, “Assembly Instructions,” lists the different assembly instructions used in UAL, with a description of each, as well as a list of Thumb instructions used on different Cortex-M class processors.
WHAT YOU NEED TO USE THIS BOOK
Most people imagine an embedded system surrounded with costly electronics and expensive software licenses, but the truth is that you can start embedded development with little investment. To start, you need a development computer. Examples are given for Linux, but you can also use Windows and MacOS. Royalty-free compilers are proposed, and you can use a free ARM simulator for your first programs, but later, a small ARM system is advisable: either an evaluation board from a manufacturer (two are presented), or you can use an inexpensive small-factor computer, such as a Raspberry Pi or an Arduino Due.
To run the samples in the book, you need the following:
Linux development computer
Mentor Graphics compiler suite
Atmel SAM D20 Xplained Pro evaluation board
Silicon Lab’s STK3200 and STK3800 evaluation boards
The source code for the samples is available for download from the Wrox website at:
To help you get the most from the text and keep track of what’s happening, we’ve used a number of conventions throughout the book.
NOTE Notes indicate notes, tips, hints, tricks, and asides to the current discussion.
As for styles in the text:
We highlight new terms and important words when we introduce them.
We show keyboard strokes like this: Ctrl+A.
We show filenames, URLs, and code within the text like so: persistence.properties.
We present code in this way:
We use a monofont type with no highlighting for most code examples.