# Extensions

In addition to the built-in commands, NoICE allows several types of extensions. These allow NoICE to automatically run other programs, optionally passing parameters such as file names etc.

## Setting Up Extensions

Extensions are set up in the Extensions Dialog, which may be invoked by selecting "Extensions" from the Options menu. The Extensions Dialog allows you to define up to four extensions of various types. These are described in detail below.

## Run At Startup

The first type of extension specifies a program to be run when NoICE starts up, before communications is opened with the target.

One example of such a program would a GDB or RDI server. Such servers must be up and running before NoICE can communicate with them. Another example is a loader for an EPROM emulator. If the NoICE monitor resides in emulator memory, you must load the monitor before NoICE can communicate with it, and this extension provides a convenient way to automate this task.

The first edit box contains the command to run, including any parameters. Note that the "current directory" for the program is the same as NoICE's current directory. Thus, you may need to specify explicit paths for command arguments.

A check-box lets you specify whether NoICE should always run the program, or if it should check to see if the program is already running. For example, if a GDB server is already running, NoICE should generally use it and not run another copy.

If NoICE does run the program, you can specify a delay in milliseconds that NoICE should wait before continuing. Most programs take some time to be ready for service. The delay is not applied if the "do not run if already running" check-box is checked and the program is found to be running.

After NoICE runs the program, there are several options

1. NoICE can wait for the program to exit before continuing. This is appropriate for programs that complete quickly, and do not need to continue running during NoICE execution. For example, some sort of loader program.
2. NoICE can allow the program to run as long as NoICE runs. When you exit NoICE, it will try to close the extension by sending it a WM_CLOSE Windows message. This is appropriate for programs that must continue running for as long as NoICE does, such as a GDB or RDI server.
3. NoICE can allow the program to run even after NoICE exits. This may be the only option for programs that do not respond to NoICE's request to exit (WM_CLOSE message) when you specify option 2. It is also appropriate if you do not want a GDB server or similar program to start and stop each time you run NoICE. (In which case you would also check the "do not run if already running" check-box.)

The second type of extension specifies a program to be run when NoICE is given the LOAD command, whether from the command box, the menu, or the toolbar.

If no program is specified, then the normal NoICE LOAD operation occurs. If a program is specified, the command tail, including the name of the file to be loaded, may be passed to the program using a parameter format similar to NoICE command files.

Within the string specified for the LOAD extension, the formal parameter names %1% through %9% will be replaced by the actual parameters used when the LOAD command is invoked. If any parameter is not specified, the corresponding formal parameter will have a null (empty string) value. For example, if you enter the string

    "C:\Program Files\Emu\EP_LOADER.exe" %1%


to be run for the LOAD command, then the NoICE command

    LOAD C:\foo\bar.s19


    "C:\Program Files\Emu\EP_LOADER.exe" C:\foo\bar.s19


at a Windows command prompt. NoICE will then wait for your program to exit before continuing.

A check box allows you to select whether or not NoICE should close target communications before running the LOAD extension. It will be necessary to check this box if your extension program uses the same serial or parallel port that NoICE does. In this case, when your extension program exits NoICE will re-open target communications and re-read processor registers etc. In some cases (such as BDM for the HC12) re-opening target communications will cause the target to be reset.

Hint: To become familiar with this extension and with the parameter substitution, you might try temporarily specifying a program such as notepad:

    "C:\Windows\notepad.exe" %1%


Please note: NoICE's built-in LOAD command can load various formats, including Intel and Motorola/Freescale hex, Elf/dwarf, and IEEE 695. If you provide a LOAD extension, NoICE simply passes you the file name. It is up to your program to read and process the data within the file. If the file contains debug information, this information will not be available to NoICE if you are using a LOAD extension.

## Extensions EX1 and EX2

The third type of extension specifies a program to be run by explicit command, either from the command box or from the menu. Two such extensions are allowed, invoked by the commands EX1 and EX2.

If a program is specified for one of these extensions, the command tail may be passed to the program using a parameter format similar to NoICE command files.

Within the string specified for the extension, the formal parameter names %1% through %9% will be replaced by the actual parameters used when the command is invoked. If any parameter is not specified, the corresponding formal parameter will have a null (empty string) value. For example, if you enter the string

    "C:\Program Files\foo\bar.exe" %2%-%1%


to be run for the EX1 command, then the NoICE command

    EX1 ducks chickens


    "C:\Program Files\foo\bar.exe" chickens-ducks