Debugging Microcontrollers

https://media.ccc.de/v/camp2023-57321... 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/documentati...) and the associated debug probes ([J-Link](https://www.segger.com/products/debug..., [STLink](https://www.st.com/en/development-too...) and libraries ([JLinkGDBServer](https://wiki.segger.com/J-Link_GDB_Se..., [OpenOCD](https://openocd.org)). How to install and configure [arm-none-eabi-gdb(-py3)](https://developer.arm.com/Tools%20and...) for debugging your ELF. Commonly used [GDB commands and scripts](https://sourceware.org/gdb/onlinedocs.... Advanced [GDB scripting via its Python API](https://sourceware.org/gdb/onlinedocs.... Inspecting [peripheral state](https://github.com/pengi/arm_gdb) with [CMSIS-SVD files](https://www.keil.com/pack/doc/CMSIS/S...) 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.... [ITM profiling](https://developer.arm.com/documentati...) 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/documentati...) over TRACE pins: [J-Trace](https://www.segger.com/products/debug...) 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. Niklas Hauser https://pretalx.c3voc.de/camp2023/tal... #camp2023 #Milliways