Debugging mbed OS applications

At the heart of mbed is the Online Compiler. While that is incredibly convenient for getting a project started or while prototyping, chances are that at some point you’ll miss a debugger, or you’ll want to develop while not having an active internet connection. Through debugging, you can do things such as set breakpoints, set watchpoints, view registers, view disassembly, browse memory and examine the callstack. These docs will help you debug your applications.

The simplest way to debug your code is to augment your code with log statements, which can be observed from your computer. To set this up, read Debugging with printf() calls.

Compile time and runtime errors

If your program will not compile, first read Debugging compile time errors.

If your development board blinks very fast, or shows ‘siren lights’, see Lights of dead.

Debugging from an IDE

Keil uVision natively supports debugging mbed OS applications. To set up uVision, read Debugging with Keil uVision.

mbed also supports debugging using any IDE that supports GDB. To set up the debugger, first read Setting up your local debug toolchain. Then read the section for your specific IDE. The same principles apply to any unlisted IDEs that supports GDB:

  1. Producing debug builds with mbed CLI.
  2. Debugging with Eclipse.
  3. Debugging with Visual Studio Code.
  4. Debugging with other IDEs that support GDB.