Processor Debug
Contents
The following content has been imported from Legacy Help systems and is in the process of being checked for accuracy.
Function
The debug panel available for an OCD-version MCU provides access to that processor's internal registers and memory spaces, as well as providing a disassembled view of the embedded software running within.
Content and Use
The panel is essentially divided into three areas, concerning registers, memory spaces and a view of the disassembled embedded software, respectively.
Accessing Internal Registers
The top region of the panel - Processor Registers - displays all of the internal registers for the associated processor type. For each register, the following data fields are available:
- Name - the name of the register
- Width - the size of the register (e.g. 8-bit, 16-bit, 32-bit)
- Hex - the value currently stored in the register, presented in hexadecimal format (e.g. 1E)
- Binary - the value currently stored in the register, presented in binary format (e.g. 0001-1110)
- Decimal - the value currently stored in the register, presented in decimal format (e.g. 30)
- Char - the value currently stored in the register, presented in ASCII character format (e.g. decimal 87 would be character W)
The Name, Width and Char fields are non-editable.
Register values will update automatically in accordance with code execution. You can, however, manually change register values on-the-fly. To change the value of a register as you debug, click on one of the associated, editable data fields for the register and type the new value directly. The data field you choose (Hex, Binary, Decimal) will depend on the number system you prefer to work with. When finished, either click away from the field or press ENTER for the change to take effect. All other data fields for that register will update accordingly with the value entered.
Register values can be updated manually using the Refresh button, at the bottom left of the region.
Debug Controls
Reset, Go, Halt processor control is provided through the use of the Reset, Continue and Pause buttons at the bottom of the panel. In addition, controls are provided to allow single or multi-stepping of the disassembled code, in effect executing one or more instructions. To single step-debug your code, use the Single Step button at the bottom of the panel. As you step, the mid-region of the panel (Disassembly View) displays a view of the disassembled code, with the next executable instruction highlighted.
The controls for multi-step-debugging of the code are located to the right of the Single Step button. Enter a value for the number of steps required and click on the Run Steps button.
Accessing Processor Memory
The lower region of the panel (Memory Views) provides default views (or windows) into each of the physical memory spaces associated to the type of processor currently being debugged.
Each distinct memory view is accessed by clicking on its corresponding tab. The behavior of each of the tabbed views is identical, regardless of the memory space represented:
- address space typically starts at 00000000h, regardless of where the memory physically resides in the processor's memory map
- memory space is divided into rows of 16 cells, with each cell representing an address in memory space and the value contained therein, in hex format. The Data column reflects the value at each address (in the associated row) in ASCII format
- a field is included at the top right of each tab for filtering, allowing you to jump to the row containing the specific address of interest within the represented memory space
- a refresh button at the top left of the tab enables you to manually refresh/update the contents of the memory space
- a field at the top-center of the tab allows you to change the embedded software currently loaded into the processor, through specification of the related object code file (*.hex, *.abs, *.elf). Either type the name of the file (including path) directly into the field and press ENTER, or click on the ... button to the right of the field, to access the Choose Filename to Load dialog.
By using the dialog, not only can you browse for the required file (using the ... button to access the Choose Object Code File dialog), but you can also specify where in memory the code is to start from, by defining a target address.
an additional field is included that allows you to change the presentation of the memory space. The available presentation options are available from the associated drop-down for the field
As you change from 8-bit to 16-bit, to 32-bit, the view of the memory space changes to reflect the length of a word, by grouping columns accordingly:
The 16-bit Reversed and 32-bit Reversed options allow you to reverse the display of memory spaces that are Little Endian, causing each word to be displayed MSB-to-LSB (left-to-right) and therefore providing ease of readability.
Note that the ASCII representation of the data is not reversed with respect to its presentation.
By default, the Auto option will be set, to present the data in the most efficient way and in keeping with the type of processor.
To change the contents of an address in memory, click on the desired cell and type the new hexadecimal value as required. If the memory is writable, it will automatically be refreshed with the entered value. If it is read-only, the new value will be discarded and the memory location will remain unchanged.
Right-click Menus
Right-clicking on the header area of the Memory Views region of the panel will pop-up a menu providing access to controls for enabling/disabling the display of memory views in the region and, in addition, the following commands:
- Add Memory View - use this command to access the Memory View Properties dialog, from where you can define your own custom memory view into any of the memory spaces for that processor. This enables you to create customized views of memory spaces, allowing you to target specific memory address ranges pertinent to debugging.
Use the dialog's 'What's This Help' feature to obtain detailed information about each of the options available. Simply click on the question mark button at the top right of the dialog and then click over a field or option to pop-up information specific to that field or option
- Delete Memory View sub-menu - provides a listing of all currently defined custom memory views. Simply select an entry to delete that memory space. A dialog will appear prompting for confirmation to proceed with the deletion
- Memory View Properties - use this command to access the Memory View Properties dialog for the active custom memory view, essentially enabling you to modify the definition of the memory view. If the active memory view is one of the default memory views for the processor, the controls in the dialog will be un-editable.
Right-clicking anywhere within the main Memory Views region of the panel will pop-up a menu providing the following commands:
- Create Incrementing Test Pattern - use this command to fill the selected address range/block with incrementing values. For memory spaces whose data values are a single byte in length, the starting address in the selection will be given the value 00h, with subsequent addresses in the range given values that are incremented by 1. Incrementing is cyclic. When the value FFh is reached and used, the subsequent value will be 00h again
For memory spaces whose addresses contain single bit data values, the starting address in the range will be given the value 0, with subsequent addresses in the range alternating between value 1 and value 0.
- Create Decrementing Test Pattern - use this command to fill the selected address range/block with decrementing values. For memory spaces whose data values are a single byte in length, the starting address in the selection will be given the value FFh, with subsequent addresses in the range given values that are decremented by 1. Decrementing is cyclic. When the value 00h is reached and used, the subsequent value will be FFh again
For memory spaces whose addresses contain single bit data values, the starting address in the range will be given the value 1, with subsequent addresses in the range alternating between value 0 and value 1.
- Fill with Zeroes - use this command to enter 0 (bit) or 00h (byte) as the value for the selected memory address, or each address in a selected range or block of addresses
- Fill with Ones - use this command to enter 1 (bit) or 01h (byte) as the value for the selected memory address, or each address in a selected range or block of addresses
- Fill with 0xFF - use this command to enter 1 (bit) or FFh (byte) as the value for the selected memory address, or each address in a selected range or block of addresses
- Load File and Save To Memory - use this command to access the Choose File to Load dialog, from where you can specify the object code file for the embedded software you wish to load into the processor and the target address within memory at which code execution should start
- Reload Last File - use this command to reload the last object code file downloaded to the processor. If you have not loaded an object file via the debug panel, the Choose File to Load dialog will appear, from where you can choose the desired file
- Add Breakpoint - use this command to add a breakpoint at the currently focused memory address. The focused address is distinguished by a dotted border
- Clear Breakpoint - use this command to clear the breakpoint for the focused memory address (where one has previously been specified)
- Clear All Breakpoints - use this command to clear all breakpoints in the active memory space
- Configure Memory View - use this command to access the Memory View Properties dialog for the active memory space, essentially enabling you to modify the definition of the memory space. This command is only for use with custom memory views. If the active memory view is one of the default memory views for the processor, the controls in the dialog will be un-editable.
Notes
- Regarding the Processor Registersregion of the panel:
- Standard CTRL + Click and SHIFT + Click functionality is supported for selection of multiple register entries in the panel.
- You can not edit the values of multiple registers simultaneously. Editing is carried out on the focused data field for a register. The focused data field is distinguished by a dotted outline.
- Use the arrow keys on the keyboard to quickly move through the list of registers and between the columns of data.
- You can change the order in which columns of data are displayed. To move a column, click on its header and drag it horizontally to the required position. A valid position is indicated by the appearance of two green positional arrows
- Direct filtering is available, allowing you to quickly jump to an entry by directly typing within the panel. You can filter based on any data column in the panel. Use the Right Arrow and Left Arrow keys to switch between columns for filtering, or click directly on a field within a column. To use this feature, click within a data column and type the first letter of the entry you wish to jump to. The first entry in that column starting with the letter you type will become selected and the letter will be highlighted to show that filtering of the column content is based upon it. If the data column contains multiple entries starting with the same letter, narrow your search by typing additional letters as required.
- To clear the current filtering, allowing you to enter a different starting letter, press ESC. Use the BACKSPACE key to clear the previously entered filter characters, in sequence. As you switch between data columns for filtering purposes, the current filter for the column you are leaving is cleared.
- Regarding the Memory Viewsregion of the panel:
- A range of addresses can be selected using click-and-drag
- A block of addresses can be selected by holding the ALT key down whilst you click-and-drag
- Breakpoints can only be added on an individual address basis
- Breakpoints added to memory address space in a debug panel will not be reflected in the Breakpoints panel when debugging the embedded software
- The filter field will jump you to the row in which the specified address resides, and not to the actual address cell itself. The address you specify must be entered as an integer. For example, entering 17 will focus the second row of addresses, as this corresponds to address 00000011h in hexadecimal format.