2.3.3 Debugging a Device

Use the following commands to debug a device.

  • Reset – refer to the device data sheet for Reset information. If a Reset is needed for debugging purposes: first, halt the target; then, enter the command:

    Reset

  • Set Breakpoint – there are two ways to set a breakpoint for debugging:

    Set a breakpoint by source-line-number using the command:

    Break filename: linenumber

    For example: Break main.c:53

    Set a breakpoint at an absolute address using command:

    Break *address

    For example: Break *0x108

  • Set Watchpoint – to set a watchpoint for debugging:

    Set a watchpoint by specifying an address and the type of watch using the command:

    Watch address breakontype

    For example: Watch 0xa0007ff0 R

    or

    Watch address breakontype[:value] [passcount]

    For example: Watch 0xa0007ff0 R:0xf 1

  • Delete Breakpoint – to delete a breakpoint, use the command:

    Delete [breakpoint number]

    If no argument is specified in this command, it will delete all breakpoints.

  • Run Program – the Run command can be used to run the program until it reaches a breakpoint.
  • Step Through – to step through the program, use the Step command or Next command.
  • See Variable Value – a Print [variable] command can be used to see the value of a variable or an SFR.
  • Exit – use the Quit command to exit the MDB.