Build, Load & Debug: RP2350
Build, load, and debug programs on RP2350
Overview
This document describes how to build, load, and run RTK-based programs for the RP2350 for debugging.
-
For debugging, ELF binaries are the only option to include DWARF debug data.
-
make-elf creates the ELF file. It creates and embeds the necessary DWARF debug data. Note that the executable binaries are 100% the same with or without debug data, and consequently there is no "debug overhead" with debug data included if run outside a debugger…
-
Other guides:
- no debugging: Build & Load: RP2350
- Secure/Non-secure without debugging: Build & Load: RP2350 (S/NS)
- Secure/Non-secure with debugging: Build, Load & Debug: RP2350 (S/NS)
See also Practical Notes.
Prerequisites
The build and debug tools must be set up as explained in:
Steps
1. Compile and Link the Program
Please refer to Compile and Link: RP2350.
Consult IMAGE_DEF as regards the inclusion of the mandatory IMAGE_DEF meta data block into the load file. Below, path A and path B are used to differentiate the to possible cases.
To continue, the program must build without errors or alerts; warnings are OK.
2. Create the Absolute Assembly Listings
gen-rdb creates an .alst file for each module in the program, plus _startup.alst for the start-up sequence inserted by the linker at the end of the program; make-elf requires the .alst files to create symbols and DWARF debug data.
python -m gen-rdb <program>.map
gen-rdb uses configuration data directly from the program's map file, hence no command line options are required.
By default, the .alst files are created in directory rdb in the project directory. To use another directory, please refer to the manual page gen-rdb.
3. Make the ELF File
make-elf embeds the program binary into an ELF file, together with the debug data and symbols generated from the .alst files.
Path A: make-elf Embeds IMAGE_DEF
python -m make-elf <program>.bin --image-def --debug
make-elf uses configuration data directly from the program's map file.
The ELF file can be inspected using the standard tool readelf. Run readelf -S <program>.elf to list all sections.
Path B: Module ImageDef Embeds IMAGE_DEF
python -m make-elf <program>.bin --debug
4. Load the ELF File
The ELF file is loaded by the debugger:
- GUI: Cortex-Debug inside Visual Studio Code – see Debugging § VS Code + Cortex-Debug
- command line: OpenOCD and GDB – see Debugging § GDB Command Line
Hence, with a partition table:
- put the RP2350 in
BOOTSELmode, which mounts the virtual volumeRP2350 - then use
picotoolas outlined below - use the attach flow in Debugging § Loading Without Flashing (Attach)
For loading into partition 0:
picotool load -p 0 <program>.elf -v -x
Last updated: 15 May 2026