2.18 Use Hook Function

This section describes how to set hooks in the debug tool by using the hook function.

By setting a hook transaction, you can automatically change the values of the I/O register/CPU register before and after downloading a load module or after resetting the CPU.

Configure the hook transaction in the [Hook Transaction Settings] category on the [Hook Transaction Settings] tab of the Property panel.

Remark

By setting a I/O register by using the [Before download] property, for example, downloading can be executed at high speeds. Downloading to the external RAM is also facilitated by using this function.

Figure 2.147

[Hook Transaction Settings] Category

Table 2.22

Properties in [Hook Transaction Settings] Category

Property

Description

Before download

Perform the specified process immediately before downloading the load module file.

After download

Perform the specified process immediately after downloading the load module file.

After CPU reset under breaking

Perform the specified process immediately after resetting the CPU under breaking.

Before running

Perform the specified process immediately before starting program execution.

After breaking

Perform the specified process immediately after breaking program execution.

 

The properties in the [Hook Transaction Settings] category indicate the timing with which the hook process will be performed. "[]" indicates the current number of specified processes (no hook processes are configured by default).

Specify the target process in the property for which you want the hook process to be performed.

To specify a process, select the target property, then open the Text Edit dialog box by clicking the [...] button that appears on the right edge of the field.

Figure 2.148

Opening Text Edit Dialog Box

Figure 2.149

Use Hook Function (Text Edit Dialog Box)

 

In this dialog box, directly enter the desired process from the key board.

The format for specifying processes is as follows:

 

[Process 1]:

Automatically overwrites the value of I/O register with Value.

Specification format:

I/O-register-name Value

 

[Process 2]:

Automatically overwrites the value of CPU register with Value.

Specification format:

CPU-register-name Value

 

[Process 3]:

Automatically executes a script file which is specified with Python script path (absolute path or relative path from the project folder).

Specification format:

Source Python-script-path

Remark 1.

When specifying hook processes, lines starting with a hash mark "#" will be treated as comments.

Remark 2.

A tab character can be used instead of the space character.

Caution

You can use the following commands when you execute the Python script in the Hook process of the debugger.
debugger.Register.GetValue
debugger.Register.SetValue
debugger.Memory.GetValue
debugger.Memory.SetValue
If you want to use other Python command, please use Hook command in the Python console.




 

Up to 64 characters for one process, and up to 128 processes for each property can be set (one line in the [Text] area in the Text Edit dialog box is equivalent to one processing).

After the specification of the process is complete, click the [OK] button to set the process to the Property panel.

Figure 2.150

Example of Hook Transaction