last updated: 2026-10-23
Work in progress; Coming soon!

Do you remember the 80s? Clearly the music was better, but also a whole generation was hooked by electronics and computers. They had fun by moving bits and bytes and their enthusiasm helped to drive the development of technology forward. I think that the core of this is still true today, and moving bits and bytes is an absolute basic skill to understand programming and how computers and microcontrollers work. And Assembler is the most natural approach to do this.
Learning RISC-V assembly is future-proof, providing a robust and portable foundation for an enormous range of modern hardware.
We need people in Europe who understand the basics! We need more RISC-V chips produced in Europe to get more resilient. RISC-V is Open Source! and we need open source in Europe to stay competitive. AI will help to create better code, but only if humans know the basics and can control the code!
This is not a classic RISC-V Assembler book! We use the approach Learning by doing in all the chapters. But we also have three Make It chapters, where you can do some soldering and 3D printing if you want.
This book targets students, teachers and engineers who want to go further than simulations and makers who want to better understand the RP2350 and perhaps do some cool and very fast stuff at the hardware level.
The book is divided into three parts, each concluding with a "Make It" chapter. We cover bare metal programming and debugging, starting with digital and analog in- and output (push-buttons, LEDs, potentiometer, music with PWM). We look at clocks, timers and internal and external interrupts. But we also cover in detail memory and Direct Memory Access, the RP2350 PIO state machines (WS2812b and I2S interface) and even dual core communication. Gradually we build our own SDK with many subroutines organized in libraries. This allows you to make Assembly programming nearly as easy as C, but with more control.
In the "Make it" chapters you can build a real serial terminal with HDMI monitor and USB Keyboard (Pico2Terminal), a Pong Game for 2 players with sound (Pico2Pong) and a MIDI controlled wavetable Oscillator (Pico2MCWO).
Chapter 1 starts with the "Hello World" program for microcontrollers. To do so, we install the RISC-V GCC toolchain and OpenOCD. We convert a Pico2 board to a Debug Probe that we use to program (flash) our code and to ... debug. We will explain every step in great detail.
The first program (01_toggle.S) toggles a GPIO and the second program (01_toggle_led.S) uses a small delay subroutine to toggle an LED.
Chapter 2 is used to tidy up. We use the preprocessor to organize the code in different files and subroutines. We also learn to debug with GDB, explain the importance of a good alignment and the subsystem resets of the Pico2. This chapter goes into a lot of details. If you are eager to progress, you can skip the explanations (GDB, alignment, objdumps ...) and read them later. Essential are the new organization, the deasserting of resets and the script to compile and program the controller.
The program (02_toggle_tidy.S) still toggles a GPIO (or LED) but it already uses 2 definitions files and 3 libraries.
Chapter 3 is about clocks. We activate the crystal to get a more stable system clock and use the PLLs to create a higher system clock of 150{nbsp}MHz and a USB clock of 48{nbsp}MHz. For our peripherals, we set the peripheral and ADC clock to 48{nbsp}MHz.
The program (03_toggle_xosc_pll.S) still toggles the LED but the cores are now running at 150{nbsp}MHz. We also output the system clock, or if we need to all other clocks on GPIO15.

03_toggle_xosc_pll.SIn Chapter 4, we activate the serial interface and learn to use both UARTs. We communicate at a speed of 1000000{nbsp}bit/s (8N1) with a terminal program on a computer. We write a lot of subroutines to print bytes, half-words and words in decimal and hex, so we can display the contents of memory and registers.
The first program (04_serial_echo.S) echoes the keys typed in a terminal program (left video) and the second program (04_serial_print.S) prints text from memory, bytes from memory, register values and memory addresses in hexadecimal (right video). Both use UART0 (GPIO0 and GPIO1).
04_serial_echo.S 04_serial_print.SPart 1 closes with Chapter 5, the first "Make it" chapter. Here we condense everything we learned and build a modern computer terminal called Pico2Terminal. It uses a USB keyboard as input device and an HDMI monitor as output device. A minimal terminal program takes commands from the keyboard and displays e.g., the contents of memory on the monitor.
Here a video that shows the results of the program 05_pico2terminl.S.
05_pico2terminl.SIn Chapter 6 we will interact with the controller through switches or push-buttons (digital in) and potentiometers (analog in). The internal ADC will also be used to get and display the system voltage and the temperature (internal temperature sensor of the RP2350).
Here a video that shows the results of the program 06_din_adc.S.
06_din_adc.SChapter 7 is about timers and PWM (analog out). We use the two system timers TIMER0 and TIMER1 and the the RISC-V platform timer to create better delay subroutines with microseconds ticks. They are also used to write micros and millis subroutines to measure time and write non-blocking software. With PWM timers we can dim the light and even make noise :).
We crate in this chapter 4 programs: 07_timers.S, 07_pwm_led.S,07_pwm_sound.S and 07_pwm_sound2.S.
07_pwm_led.S07_pwm_sound.S 07_pwm_sound2.SThe more challenging Chapter 8 is about interrupts. These enable the microcontroller to respond immediately (in real-time) to events. This makes it possible to write better, simpler and more efficient programs. We use them not only to program the perfect boiled egg timer, but also to react very quickly to GPIO and UART input. In this chapter, we make real music with interrupts and Direct Digital Synthesis (DDS).
Part 1 closes with Chapter 5, the first "Make it" chapter. Here we condense everything we learned and build a modern computer terminal called Pico2Terminal. It
And finally Part 2 closes with the "Make it" Chapter 9 Everybody knows PONG.
We create Pico2Pong (09_pico2pong.S) in color and with sound and so consolidate what you have learnt in the previous chapters.
Chapter 10 is about memory and Direct Memory Access (DMA). We take a thorough look at the RISC-V memory map, in order to understand how the stack works, to enhance our startup code and to use DMA to copy memory blocks very fast, and to copy memory data to the peripherals, both without involving a core.
Chapter 11 is the biggest chapter. It is about using the RP2350 PIO (Programmable Input/Output) hardware feature that provides programmable state machines that can manipulate GPIO pins very fast and independently of the CPU. In addition to manipulating pins (even 8 pins in parallel) we create an interface to control WS2812b RGB LEDs and an Inter-IC Sound (I2S) interface.
In Chapter 12 we wake up the second sleeping beauty's h(e)art1 (core1). We will see four different methods by which cores can communicate with each other without race conditions. In a producer/consumer example we use e.g., the new General Exclusive Monitor of the RP2350 and a doorbell interrupt.