NoICE Debugger

ARM Tutorials

Running NoICE for the first time

Connecting to hardware

Compiling for debugging

Source-level debugging

 
Home Download Purchase Tutorials FAQ NoICE Help

ARM: Running NoICE for the First Time

In most cases, you will be debugging programs at source level, using symbols rather than addresses. However, as an introduction to NoICE we recommend that you get some experience with the user interface first.

The first time you run NoICE after installing it, a dialog will appear asking you to choose a method of communications. For this section of the tutorial, we select "Simulator". If you need to come back to this dialog, select "Options" from the NoICE main menu, then select "Target Communications".
Simulator setup dialog
  • We have selected "ARM simulator"

  • ARM is available in both big-endian and little-endian versions. Since we will eventually be moving to the little-endian LPC2106, we select little-endian.

  • Can't do printf unless you have a UART. The LPC2106 has two UARTS. The Olimex LPC-P2106 demo board that we will be using later has an RS-232 interface connected to UART0, so we will use that UART in our samples.

    The LPC2106 User's Manual tells us that UART0's Line Status Register, U0LSR, is at address 0xE000C014. This register contains bits for both transmit ready and receive ready, so we use 0xE000C014 for both Tx Status Address and Rx Status Address.

    Bit five of this register is Transmit Holding Register Empty, THRE, so the Tx Ready Mask is 0x20. Bit zero of this register is Receive Data Ready, RDR, so the Rx Ready Mask is 0x01.

    UART0's Transmit Holding Register U0RBR is at address 0xE000C000. UART0's Receive Buffer Register U0RBR is at address 0xE000C000

The UART address is important during simulation only insofar as you will need to make sure that you compile for the correct target in a later section of the tutorial. Don't worry, we will remind you.


Press "OK" in the Target Communications dialog, and NoICE will show an initial display like that shown below. If you exit NoICE and come back in, you will return right here.

Initial NoICE display using simulator

After reset, the ARM sets PC to zero and fetches the first instruction from there. Unlike a real LPC2106, the simulator initializes all memory to zeros. NoICE disassembles from the PC, showing a bunch of ANDEQ instructions - op-code zero. If you were using JTAG, the disassembled instructions would be more interesting.


The ARM7 has a large set of CPU registers, which NoICE displays in a column on the right, with the most useful registers near the top. You may find that in order to see all the registers you must stretch the NoICE main window larger than you would like. If this occurs, you may want to use a smaller font for the register window. You can adjust the fonts and colors used by NoICE by selecting "Options" from the main menu, and then selecting "Fonts and Colors...". Fonts and Colors

Memory Edit: Click on the "Memory" tab near the bottom of the NoICE screen. Enter the address 40000000 and press the "Read" button or the Enter key. We use the address 40000000 since it will be RAM on a real LPC2106.

Memory View - bytes

NoICE will show the contents of memory in hex and ASCII. To change the contents of memory, click on a byte and type hex characters: 55, 66, 77 in the screenshot above. Changed bytes are shown in red.

To edit the ASCII, click on a character in the ASCII field and type the desired characters.

Values are written to the target as you change each byte. Note that the memory window may not be suitable for use on I/O addresses, as extra reads and writes of I/O locations may cause undesired actions.

If is often useful to examine memory as 16-bit or 32-bit words rather than as bytes. If you click on the drop-list you can select an 8-bit, 16-bit, or 32-bit view.

Memory View - 32-bit

In addition to the Memory tab, you can edit memory using the EDIT, IN, and OUT commands. EDIT is most useful in conjunction with symbols and datatypes. IN and OUT are designed for access to I/O devices.

NoICE help on the Memory View

NoICE help on EDIT

NoICE help on DUMP

NoICE help on IN and OUT


Disassembly: We can view our changes to memory in the disassembly window by either

Selecting "View", "Disassemble At..." from the menu
Disassemble At dialog
or Clicking in the edit box on the Toolbar and typing the command "u 40000000" and either pressing the "OK" button or the Enter key.
Disassemble At commnad

Either way, the result is a rather intimidating but not very useful instruction.

Disassembly

To continue disassembly, just click in the disassembly window and press the PageDown key, or use the scrollbar.


Loading a hex File:

To get some more interesting instructions into memory, we will load a Motorola S-record file. You can get our sample here

Select "File", "Load..." from the menu, or press the "bit funnel" on the toolbar. Then select the file. Don't worry about any of the other settings in the dialog.

LOAD dialog

This file contains an S7 record that specifies the starting address.

  S70540000000BA

When NoICE reads this record, it sets PC and disassembles from this location.

Some assemblers and compilers set the S7 address at zero. In this case, you will need to set PC yourself (see Registers below.)

NoICE help on loading files

Disassembly after LOAD


Single-step:

Press the F11 function key, or click the Step Into button on the toolbar. PC changes to 40000004, R0 changes to 3E8, and the PC arrow in the disassembly window moves.

Note that the PC and R0 are shown in red to indicate that they have changed.

After single-step

Press F11 again. PC changes to 40000008, and R0 decrements to 3E7. You can continue stepping around the loop until you get bored.


Registers:

The column on the right of the NoICE screen shows the values of the processor registers.

You can click on a register to change its value. Or select "Processor", "Change Register...".

If you would rather type than click, you can avoid the dialog by typing

    R R4 12345678
in the command edit box in the toolbar.
Change Register dialog


Breakpoints:

Double-click on the address (40000010) to the left of the B 40000000 instruction. A red target appears, indicating a breakpoint.

Breakpoint set

Now press F5, or the "Go" button on the toolbar. The program stops almost immediately at the breakpoint. R0 has a value of 0, having decremented until the BNE branch did not branch, and R4 has been incremented.

Note that the CPSR shows the Z (zero) bit is set.

Breakpoint set

Press F5 or click Go again. The program again stops at the breakpoint, but R4 has incremented.

NoICE help on Breakpoints

Remove the breakpoint by double-clicking on address 40000010. Press F5 or click Go to let the program run free.

Note that the Go button shows as pressed and the title bar shows "running".

Press the Go button again to stop the program. Or use the "Halt" command.

Run/Stop button in run state


Continue the tutorial with Compiling for Debugging

Continue the tutorial with Connecting to hardware

NoICE help

 
   
NoICE Debugger • Copyright © 2006 by John Hartman • Revised 22 November 2006