3.15.4. Use of the Programming bit

When programming the PTM registers you must enable all the changes at the same time. For example, if you reprogram the counter, it might start to count based on incorrect events, before you have set up required counter enable condition. Also, the programming interface clock can be asynchronous to the PTM clock.

You must use the Programming bit, ProgBit, in the Main Control Register, to disable all PTM operations during programming. For more information see Main Control Register, ETMCR.

Figure 3.11 shows the procedure for using ProgBit to control the programming of the PTM registers. When the Programming bit is set to 0 you must not write to any trace register other than the Main Control Register, because this can lead to unpredictable behavior.

When setting the Programming bit to 1, you must not change any other bits of the Main Control Register. You must only change the value of Main Control Register bits other than the Programming bit when bit [1] of the Status Register is set to 1. ARM recommends that you use a read-modify-write procedure when modifying the Main Control Register.

Figure 3.11. Programming PTM registers

To view this graphic, your browser must support the SVG format. Either install a browser with native support, or install an appropriate plugin such as Adobe SVG Viewer.

You can program the PTM registers regardless of whether the processor is in Debug state.

Programming bit and associated state

The Programming bit disables all PTM functions. See Figure 3.11 for the procedure to change this bit. While the Programming bit is set to 1:

  • Trace generation is disabled. The FIFO is emptied and then no more trace is produced.

  • The counters, sequencer, and start/stop block are held in their current state.

  • The external outputs are forced LOW.

PTM state items

The following items of PTM state are affected by the Programming bit:

  • the value of the counters, held in the Counter Value Registers, 0x5C-0x5F

  • the sequencer

  • the start/stop resource status, bit [2] of the Status Register

  • the trigger flag, bit [3] of the Status Register.

You can read and write the PTM state information directly. This means you can save this state information when powering down the ARM processor, and restore it when restarting the system.

The PTM retains its state while the Programming bit is set to 1 and tracing is disabled. The state is reset when the Programming bit is cleared to 0, unless written to since the Programming bit was last set to 1. You must set the Programming bit to 1 before reading the state. This holds the state stable, ensuring you obtain a consistent result. See Use of the Programming bit for more information.

Copyright © 1999-2002, 2004-2008, 2011 ARM. All rights reserved.ARM IHI 0035B