// book
Learning Assembly with ticktrace
A book for total beginners who want to understand what a CPU really does and write their own bare-metal firmware for the Raspberry Pi Pico 2. You should be comfortable with some programming language; you do not need prior assembly experience.
// chapters
- 01Chapter 1: IntroductionThis book is a working introduction to ARM Thumb-2 assembly programming on the Raspberry Pi RP2350 microcontroller. It uses **ticktrace**, a pure-assembly SDK for that chip, as its running codebase.
- 02Chapter 2: What is assembly language?Before we touch a Pico, let's get clear on what assembly *is*.
- 03Chapter 3: The RP2 familyThe "RP2" in ticktrace refers to the family of microcontrollers designed by Raspberry Pi Ltd themselves, first the RP2040 (launched in 2021) and then the RP2350 (launched in 2024). They are the silicon at the heart of the Raspberry Pi Pico
- 04Chapter 4: The Cortex-M33 and Thumb-2This chapter is a closer look at the processor that runs your ticktrace code. Don't try to memorise everything here, treat it as a reference to come back to. You'll absorb the details as you write programs.
- 05Chapter 5: Setting up ticktraceIn this chapter we install the toolchain, clone ticktrace, and build the default blinky.uf2. By the end you'll be one drag-and-drop away from a running program.
- 06Chapter 6: Your first program: blinkyTime to read code.
- 07Chapter 7: Assembler syntax and instructionsYou've read one program end-to-end. This chapter zooms in on the *syntax* of GNU ARM assembly so you can read driver code, not just user code. Think of it as a reference you'll come back to until the patterns become instinctive.
- 08Chapter 8: Functions and the calling conventionUp to now we've been calling ticktrace driver functions without thinking too hard about *how* the calling works. In this chapter we make the rules explicit, so that you can write your own functions and have them play nicely with the rest of
- 09Chapter 9: GPIO and memory-mapped I/OThe chip's CPU and its peripherals are separate hardware blocks, but they share an address space. To talk to a peripheral you just read or write memory, at certain *special* addresses. This is called **memory-mapped I/O**, or MMIO, and it i
- 10Chapter 10: UART: talking to the hostA blinking LED is satisfying but limited. To debug real programs you need a way for the chip to *say things*, print numbers, log states, report errors. The classic way to do that on a microcontroller is a **UART**: a serial port that sends
- 11Chapter 11: Timers and interruptsOur blinky program loops 12 million times to delay 250 ms. While it does that, the CPU is fully occupied, 100% busy doing literally nothing. That's a bad pattern. Microcontrollers should sleep when there's no work, and wake up only when som
- 12Chapter 12: Scheduling[Chapter 11](11-timers-and-interrupts.md) introduced interrupts as a way to react to single hardware events. Real firmware usually has more than one thing to do: read a UART, drive a motor, blink a status LED, service a button. Once you hav
- 13Chapter 13: MulticoreThe RP2350 has **two** Cortex-M33 cores on the same die. They share SRAM, peripherals, and the SIO block; each has its own register file, NVIC, and SysTick. Up to chapter 12 we have used core 0 exclusively and let core 1 sit in its reset st
- 14Chapter 14: Where to go nextYou can now read and write ticktrace. You understand registers, instructions, the calling convention, memory-mapped I/O, GPIO, UART, interrupts, scheduling, and multicore. That's enough vocabulary to navigate the entire SDK. The rest is *wh
// appendices
- AAppendix A: GlossaryEvery term used in this book, with a one-paragraph definition and a pointer to the chapter that introduces it.
- BAppendix B: Cheat sheetEverything you need to read or write a ticktrace function, in one place.
- CAppendix C: DebuggingThis appendix is a quick map of the debugging options available to a ticktrace program. It is not a tutorial, it's a "which tool when" reference. Deeper coverage of GDB/OpenOCD will come in a later revision once the on-chip debug surface in
- DAppendix D: Memory layouts and execution patternsUp to chapter 14 this book has treated flash-vs-SRAM as a binary choice: build the flash variant for production, the SRAM variant for emulation tests. The RP2350 hardware supports more than two patterns, and the right choice for hard-real-t
- EAppendix E: StudioUp to this point every example in the book has been built and flashed the same way: make build/<name>_flash.uf2, hold BOOTSEL, drag-drop. That is the truthful, low-level path: the Makefile is the build system, picotool (or the BOOTSEL drive