Everything
2.17 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 SFR/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 SFR 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.112

[Hook Transaction Settings] Category

Table 2.23

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.113

Opening Text Edit Dialog Box

Figure 2.114

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 SFR with Value.

Specification format:

SFR-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

Caution

You can use the following commands when you execute the Python script in the Hook process of the debugger. Note that if you want to use other Python command, please use Hook command in the Python console.

-

debugger.Register.GetValue

-

debugger.Register.SetValue

-

debugger.Memory.Read

-

debugger.Memory.Write

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.

 

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.115

Example of Hook Transaction