Chapter 1: How to Set Up the Development Environment
About the Raspberry Pi Pico
About the Host Computer
How to Solder and Wire
How to Install Software
A Simple Program to Ensure Things are Working
Chapter 2: Our First Assembly Language Program
About the ARM Processor
Computers and Numbers
CPU Registers
ARM Instruction Format
RP2040 Memory
About the GCC Assembler
Flashing LEDs in Assembly Language
Chapter 3: How to Build and Debug Programs
CMake
GNU Make
Print Statements
GDB
Chapter 4: Loading and Adding
Negative Numbers
Little Endian Format
How to Shift and Rotate
MOV/MVN
ADD/ADC
SUB/SBC
Chapter 5: How to Controll Program Flow
Unconditional Branch
About the CPSR
Branch on Condition
About the CMP Instruction
Loops
If/Then/Else
Logical Operators
Design Patterns
Chapter 6: Thanks for the Memories
How to Define Memory Contents
How to Load a Register
PC Relative Addressing
How to Load from Memory
How to Index Through Memory
How to Store a Register
Hardware as Memory
Introduction to DMA
Chapter 7: How to Call Functions and Use the Stack
The Stack
Branch with Link
How to Nest Function Calls
Function Parameters and Return Values
How to Manage the Registers
Summary of the Function Call Algorithm
Stack Frames
Chapter 8: Interacting with C and the SDK
How to Call C Routines
How to Call Assembly Routines from C
How to Deal with Inline C Routines
How to Use SDK Header Files
Chapter 9: How to Program the Built-in Hardware
The GPIO Pins
Analog to Digital
PWM
Chapter 10: How to Set and Catch Interrupts
Overview
How to Create an Interrupt Handler
Timers Example
Chapter 11: How to Initialize and Interact with Programmable I/O
Overview
SDK Support
PIO Instructions
How to Control Timing
Examples
Chapter 12: How to Connect Pico to IoT
Connectivity Options
Using a UART or I2C
Internet Basics
Security
Chapter 13: Multiplication, Division and Floating Point
Multiplication Coprocessor
Division Coprocessor
Interpolation
Floating Point Library
Chapter 14: Multiprocessing
Using Both CPU Cores
How to Synchronize and Share Resources
Audience: Intermediate
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.
Learn to program the Raspberry Pi Pico’s dual ARM Cortex M0+ CPUs in Assembly Language. The Pico contains a customer System on a Chip (SoC) called the RP2040, making it the Foundation’s first entry into the low-cost microcontroller market. The RP2040 contains a wealth of coprocessors for performing arithmetic as well as performing specialized I/O functionality. This book will show you how these CPUs work from a low level, easy-to-learn perspective.
There are eight new Programmable I/O (PIO) coprocessors that have their own specialized Assembly Language supporting a wide variety of interface protocols. You'll explore these protocols and write programs or functions in Assembly Language and interface to all the various bundled hardware interfaces. Then go beyond working on your own board and projects to contribute to the official RP2040 SDK. Finally, you'll take your DIY hardware projects to the next level of performance and functionality with more advanced programming skills.
You will:
Read and understand the Assembly Language code that is part of the Pico’s SDK
Integrate Assembly Language and C code together into one program
Interface to available options for DIY electronics and IoT projects