2.18 Setting Up the Hook Process

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

By setting up hook transaction, it is possible to automatically change the I/O register and CPU register values before or after downloading a load module or after resetting the CPU.

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

Remark

You can increase the download speed by configuring the I/O register in the [Before download] property. Equally, you can facilitate downloading to external RAM by the setting in this category.

Figure 2.181

[Hook Transaction Settings] Category

Table 2.25

Properties of the [Hook Transaction Settings] Category

Properties

Timing

Before download

Performs a specified process immediately before load module files are downloaded.

After download

Performs a specified process immediately after load module files are downloaded.

After CPU reset under breaking

Performs a specified process immediately after the CPU is reset.

Before running

Performs a specified process immediately before program execution starts.

After breaking

Performs a specified process immediately after program execution breaks.

 

Each property in the [Hook Transaction Settings] category shows the timing with which a hook transaction is performed. The numeral shown in bracket [ ] for each property value indicates the number of currently specified transactions. (No hook transactions are set by default.)

Follow the procedure below to perform hook transaction on the desired property.

To specify the transaction, select the desired property and click the [...] button that appears on the right end of the column. This will open the Text Edit dialog box in which you can specify the transaction.

Figure 2.182

Text Edit Dialog Box Opened

Figure 2.183

Configuring Hook Transaction (Text Edit Dialog Box)

 

In this dialog box, enter the desired transaction directly from the keyboard.

You can use one of the following formats for specifying the desired transaction.

 

[Format: 1]

Overwrites the I/O register contents with numeric values.

I/O register name Numeric value

 

[Format: 2]

Overwrites the CPU register contents with numeric values.

CPU register name Numeric value

 

[Format: 3]

Executes a script file designated by Python script path (absolute path or relative path using project folder as a base).

Source Python script path

Remark 1.

When specifying the transaction, add "#" at the top of the line to comment it out.

Remark 2.

The space can be substituted by a tab character.

Caution

The following commands can be used in a Python script to be executed as a hook process of the debugger.

 

debugger.Register.GetValue

debugger.Register.SetValue

debugger.Memory.GetValue

debugger.Memory.SetValue

 

If you wish to execute other Python commands, use the Hook command of the Python console.

 

You can enter up to 64 characters for one transaction and can specify up to 128 transactions for each property. (One line in the [Text] area in the Text Edit dialog box corresponds to one transaction.)

When finished with specifying the transaction, click [OK] to reflect it in the Property panel.

Figure 2.184

Example of Hook Transaction Setting