ARM Technical Support Knowledge Articles

In DAPML, what is the difference between DAP_READ_AP / DAP_WRITE_AP and DAP_READ_APACC / DAP_WRITE_APACC

Applies to: Cortex-M3

Scenario

Licensees of the Cortex-M3 processor also receive an "example" testbench which includes a CoreSight debug transactor model called "SWJIM". The SWJIM can be programmed by writing a code segment in DAP Macro Language (DAPML).

DAPML provides multiple commands for reading and writing registers in the Access Port (AP) components in the Debug Access Port (DAP).

DAP_READ_AP or DAP_READ_APACC can be used to read from an AP register.

DAP_WRITE_AP or DAP_WRITE_APACC can be used to write to an AP register.

The Debug Port (DP) enables access to any one of the possible 256 APs, and selects a bank of four registers within that AP, by programming the DP.SELECT register with the appropriate values in the APSEL and APBANKSEL fields.

Answer

The main difference between DAP_READ_AP and DAP_READ_APACC is that DAP_READ_AP takes an initial argument which specifies which AP to read, before specifying which register to read and the expected value and optional mask; whereas DAP_READ_APACC accesses the currently-selected AP.

Another difference between these instructions is that DAP_READ_AP takes an 8-bit hexadecimal argument to specify the required register address within the AP (using word-aligned addresses in multiples of 0x4), whereas DAP_READ_APACC takes a 2-bit hexadecimal argument to indicate the register number within the currently-selected register bank.

The "write" operations DAP_WRITE_AP and DAP_WRITE_APACC differ in the same way as the "read" operations above.

The effect of these addressing modes is that the "..._AP" commands include an implicit write to the DP.SELECT register before each AP access, meaning that they explicitly program both the selected AP and the selected bank within that AP, whereas the "..._APACC" do not reprogram the DP.SELECT register and therefore can only access the four registers in the currently-selected bank of the current AP.

For example:

  DAP_WRITE_AP <AP-name> 0x04 0x00020000

and

  DAP_WRITE_APACC 0x1 0x00020000

represent the same operation, assuming that the currently-selected AP is <AP-name> and the current APBANKSEL is 0x0.

When switching between Banks within the same AP, it is still necessary to use a "..._AP" command, as this is required in order to reprogram the APBANKSEL field of the DP.SELECT register, even when selecting the same AP in the APSEL field.

For example, a read of the IDR at address 0xFC followed by a write of the TAR at address 0x04 in the same AP would require the use of a DAP_WRITE_AP command in order to change the APBANKSEL from 0xF to 0x0.

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential