Processor Commands


REGISTER: Change register

Allows the user to change the value of a register shown in the register window.

    REG reg val

where "reg" is a register name, as shown in the register window, and "val" is a value expression.

If no register name or value is specified, then the registers are read from the target and the register window is refreshed. In normal operation, this will not change any values in the register window. It may be useful if the display and the actual processor registers become unsynchronized, as may occur if the processor is reset unexpectedly, or if the user aborts a GO command.

In some cases, changing the value of one register may cause other registers to change as well. For example, on the 8051, changing the register bank bits of the PSW will cause the displayed values or R0 through R7 to reflect the contents of the new register bank.

"R" is an abbreviation of "REG".


GO: Begin execution

Allows the user to begin or continue execution of a target program.

    GO addr

will begin execution at "addr" (where "addr" is an address expression).

To continue execution at the address indicated by the current program counter as shown in the register window, enter

    GO

After the GO command is issued, NoICE will wait for the target to execute a breakpoint, non-handled interrupt, or reset, at which point the target's registers will be displayed.

If the target continues execution without encountering a breakpoint, the user may be able to force NoICE to return to the command state issuing the HALT command, or by selecting HALT from the menu. HALT is not available will all target communications methods.

"G" is an abbreviation of "GO". The F5 function key is equivalent to GO with no parameters.

When the target is running, the GO button on the toolbar will be shown as pressed and some other buttons and menu choices will be disabled.

If the GO command is contained in a command file, NoICE does not wait for the target to stop before it executes the next command. If you wish to wait for the target to stop (hit a breakpoint), use the WAITFORSTOP command.

A convenient variation of the GO command is Go Until line, found on the context (right-click) menu for the Source window. This command defines a temporary breakpoint at the address of the selected line, and GOes until there. Other breakpoints are not inserted.

While the target is running, it may be able to communicate with the Output Window as with a dumb terminal.


HALT: Interrupt target execution

    HALT

This command attempts to interrupt target execution, if possible. The standard NoICE serial monitors use polled communications, such that it is not possible for the host to interrupt the target. Such interruption is possible when using BDM communications with a 68HC12, and may be possible with other communications methods developed in the future.

If you are using a target that cannot communicate while running, NoICE will warn you of that fact, and give you a chance to abort the active run state. This may be useful in certain cases when the target is actually stopped, but has somehow lost synchronization with the host. If you choose to abort, NoICE will attempt to read the target registers and other data to regain synchronization with the target.

If the target is not running, this command has no effect.

"BREAK" may be used as an alternate to "HALT". The Control-F5 function key is equivalent to HALT with no parameters.

When the target is running, the GO button on the toolbar will be shown as pressed. Clicking on the button during this time is equivalent to HALT.


STEP into subroutine

    STEP

Allows the user to execute the next instruction or source line of a target program. The operation of this command depends on the value set by the MODE command. If the mode is 0 or 1, then STEP will execute the next processor instruction. If the instruction or program line is a call to a subroutine, the subroutine will be entered.

If the mode is 2 (source), then STEP will execute instructions until the target's program counter contains an address for which there is source line information. During this process, the register window will be updated, and the stepping can be interrupted by pressing any key.

The STEP command has two optional parameters that permit multiple step and animated operation. This can also be accessed from the menu via Run, Animate.

    STEP 100

will repeatedly STEP the processor, pausing 100 msec after each step. Any delay up to 59999 msec may be specified. You may stop the animation by pressing the GO button on the toolbar, or by pressing and holding the escape key until animation stops.

    STEP 0 42

will STEP 42 times and then stop. This is sometimes useful to step through several iterations of a loop. If the first parameter is non-zero, NoICE will pause that many msec after each step.

The STEP command operates by placing breakpoints in target memory. Thus, if your target does not have hardware breakpoints the program to be stepped must reside in RAM. If the target processor does not have a single byte breakpoint instruction, there may be cases, such as short forward or backward branches, where the insertion of the breakpoint(s) would overlap the instruction being stepped. If this occurs, NoICE will issue an error message and will not perform the STEP.

In most cases, stepping is virtually instantaneous and NoICE will immediately re-enter command mode. However, in some cases the target may not reach the breakpoint. This may occur, for example, if an interrupt is pending when the STEP command is given, and the interrupt handler does not return immediately (or at all...). In such a case, the STEP command will behave as if a GO command had been issued. Refer to the GO command for details.

The F7 or F11 function key is equivalent to STEP with no parameters. (F7 is the "traditional" NoICE key. F11 is provided for people used to Microsoft's DevStudio).

If the STEP command is contained in a command file, NoICE does not wait for the target to stop before it executes the next command. If you wish to wait for the target to stop, use the WAITFORSTOP command.


NEXT: Step over subroutine

    NEXT

Allows the user to execute the next instruction or source line of a target program. The operation of this command depends on the value set by the MODE command. If the mode is 0 or 1, then NEXT will execute the next processor instruction. If the instruction is a call to a subroutine, the subroutine will be executed in its entirety.

If the mode is 2 (source), then NEXT will execute instructions and calls until the target's program counter contains an address for which there is source line information. During this process, the register window will be updated, and the stepping can be interrupted by pressing any key.

NEXT has two optional parameters that permit multiple step and animated operation. Refer to the STEP command for details.

The NEXT command operates by placing breakpoints in target memory. Thus, if your target does not have hardware breakpoints the program to be stepped must reside in RAM.

Subroutine calls that are followed by data bytes cause problems for NEXT, since the breakpoint would normally be placed immediately after the call instruction, on top of the data block. In such cases, the user should place a breakpoint in the appropriate location and use the GO command. As an alternative, you may be able to use the CALLSKIP commad.

If the target processor does not have a single byte breakpoint instruction, there may be cases, such as short forward or backward branches, where the insertion of the breakpoint(s) would overlap the instruction being stepped. If this occurs, NoICE will issue an error message and not perform the NEXT.

In most cases, stepping is virtually instantaneous and NoICE will immediately re-enter command mode. However, in some cases the target may not reach the breakpoint. This may occur, for example, if an interrupt is pending when the NEXT command is given, and the interrupt handler does not return immediately (or at all...). The condition may also occur if a subroutine being stepped over does not return promptly. In such cases, the NEXT command will behave as if a GO command had been issued. Refer to the GO command for details.

The F8 or F10 function key is equivalent to NEXT with no parameters. (F8 is the "traditional" NoICE key. F10 is provided for people used to Microsoft's DevStudio).

If the NEXT command is contained in a command file, NoICE does not wait for the target to stop before it executes the next command. If you wish to wait for the target to stop, use the WAITFORSTOP command.


ISTEP: Step one instruction

    ISTEP

Allows the user to execute the next instruction of a target program. The operation of this command does not depend on the value set by the MODE command.

ISTEP has two optional parameters that permit multiple step and animated operation. Refer to the STEP command for details.

If your target communications supports hardware single-step directly (ARM7 JTAG, HCS08 or HC12 BDM, MSP430 JTAG, AN2140), the ISTEP command will use the hardware single-step. Otherwise, ISTEP command operates by placing breakpoints in target memory. Thus, if your target does not have hardware breakpoints the program to be stepped must reside in RAM. If the target processor does not have a single byte breakpoint instruction, there may be cases, such as short forward or backward branches, where the insertion of the breakpoint(s) would overlap the instruction being stepped. If this occurs, NoICE will issue an error message and will not perform the ISTEP.

In most cases, stepping is virtually instantaneous and NoICE will immediately re-enter command mode. However, in some cases the target may not reach the breakpoint. This may occur, for example, if an interrupt is pending when the ISTEP command is given, and the interrupt handler does not return immediately (or at all...). In such a case, the ISTEP command will behave as if a GO command had been issued. Refer to the GO command for details.

The F9 function key is equivalent to ISTEP with no parameters.


CALLSKIP: Define a subroutine called with post-bytes

Sometimes subroutine calls are followed by parameter bytes in the code stream. For example, the IAR C compiler for the 6502 can call a function in banked memory by using the internal subroutine ?BANK_CALL_L20.

    JSR ?BANK_CALL_L20 
    DW function-address-on-page
    DB function-page

This causes problems for NoICE's NEXT (step-over) command, which operates by placing a breakpoint after the JSR instruction. In this case, the subroutine ?BANK_CALL_L20 doesn't return to the next byte, but to three bytes later, after the parmeters. Not only won't NEXT stop at the correct location, ?BANK_CALL_L20 will fetch incorrect data since the breakpoint instruction will have overwritten the first parameter byte.

To declare that the subroutine named "?BANK_CALL_L20" is followed by 3 parameter bytes, enter

    CALLSKIP ?BANK_CALL_L20 3

This has two effects. One is that when you step over this subroutine call, the breakpoint will be placed correctly after the parameter bytes. The other effect is that when the code is disassembled you will see the parameter bytes following the subroutine address:

    0FF26         208DFE00 JSR     ?BANK_CALL_L20 004074
    0FF2C         8046     BRA     0FF74

In order for this to work, there must be a symbol defined that gives the value of ?BANK_CALL_L20.

Since you will usually want the CALLSKIP definitions each time you run NoICE, it is convenient to place them in your Startup File.

In some cases, the number of parameter bytes is not the same for every call of the subroutine. For example, the IAR 6502 C compiler generates code for switch statements that calls ?C_S_SWITCH_L06, followed by a list of parameters that depends on the switch statement. In such a case, specify zero as the skip count:

    callskip ?C_S_SWITCH_L06 0

This causes step-over to operate the same as step-into. Because the number of parameter bytes are not known, disassembly of this call will generally not be accurate.

On the 6809, it was common to use post-bytes after SWI, SWI2, and SWI3 for system calls. Thus, NoICE for 6809 can apply CALLSKIP to these instructions as well as BSR and JSR. To define CALLSKIP for a 6809 software interrupt, specify the address of the interrupt's vector. For example, to specify that SWI2 is followed by one post-byte use the command

    CALLSKIP 0xFFF4 1

CALL: Call a subroutine

This command allows the user to call an assembly language subroutine. It will generally not correctly call a C function, as it will not push the appropriate arguments on the stack.

To call a subroutine at "addr", where "addr" is an address expression, enter

    CALL addr

When the subroutine returns, the program counter is restored to its value before the call.

This command is available only if the Address For Subroutine Breakpoint is present in the target monitor, or if BDM is used.

To perform a CALL, NoICE needs an address in code memory in which to place a breakpoint. If a serial monitor is used, the target can specify this as the Address For Subroutine Breakpoint. If the address is zero, or if BDM is used, NoICE will prompt you for this address when you first use CALL. You can change the address on subsequent CALLs by specifying it after the subroutine address:

    CALL addr breakpointaddr

where "breakpointaddr" is an address expression.

Note: monitors which use a single stack for both the user program and monitor operation must be careful to reload the stack pointer after register changes. This includes monitors for the 8051 and 65C02. Appropriate versions of these monitors are included with this distribution of NoICE. Older versions of these monitors may not correctly execute the CALL command.


BREAKPOINT: Breakpoint insert, delete, and display

Allows the user to insert, delete, and display breakpoints in the target's memory.

To insert a breakpoint at "addr" (where "addr" is an address expression), enter

    BREAKPOINT addr

To delete a breakpoint at "addr", enter

    BREAKPOINT -addr

Note that "addr" is an address expression. Thus

    BREAKPOINT -PC

will delete the breakpoint at the location pointed to by the Program Counter. This is a convenient way to delete a breakpoint once it is reached.

Breakpoints operate either by using breakpoint hardware on the target chip, or by inserting a special instruction at the breakpoint location. The hardware method allows setting breakpoints in Flash memory, but the number of such breakpoints is usually restricted.

If the program being debugged is in RAM, then the instruction method may be used. Execution of the instruction causes entry into the monitor. Ideally, this instruction is a single byte software interrupt, such as the 68HC11's SWI or the Z80's RSTnn. If the target processor does not have a single byte breakpoint instruction, a multi-byte CALL or JSR instruction must be used. In this case, there will be restrictions on where breakpoints may be placed, in order to prevent the overlap of multiple breakpoint instructions. NoICE will issue error messages if an attempt is made to place a breakpoint illegally.

To delete all breakpoints, enter

    BREAKPOINT -

To display all currently set breakpoints, enter

    BREAKPOINT

If a breakpoint location is visible in the source window, a red dot OK will be shown on the line containing the breakpoint.

When a breakpoint is inserted, the specified location is tested for its ability to store the breakpoint instruction, and the original contents are then replaced. When a GO command is issued, all currently set breakpoints are inserted before the target is told to commence execution.

"B" is an abbreviation of "BREAKPOINT". The F6 function key is equivalent to "BREAKPOINT", and will list all currently set breakpoints.

Breakpoints may also be inserted and removed with the mouse. Simply double-click on the line in the source window which shows the desired breakpoint location.

A convenient form of breakpoint is Go Until line, found on the context (right-click) menu for the Source window. This command defines a temporary breakpoint at the address of the selected line, and GOes until there. Other breakpoints are not inserted during this process.

Breakpoints are part of the Debug Context, and may be saved, restored, or removed by the LOAD, and PLAY/LASTFILELOADED commands.


BREAKENABLE and BREAKDISABLE: Breakpoint enable and disable

It is sometimes useful to disable a breakpoint without removing it. This is especially true when the number of active breakpoints is limited, as when using hardware breakpoints. A disabled breakpoint may be re-enabled, or removed.

To disable a breakpoint at "addr" (where "addr" is an address expression), enter

    BREAKDISABLE addr

To enable a breakpoint at "addr", enter

    BREAKENABLE addr

In most cases, breakpoints will be enabled or disabled by right-clicking on a source line with a breakpoint, or in the breakpoint dialog.

"BD" is an abbreviation of "BREAKDISABLE", and "BE" is an abbreviation of "BREAKENABLE".


RESET: Reset target hardware

This command allows the user to reset the target hardware. RESET is supported by "built-in" debug methods such as BDM (HC12 or MC9S08), JTAG (MSP430 and some ARM) and MON08 (HC08), but is not supported by the NoICE serial monitors.


IN: Read byte from port

    IN addr

Allows the user to perform input from the target port at the address specified by "addr". If the target does not have specific input instructions or an I/O address space, then this command simply reads target memory at the specified address.

When using the NoICE serial monitor, sixteen address bits are sent to the target, but any page bits in the specified address are ignored. Some target processors may ignore all but the low eight bits of the address.

If an address is specified on the command line, that address will be read. If no address is specified, then the previously specified address will be read.

"I" is an abbreviation of "IN".

Waiting for Input

IN, IN16, and IN32 may also be used with additional parameters in order to wait for a specified bit pattern to appear. This is most often used in command files to perform initialization sequences. The syntax is

    IN addr mask match timeout {message}

In this case, the port at "addr" will be read, ANDed bitwise with "mask" and the result compared to "match". If equal, the command completes with no output. If not equal, the port is read repeatedly until either a match occurs or "timeout" milliseconds elapses. If a timeout occurs and a string "message" is provided, that string is shown as part of an error message. If "message" is absent, the last value read from the port is shown as for a normal IN command.

Here is an example from a NoICE startup file for an Atmel AT91SAM7 processor. It uses OUT32 to enable the crystal oscillator, then uses IN32 to wait up to 100 milliseconds for bit 0 of a status register to be set. If the bit does not become set in 100 msec, the error "Timeout: waiting for MOSCS" is shown.

    OUT32 0xFFFFFC20 0x4001
    IN32 0xFFFFFC68 0x01 0x01 100 waiting for MOSCS

If you wanted to wait for the bit to become clear rather than set, the command would be

    IN32 0xFFFFFC68 0x01 0x00 100 waiting for MOSCS to clear

IN16: Read 16-bit word from port

    IN16 addr

Similar to IN, but allows the user to perform input of 16 bits from a target port. This command is useful mostly on processors and interfaces, such as ARM with JTAG, that support multi-byte input. If the target processor or the communications interface does not support 16-bit transfers, this command will cause two byte-inputs at successive addresses.

See also Waiting for Input


IN32: Read 32-bit word from port

    IN32 addr

Similar to IN, but allows the user to perform input of 32 bits from a target port. This command is useful mostly on processors and interfaces, such as ARM with JTAG, that support multi-byte input. If the target processor or the communications interface does not support 32-bit transfers, this command will cause four byte-inputs at successive addresses.

See also Waiting for Input


OUT: Write byte to port

    OUT addr val

Allows the user to output "val" to the target port specified by "addr". If the target does not have specific input instructions or an I/O address space, then this command simply writes to target memory at the specified address.

When using the NoICE serial monitor, sixteen address bits are sent to the target, but any page bits in the specified address are ignored. Some target processors may ignore all but the low eight bits of the address.

In contrast with the EDIT command, no verification of the write is performed after OUT, as this may cause undesired side effects with some I/O devices. Thus, this command may be useful when dealing with I/O devices even for processors without separate I/O spaces.

"O" is an abbreviation of "OUT".


OUT16: Write 16-bit word to port

    OUT16 addr

Similar to OUT, but allows the user to perform output of 16 bits to a target port. This command is useful mostly on processors and interfaces, such as ARM with JTAG, that support multi-byte output. If the target processor or the communications interface does not support 16-bit transfers, this command will cause two byte-outputs at successive addresses.


OUT32: Write 32-bit word to port

    OUT32 addr

Similar to OUT, but allows the user to perform output of 32 bits to a target port. This command is useful mostly on processors and interfaces, such as ARM with JTAG, that support multi-byte output. If the target processor or the communications interface does not support 32-bit transfers, this command will cause four byte-outputs at successive addresses.


DEFREG: Define pseudo-register

Pseudo-registers allow the user to specify target memory locations which act like registers in NoICE:

Pseudo-registers are useful for the 8096, which has only a few "real" registers. They are also used as an aid to C debugging; for example, as stack frame pointers on the 8051 under some compilers. The NoICE command

    DEFREG name address size

defines a pseudo-register called "name" at "address", of "size" bytes.

"Address " may contain a page number, if supported by the target processor. "Size" must be one or two. Byte order is the native order for the processor, unless overridden by the MSBFIRST command.

Examples:

Define "?stack" as a word at address 0:0008.

    DEFREG ?stack 0:8 2

The pseudo-register "name" may be deleted by entering

    DEFREG -?stack

MSBFIRST: Define byte order for multi-byte data

This command is present only in the 8051 version of NoICE.

In most cases, multi-byte data is stored in the processor's "native" order - that is, the order in which 16 bit and larger quantities such as addresses are fetched from the code stream. The NoICE disassembler and assembler always use this order.

The 8051 is a special case. LJMP and LCALL fetch addresses most significant byte first. However, as the 8051 has no instruction which loads or stores 16 bit data, the byte order for data is up to the programmer. Some C compilers follow the "native" order for multi-byte data. However, this can be expensive in terms of program space, since the 8051 cannot decrement its DPTR register. Thus, other C compilers store multi-byte data least significant byte first. In order to WATCH and EDIT such data in the correct byte order, NoICE must be told to change the order:

    MSBFIRST 0

This command will generally be included automatically in the command file generated by the symbol processor for the compiler in question.

The order can be restored to "native" order by the command

    MSBFIRST 1

STATETEXT: Define text for target state

Each processor-specific version of NoICE defines a set of processor states which are shown in the title bar. State 0 is RESET. State 1 is BREAKPOINT. The remaining states generally define processor interrupts, and are used to report the occurance of unhandled interrupts. The state values for each processor are shown in the target monitor source code, and in the section on TARGET PROCESSORS. Target states numerically larger than those listed will be shown numerically.

In some cases, however, the default states may not match your target. This is especially true if you are using one of the myriad variants of the 8051, with a unique peripheral mix. The STATETEXT command allows you to replace the default text with text of your own choosing. The command

    STATETEXT number text string

defines the text for state "number" as "text string".

For example, the default text for 8051 state 6 is "RI & TI". You may prefer a more application-specific string such as "RS-485 Uplink", set by the command

    STATETEXT 6 RS-485 Uplink

NoICE (tm) Debugger, Copyright 2012 by John Hartman

Using NoICE - Contact us - NoICE Home