Adding Symbols to the CodeWarrior Debugger


On the TWR-LCD, I’m using a USB MSD bootloader. In Programming part of flash I showed how to download and debug the application on top of the bootloader. But how to debug both the bootloader and the application? At the same time with CodeWarrior for MCU? The magic key is tell CodeWarrior to use ‘Other Executables’.

Basically it means to tell the debugger the debug information of other applications, which are already running on the board. Kind of telling the debugger ‘hey, there is some more source and debug information you should be aware of’.

The same thing works as well if I’m only ‘attaching’ (see Hot-Sync: Attach, Connect & Download) to the target application. Using ‘Other Executables’ allows me to give all the needed information to the debugger, so it can be debugged.

Other Executables

In the debug/launch configuration, there is a ‘Other Executables’ tab:

Other Executables Tab

Other Executables Tab

To add a new executable, I press the ‘Add’ button:

Add new executable button

Add new executable button

Next I specify the other application (.elf) file and check ‘Load Symbols’: that way the debugger will load the symbols (also know as ‘symbolics’ information, line, source and other debug information) of that file:

Debug Other Executable with Load Symbols

Debug Other Executable with Load Symbols

💡 There is as well a ‘Download to Device’ check box: if enabled, it will flash that application to the device. What I see is that it will do an erase of the device followed by programming the application. So this does not work in my view to download e.g. the bootloader and the application in one step.

The above dialog allows me to specify multiple such ‘other executables’, if I need it. I realize that this ‘other executable’ could be very useful to debug e.g. an Embedded Linux application.

After the ‘other executable’ has been configured, I can quickly turn on/off the ‘Load Symbols’. So for the bootloader project, I could turn on/off symbols of different loaded applications that way very quickly.

Configured Other Executable

Configured Other Executable

Debugger Command Line

The ability to load additional symbolics exists as well in the Debugger Shell (Command Line Debugger, see Debugger Shell: Test Automation). The command is ‘loadsym’ and ‘help loadsym’ gives information about the arguments:

Debugger Shell with help on loadsym

Debugger Shell with help on loadsym

That way I can add symbolic information while debugging using the Debugger Shell:

Loading Symbolics with the Debugger Shell

Loading Symbolics with the Debugger Shell

Summary

To debug ‘splitted’ applications like a bootloader and the loaded application, that ‘Other Executable’ settings did the trick for me: with ‘Load Symbols’ the debugger loaded incrementally the extra symbols, and with an ‘Attach’ configuration I’m able to debug both the bootloader and the loaded application. Additionally I can use the Debugger Shell to do this while debugging. Nice :-).

Happy Debugging 🙂

2 thoughts on “Adding Symbols to the CodeWarrior Debugger

  1. You can get the Flash programmer to load both executables at the same time. You just have to go “deeper” into the configuration.
    Basically, you need to set up a Flash Programmer task that:
    1. Erases the chip
    2. Blank checks the chip (optional)
    3. Programs the boot loader to Flash
    4. Programs the target program to Flash (no overlap allowed)

    Then, in the debugger tab, “Download” section, you uncheck the “Perform Standard Download”, check “Execute Tasks”, and add the Flash Programmer task that you have set up.
    Note that this is for CW MCU 10.5, and your screen shots above do not show the “Download” section in the Debugger Tab. It shows up between “Interrupts” and “PIC”.

    Like

    • Hi Stephen,
      thanks for that tip! Indeed, with the Target Tasks this can be done, I thought not about this in the first place.
      That screenshot does not show the ‘Download’ tab because it shows an ‘attach’ configuration (there is nothing to download). But for a ‘download’ configuration there is such a ‘Download’ tab.

      Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s