Programming with 64-Bit ARM Assembly Language: Single Board Computer Development for Raspberry Pi and Mobile Devices 1st ed. [Minkštas viršelis]

  • Formatas: Paperback / softback, 428 pages, aukštis x plotis: 235x155 mm, weight: 694 g, 43 Illustrations, black and white; XXV, 428 p. 43 illus., 1 Paperback / softback
  • Išleidimo metai: 02-May-2020
  • Leidėjas: APress
  • ISBN-10: 1484258800
  • ISBN-13: 9781484258804
Kitos knygos pagal šią temą:
  • Formatas: Paperback / softback, 428 pages, aukštis x plotis: 235x155 mm, weight: 694 g, 43 Illustrations, black and white; XXV, 428 p. 43 illus., 1 Paperback / softback
  • Išleidimo metai: 02-May-2020
  • Leidėjas: APress
  • ISBN-10: 1484258800
  • ISBN-13: 9781484258804
Kitos knygos pagal šią temą:

Mastering ARM hardware architecture opens a world of programming for nearly all phones and tablets including the iPhone/iPad and most Android phones. It’s also the heart of many single board computers like the Raspberry Pi. Gain the skills required to dive into the fundamentals of the ARM hardware architecture with this book and start your own projects while you develop a working knowledge of assembly language for the ARM 64-bit processor.

You'll review assembly language programming for the ARM Processor in 64-bit mode and write programs for a number of single board computers, including the Nvidia Jetson Nano and the Raspberry Pi (running 64-bit Linux). The book also discusses how to target assembly language programs for Apple iPhones and iPads along with 64-Bit ARM based Android phones and tablets. It covers all the tools you require, the basics of the ARM hardware architecture, all the groups of ARM 64-Bit Assembly instructions, and how data is stored in the computer’s memory. In addition, interface apps to hardware such as the Raspberry Pi’s GPIO ports. The book covers code optimization, as well as how to inter-operate with C and Python code. Readers will develop enough background to use the official ARM reference documentation for their own projects.

With Programming with 64-Bit ARM Assembly Language as your guide you’ll study how to read, reverse engineer and hack machine code, then be able to apply these new skills to study code examples and take control of both your ARM devices’ hardware and software.

What You'll Learn
  • Make operating system calls from assembly language and include other software libraries in your projects
  • Interface apps to hardware devices such as the Raspberry Pi GPIO ports
  • Reverse engineer and hack code
  • Use the official ARM reference documentation for your own projects
Who This Book Is For
Software developers who have already learned to program in a higher-level language like Python, Java, C#, or even C and now wish to learn Assembly programming.
IntroductionGeneral 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 ProgramThe 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 UpNow 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 FlowIntroduce 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 MemoriesCovers 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 ServicesCover 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 PinsCreate 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 AccessTable DrivenSetting Pin DirectionSetting & Clearing PinsSummaryChapter 9: Interacting with C & PythonUsually people use minimal Assembly code to supplement their programming in other languages. Cover the most common use cases and provide examples of each. Calling C RoutinesPrinting Debug InformationPreserving StateCalling PrintfPassing a StringAdding with Carry RevisitedCalling Assembly Routines from CPackaging our CodeStatic LibraryShared LibraryEmbedding Assembly Code inside C CodeCalling Assembly from PythonSummaryChapter 10: Multiply, Divide & AccumulateMultiplicationExamplesDivisionExampleMultiply & AccumulateVectors & MatricesAccumulate InstructionsDual Multiply with AccumulateExample 1Accessing Matrix ElementsMultiply with AccumulateRegister UsageExample 2SummaryChapter 11: Floating Point OperationsShow how to write Assembler to perform floating point calculations. Show how to do division. Cover the data formats supported here. About Floating Point NumbersNormalization & NaNsRounding ErrorsDefining Floating Point NumbersFPU RegistersFunction Call ProtocolAbout BuildingLoading & Saving FPU RegistersBasic ArithmeticDistance Between PointsFloating Point ConversionsFloating Point ComparisonExampleSummaryChapter 12: Neon CoprocessorExplain Single Instruction Multiple Data (SIMD) programming. Examples from AI and graphics. Give examples and demonstrate how this can speed up your program. The Neon RegistersStay in Your LaneArithmetic Operations4D Vector Distance3x3 Matrix MultiplicationSummaryChapter 13: Reading, Understanding and Hacking CodeHow to use GCC to generate an Assembler listing from higher level language source code, how to use GDB to view Assembly code in memory and how to use Ghidra to reverse engineer a compiled program. Then look at an example of injecting executable code using a buffer overrun. Linux & GCCDivision RevisitedCode Created by GCCReverse Engineering & GhidraOverflowing the BufferSummaryAppendix A: ARM 64-Bit Instruction SetAppendix B: Linux Operating System ServicesAppendix C: Binary FormatsAppendix D: Assembler DirectivesAppendix E: ASCII Character SetReferences
Stephen Smith is a retired Software Architect, located in Gibsons, BC, Canada. He's been developing software since high-school, or way too many years to record. Since retiring he has pursued Artificial Intelligence programming, earned his Advanced HAM Radio License and enjoys mountain biking, hiking, and nature photography. He continues to write his popular technology blog at smist08.wordpress.com.