This section applies only if you are using the NoICE Classic Monitor. If you are using BDM (HC12 or MC9S08) or JTAG (ARM or MSP430), this section does not apply to you.
The task of supporting a new target hardware platform is relatively easy. The starting point is the supplied NoICE target monitor for your processor. If your target hardware currently uses a hex monitor such as Buffalo, you may wish to refer to the source code for that monitor for details about hardware initialization, UART usage etc.
Further information is available about the NoICE Classic Monitor, about reset and interrupt processing, and about support for particular target hardware, including SBC's and eval boards.
Source code for the monitors may be found in the "monitors" subdirectory of wherever you install NoICE. The default location is C:\Program Files\NoICE\monitors.
If you prefer not to customize the monitor yourself, customization. is available for a fee.
The target monitors are written such that hardware-dependent code is isolated to a few locations in the source file. The areas to be examined and changed as required are these:
As provided, most target monitors switch to a monitor stack upon entry to the monitor via breakpoint, and switch to the user stack to execute user programs. If your RAM is limited, you may with to eliminate the stack switching. Search the monitor for references to REG_SP, INITSTACK, and MONSTACK and replace as appropriate.
The 8051 and 6502 have 8-bit stack pointers and do not switch stacks.
When the monitor is first started, it initializes the interrupt region of download RAM to point to default interrupt handlers within the monitor. Thus, if an interrupt occurs for which the user code has not provided a handler, the default handler will cause entry into the monitor as if a breakpoint had been executed. The identity of the interrupt will be displayed as the processor state in the NoICE title bar.
There is a drawback to this operation, however. If the target is reset after you download your program, the monitor will overwrite your program's interrupt vectors with the defaults. Thus, you must download after every target reset. If you prefer not to do this, you will need to modify your target monitor so that it does not initialize the interrupt region of download RAM.
Test the modified target monitor by connecting its serial port to that of a PC. Turn on the target, and then run NoICE. If you are lucky, NoICE will talk to your target immediately. if not, you will get several beeps, and an indication of a communications error. In the latter case, first verify that NoICE is set to use the correct serial port and baud rate.
If you don't already have one, go to Radio Shack (or similar emporium of your choice) and buy an "RS-232 Mini-Tester". This device has a bi-color LED for the seven most common RS-232 signal lines. It is of great assistance in verifying that your cable is correctly wired, and that your target is driving the correct line.
Enable communications debug via Show Comm on the Options menu. Now issue the VERSION command to send a FN_GET_STATUS request to the target. Both the request and any reply are shown in hex. The hex values (if any) displayed can assist you in debugging your target monitor. The most common problems are bad cables and mismatched baud rates (unless, of course, you happen to make a programming error...).
Most of the communications functions can be exercised individually via keyboard commands:
VERSION will exercise FN_GET_STATUS, and display any results, including the target's identification string.
REG followed by carriage return will exercise FN_READ_REGS. Any returned values will be displayed in the register window. A common error is to forget to return 16 bit registers least significant byte first. Check the displayed registers to see if this is the case.
REG followed by a register name and a value will exercise FN_WRITE_REGS. In order to verify that the register was accepted by the target, follow this command by R to read back the registers from the target.
EDIT followed by an address will exercise FN_READ_MEM. to read one byte at the specified address. It is often useful to read the first byte of the target monitor, or some other location with known contents. DUMP or UNASM will use FN_READ_MEM to read multiple bytes.
EDIT followed by an address and a value or values will exercise FN_WRITE_MEM to write the specified values to the specified address. Since FN_WRITE_MEM verifies the write, you should attempt to write both RAM and PROM in order to insure that the monitor verifies correctly.
IN followed by an address will exercise FN_IN to input a byte from the specified address. This should be tested even if your target does not have specific I/O instructions.
OUT followed by an address and a value will exercise FN_OUT to output a byte to the specified address. This should be tested even if your target does not have specific I/O instructions.
BREAK followed by an address will exercise FN_SET_BYTES twice, to temporarily insert and remove a breakpoint. In order to test the ability to set multiple bytes with a single FN_SET_BYTE, you must set several breakpoints, and then issue a GO command to insert them all.
GO will exercise FN_RUN_TARGET. If an address is specified, it will be sent to the target via FN_WRITE_REGS before FN_RUN_TARGET is issued. If breakpoints have been set, they will be sent to the target via FN_SET_BYTES before FN_RUN_TARGET is issued. A reply to FN_RUN_TARGET will only occur if the target returns to the monitor after beginning execution. This may be arranged either by inserting a breakpoint, or by assembling a breakpoint instruction (typically a software interrupt) into the code to be executed on the target.
Customized NoICE monitors exist for a number of popular target boards. The following are included in the NoICE distribution. Source code may be found in the "monitors" subdirectory of wherever you install NoICE. The default location is C:\Program Files\NoICE\monitors.
The NoICE monitor requires a serial interface to the PC host. In many cases, you can use the UART on the target processor. However, in some applications this UART may be connected to an RS-485 port or other application hardware and not be available to the monitor. In such cases, you could hack a second UART and RS-232 transceiver onto your debug board, or use a pair of port pins for a bit-twiddled serial port.
An attractive alternative is the One Pin UART, available from Rhombus www.rhombusinc.com, 1909 Old Mountain Creek Rd., Greenville, SC 29609. This device allows a single bi-directional I/O pin to function as a full duplex RS-232 port. It connects with clip leads to the target's power, ground, and port pin, and has a DB-25 connector for a PC serial cable.
Source code for Get and Put character routines are provided for a number of processors, including the 8051, 68HC11, AVR, and PIC. These routines can be substituted for the GetChar and PutChar routines in the NoICE monitors.