Debugging Bootloader and Application with one Debug Session

If having a boot loader running on a micro-controller, it is very useful if both the boot loader and the loaded application can be debugged together:

Bootloader with Application Code

Bootloader with Application Code

So how to make this work?

First have the boot loader flashed and have it loaded an application (see https://mcuoneclipse.com/2019/10/06/linking-bootloader-applications-with-eclipse-and-freemarker-scripts/).

Then have in the application project a debug launch configuration created (I’m using a J-Link here):

Launch Configuration for application

Launch Configuration for application

The trick is to configure this launch so it does not flash/overwrite anything on the target and does an ‘attach’ instead:

Attach to a running target

Attach to a running target

To prevent writing a new binary, make sure ‘Load image’ is unchecked and ‘Load Symbols’ for the application is checked:

Load Image and Load Symbols

Load Image and Load Symbols

Finally, load the extra symbols of the boot loader itself:

Load Other Symbols

Load Other Symbols

đź’ˇ If I have more parts for which I want the debug symbols, I can use the ‘+’ and add more files.

With this, I have source level debugging for both the boot loader *and* the application 🙂

Debugging Application on Top of Bootloader

Debugging Application on Top of Bootloader

Happy Bootloading 🙂

Links

2 thoughts on “Debugging Bootloader and Application with one Debug Session

  1. Hello Erich,
    I was EXACTLY wondering if there was such an article on MCUonEclipse.
    Out of curiosity, how would you debug THREE executables? I am thinking of a boot manager, a bootloader and an application, for example. Assuming non-overlapping sessions (but also overlapping) I would merge the hex files, but I don’t know if this approach would be feasibile with elf files.
    K.R.

    Luca

    Like

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.