Raspberry Pi Assembly Language Raspbian [Third Edition]

Posted on February 2, 2015


Raspberry Pi Assembly Language RASPBIAN Beginners is your hands-on guide to learning to program ARM machine code on your Raspberry Pi. With nothing other than the Raspbian Operating System installed on your Raspberry Pi, this book shows you how to access all the tools that you’ll need to create your own machine code programs using assembly language. Ideal for the novice, this book starts from first principles and leads you comfortably on your way to become an accomplished programmer.

This book gives a great introduction to assembler programming.  This is a great book. Bruce Smith writes great books. Warren L. Gibbs

Buy Now or Continue Reading:

amazon_comamazon_co_ukgumroad1  iBooks  SmashwordsWordery

Providing lucid descriptions, award winning author Bruce Smith keeps things simple and includes plenty of program examples you can try for yourself. Ideas and concepts are introduced in the order required so you should never be left wondering. Just some of the many features include:

  • 260 pages
  • Practical approach with program example
  • GCC assembler and linker
  • ARM registers and arrangements
  • Addressing modes
  • Use of operating system Syscalls
  • Debugging with GDB
  • Using libc function calls
  • Programming the GPIO

Examples have been provided and written using the GCC Compiler running under the Raspbian Operating System on the Raspberry Pi, all of which can be downloaded from the this website here.

The updated and revised THIRD edition of this book was published on 2nd July 2016.

The contents of this book are applicable to the RPi 3, 2, 1 and Zero.

Raspberry Pi Assembly Language Raspbian: Reviews

One of the Best Assembly Language Books. 24 Feb. 2015, By ED Published on Amazon.com [Edited version]

Probably one of the best assembly language books I’ve seen. Although I used to do some assembly language programming many years ago, this book was a very good refresher and clearly explained the Raspbian assembly language. Don’t forget to go to the author’s web site and pick up the errata. The web site also has links to other sites and pdfs, including a tabular chart(s) of the assembly directives. Highly recommended.

In my opinion this book is 10/10 and a must for anybody starting off or getting back into assembly language…Thank’s Bruce for a valuable resource!… 17 Feb 2015, By Peter GostanianPublished on wordery.com

In my opinion this book is a 10/10 and a must for anyone starting off or getting back into assembly language programming. It saved me a lot of time by having all the required information I needed in one place. Thanks Bruce for this valuable resource!

Raspberry Pi Insider Guide: Contents List

1: Welcome Home

Imagination Unlimited, Start Experimenting, Raspbian Pi GCC, Learn By Example, What Will You Learn? Companion Website, Notation in Use, Acknowledgements

2: Starting Out

Numbers with Meaning, ARM Instructions, The Transformation Process, Why Machine Code?, Language Levels, Into Orbit, RISC and Instruction Sets, Assembler Structure, Error Of Your Ways,, The Raspberry Pi ARM Chip, Cross Compiler

3: First Time Out

The Command Line, Creating A Source File, Come to the Execution, Assembler Errors, The Components, Lack of _start, Linking Files, Tidying Up, A Comment On Comments

4: Bits of a RISC Machine

Binary to Decimal, Decimal to Binary, Binary to Hex, Hex to Decimal and Back, Binary Arithmetic, Addition, Subtraction, Twos Complement Numbers, When Two’s Doesn’t Add Up

5: ARM Arrangements

Word Lengths, Byte and Word Accessed Memory, Registers, R15 – Program Counter, Current Program Status Register, Bits and Flags, Setting Flags, S Suffix, R14: The Link Register, R13: Stack Pointer

6: Data Processing

Arithmetic Instructions, Addition, Integer to Register Transfer, Subtraction, Multiplication, Move Instructions, Compare Instructions

7: Raspbian Ins and Outs

SWI and SVR Commands, Writing to the Screen. Reading From the Keyboard, Makefiles

8: Logical Operations

Logical AND, Logical OR, Logical EOR, Logical Instructions, ORR to Convert Character Case, Toggling Characters with EOR, Bit Clear with BIC, Flag Tests, Syscall Registers

9: Conditional Execution

Single Flag Condition Codes, Multiple Flag Condition Code, Mixing the S Suffix

10:  Branch, Compare and SWI

Branch Instructions, The Link Register, Using Compare Instructions , Compare Forward Thinking, Using Conditionals Effectively, Branch Exchange

11: Shifts and Rotates

Logical Shifts, Logical Shift Right, Arithmetic Shift Right, Rotations, Extended Rotate, Uses of Shifts and Rotates, Immediate Constant Range.

12: Smarter Numbers

Long Multiplication, Long Accumulation, Division and Remainder, Smarter Simple Multiplication

13: Register 15

Pipelining, Calculating Branches

14: Debugging with GDB

Frozen Cases, Assembling for GDB, The Disassembler, Breakpoints, Memory Dump

15: Data Transfer

ADR Directive, Indirect Addressing, Immediate Constants, Pre- Indexed Addressing, Accessing Memory Bytes, Address Write Back, Post- Indexed Addressing, Byte Conditions, PC Relative Addressing

16: Block Transfer

Counting Options, Write Back, Block Copy Routine

17: Stacks

Push and Pull, Stack Growth, Stack Application

18: Directives

Data Storage Directives, ALIGNing Data

19: Using libc

Using C Functions in Assembler, Source File Structure, Investigating the Executable, Number Input with Scanf, Getting This Information

20: Writing Functions

Function Standards, Register Use, More Than Three, Preserving Link and Flags

21 : Disassembling C

GCC – The Swiss Army Knife, A Simple C Framework, Getting the Assembler, Building Blocks, A printf Example, Frame Pointer Variables, Disassembling Syscalls, n Summary

22 : Floating Point

VFP2 Architecture, The Register File, Managing and Printing, Load, Store and Move, Precision Conversion, Vector Arithmetic

23: VFP Control Register

Conditional Execution, Scalar and Vector Operations, Which Type of Operator? Len and Stride

24: Thumb Code

Differences, Assembling Thumb, Accessing High Registers
, Stack Operators , Single and Multi- Register, Functions in Thumb

25: GPIO Functions

The GPIO Controller, Building the Code, Virtual Memory, Using and Adapting , Other GPIO Functions

26: Exception Handling

Modes of Operation, Vectors, Register Arrangements, Exception Handling, MRS and MSR, Interrupts When?, Your Interrupt Decisions, Returning From Interrupts, Writing Interrupt Routines

27: System On Chip

The ARM Chip & Instruction Sets, Co- Processors, Pipeline, Memory & Caches,  The GPU , In Summary


A: ASCII Character Set
B: Raspbian Syscalls
C: Companion Website