Jump to ratings and reviews
Rate this book

Programming with 64-Bit ARM Assembly Language: Single Board Computer Development for Raspberry Pi and Mobile Devices

Rate this book
Introduction General preface information in most computer books. Chapter 1: Getting Started
Provide a bit of background and history of the ARM Processor leading up to the modern 64-bit processors that this book is about. Covers what you need to write programs like those in this book. GNU GCC compiler, GDB, a text editor, etc. Covers hardware you require to run the programs in this book including how to run a Raspberry Pi in 64-bit mode or using another SBC like the NVidia Jetson Nano. Talk about how programs are represented in memory and then how you use an Assembler to generate them. Cover the linking process and give a very small example. The chapter concludes with a simple "Hello World" program written in ARM 64-bit Assembler. About the ARM ProcessorWhat You Will LearnWhy Use AssemblyTools You NeedComputers & NumbersARM Assembly InstructionsCPU RegistersARM Instruction FormatMemoryAbout the GCC AssemblerHello WorldAbout the Starting CommentWhere to StartAssembly InstructionsDataCalling LinuxReverse Engineering Our Program The goal is to always have working sample programs, this is the first, to just ensure the reader can enter, assemble and link. Chapter 2: Loading, Adding & SubtractingNegative NumbersAbout Two's ComplementAbout Gnome Programmer's CalculatorAbout One's ComplementBig vs. Little EndianAbout Bi-endianPros of Little EndianShifting & RotatingAbout Carry FlagAbout the Barrel ShifterBasics of shifting and rotatingLogical Shift LeftLogical Shift RightArithmetic Shift RightRotate RightRotate Right ExtendMOV/MVNAbout MOVTThe Dreaded Flexible Operand2Register & ShiftSmall Number & RotationMVNMOV ExamplesADD/ADCAdd With CarrySUBChapter 3: Tooling Up Now that we can start to write some longer code, we need to get into debugging. We also introduce makefiles. Cover the basics and typical workflows for writing/debugging programs. GNU MakeRebuilding a fileA Rule for Building .s filesDefining VariablesCross CompilingBuilding for ARM on IntelBuilding for AndroidBuilding for iOSGDBPreparing to DebugBeginning GDBSource Control and Build ServersGitJenkinsChapter 4: Controlling Program Flow Introduce how to do if/else statements and loops. Introduce design patterns. Talk more about making your programs readable and maintainable. Unconditional BranchAbout the CPSRBranch on ConditionAbout the CMP InstructionLoopsFOR LoopsWhile LoopsIf/Then/ElseLogical OperatorsANDEORORRBICDesign PatternsConverting Integers to AsciiUsing Expressions in Immediate ConstantsStoring a Register to MemoryWhy Not Print in Decimal?Performance of Branch InstructionsMore Comparison InstructionsSummaryChapter 5: Thanks for the Memories Covers loading from and storing to the Pi's memory. Indexed memory operation, etc. Defining Memory ContentsLoading a RegisterPC Relative AddressingLoading from MemoryIndexing Through MemoryWrite BackPost-Indexed AddressingConverting to Upper-caseStoring a RegisterDouble RegistersSummaryChapter 6: Functions & the StackStacks on LinuxBranch with LinkNesting Function CallsFunction Parameters & Return ValuesManaging the RegistersSummary of the Function Call AlgorithmUpper-Case RevisitedStack FramesStack Frame ExampleDefining SymbolsOne More OptimizationMacrosInclude DirectiveMacro DefinitionLabelsWhy Macros?SummaryChapter 7: Linux Operating System Services Cover how Linux system calls work from Assembler. Cover how to do basic file I/O and other useful tasks like timing code. So Many ServicesCalling ConventionStructuresWrappersConverting a File to Upper CaseOpening a FileError CheckingLoopingSummaryChapter 8: Programming GPIO Pins Create a simple Assembler program to flash some LEDs attached via a breadboard to the GPIO pins. GPIO OverviewIn Linux, Everything is a FileFlashing LEDsMoving Closer to the MetalAbout Raspberry Pi 4 RAMIn Devices, Everything is MemoryRegisters in BitsGPIO Function Select RegistersGPIO Output Set and Clear RegistersMore Flashing LEDsRoot Acce

456 pages, Paperback

Published May 16, 2020

30 people are currently reading
48 people want to read

About the author

Stephen Smith

5 books2 followers
Stephen Smith is a software architect, located in Gibsons, BC, Canada. He's been developing software since high school, or way too many years to record. He is an expert in Artificial Intelligence and Assembly Language programming, earned his Advanced HAM Radio License, and enjoys mountain biking, hiking, and nature photography. He volunteers for Sunshine Coast Search and Rescue. He is the author of Raspberry Pi Assembly Language Programming: ARM Processor Coding, Programming with 64-Bit ARM Assembly Language: Single Board Computer Development for Raspberry Pi and Mobile Devices, and RP2040 Assembly Language Programming: ARM Cortex-M0+ on the Raspberry Pi Pico, all published by Apress. Also, he writes his popular technology blog, at smist08.wordpress.com.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
5 (33%)
4 stars
8 (53%)
3 stars
2 (13%)
2 stars
0 (0%)
1 star
0 (0%)
Displaying 1 - 2 of 2 reviews
Profile Image for Paul.
431 reviews3 followers
June 1, 2022
A good introduction to learning 64-Bit ARM

I have written a lot of assembler in the distant past but aarch64 is new to me hence selecting this book to read. I mention this simply because having already got a good understanding of other cpu assembler instructions I am not coming at this cold.

For me this was a pretty good read. It covered an unexpectedly wide area of not just aarch64 but also the FPU, NEON, optimizing code, hacking, and a few other areas. Each chapter gives enough detail and flavour of the topic. Each area covered was not exhaustive which I think was good as it keeps the chapters short and if you are interested and want to know more a Google search is all you need.

The examples given are good and each chapter builds on what was taught in the previous chapters.
The exercises were short enough that I attempted a few just to make sure I could follow the concepts given.

Overall for me this was a very good introduction. Recommended.
Profile Image for Dexter.
101 reviews5 followers
December 11, 2022
This is the best introduction to AARCH64v8 (ARM 64-bit) assembly that I have read. In addition to the basics the book covers FPU operations and parallel processing on the Neon co-processor. is so good that I am giving it to some of the more junior developers on my team for an in-depth understanding of this versatile 64-bit RISC processor to help optimized critical pieces of their code relative to the ISA and understand disassembly when debugging.

Now I am looking for a more advanced treatise using advanced functionality like page tables, MMUs, exception levels (EL0-EL3) for doing operating systems work using a similar effective format to Stephen Smith’s book.
Displaying 1 - 2 of 2 reviews

Can't find what you're looking for?

Get help and learn more about the design.