Debugging Microcontrollers

Niklas Hauser

Playlists: 'camp2023' videos starting here / audio

Debugging and Profiling ARM Cortex-M microcontrollers with GDB and Python.

This talk gives you an overview of debugging ARM Cortex-M microcontrollers with a focus on the *practical* configuration and usage of the relevant tools.
In particular, I will present:

- Debug interfaces ([SWD](https://developer.arm.com/documentation/ihi0031/a/The-Serial-Wire-Debug-Port--SW-DP-)) and the associated debug probes ([J-Link](https://www.segger.com/products/debug-probes/j-link/), [STLink](https://www.st.com/en/development-tools/stlink-v3minie.html)) and libraries ([JLinkGDBServer](https://wiki.segger.com/J-Link_GDB_Server), [OpenOCD](https://openocd.org)).
- How to install and configure [arm-none-eabi-gdb(-py3)](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain) for debugging your ELF.
- Commonly used [GDB commands and scripts](https://sourceware.org/gdb/onlinedocs/gdb/index.html).
- Advanced [GDB scripting via its Python API](https://sourceware.org/gdb/onlinedocs/gdb/Python.html).
- Inspecting [peripheral state](https://github.com/pengi/arm_gdb) with [CMSIS-SVD files](https://www.keil.com/pack/doc/CMSIS/SVD/html/index.html) and custom visualizations.
- Dynamic call stack tracing and graphing.
- Coredumping for post-mortem debugging via [CrashDebug](https://github.com/adamgreen/CrashDebug).
- [Remote GDB scripting](https://github.com/cs01/pygdbmi) via the [Machine Interface](https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html).
- [ITM profiling](https://developer.arm.com/documentation/ddi0403/d/Appendices/Debug-ITM-and-DWT-Packet-Protocol?lang=en) over SWO pin using [Orbuculum](https://orbcode.org/orbuculum/).
- Thread/IRQ/Workqueue scheduling visualization and latency analysis using [perfetto](https://perfetto.dev).
- High-bandwidth [ETM tracing](https://developer.arm.com/documentation/ihi0014/) over TRACE pins: [J-Trace](https://www.segger.com/products/debug-probes/j-trace/) and [ORBtrace mini](https://orbcode.org/orbtrace-mini/).
- Interesting related projects and possible future work.

This talk is meant to introduce you to what is possible with embedded debug tools in practice, rather than to give you a comprehensive lecture.

Download

Embed

Share:

Tags