2.3.120. SETREG

Changes the contents of a register, status flag, or a special target variable such as the cycle count.

Syntax

SETREG [@register_name [=value]]

where:

register_name

Specifies a register. Register names begin with an at sign (@).

value

Defines the value to be placed in the register.

Description

This command changes the contents of a register, status flag, or a special target variable such as the cycle count.

Note

If you use this command when running in command line mode, you must supply a register_name. Otherwise, the command has no effect.

Register names

You can set the value of any register, or register bit-field, that is defined by an active .bcd file. To link a relevant definition file to the current connection, use Connection Properties window to set the BoardChip name for the connection.

You can view the currently defined registers using the PRINTSYMBOLS command, for example:

PRINTSYMBOLS /r *

This also displays any reserved symbols and internal variables that are currently defined.

By defining new registers in a .bcd file, you can extend the register list to, for example, include peripheral control registers for your target.

Note

Some processors and peripherals have some read-only registers. These cannot be written to with SETREG.

Command line usage

You can set the value of registers defined in a board chip file or by the processor model, by prefixing the register name with the @ symbol and assigning it a value. The value can include program and debugger symbols and debugger expressions.

Note

Change the values of target registers with care. Compilers and operating systems do not always use registers in the expected manner.

Fully Interactive register setting

In the GUI, if you supply no parameters, the SETREG command displays the Interactive Register Setting dialog box where you can specify a register and a value. Figure 2.3 shows an example. The Register drop-down list contains the names of recently used registers. To select other register names, click either Next Reg or Prev Reg. The current value of the register is displayed in the Value field, in both unsigned hexadecimal and in signed decimal.

Figure 2.3. Interactive Register Setting dialog

Interactive Register Setting dialog

Enter a new value in the combo-box beneath Enter New Value and then click Set. The Log tab displays the changes you have made.

Select Clear New to clear the Enter New Value field after setting a register with Set. If Clear New is unchecked, the value you enter remains in the field and you can set multiple registers with repeated clicks on Set.

Click Auto Inc Reg or Auto Dec Reg to select whether, after clicking Set, the next higher or next lower numbered register is selected.

Partly Interactive register setting

If you supply only a register name, the SETREG command displays a prompt, shown in Figure 2.4, enabling you to enter a new value for that register.

Figure 2.4. Register value prompt

Register value prompt

Enter the value in the text field and click Set to change the register, or click Cancel to abort the command.

Alias

SR is an alias of SETREG.

Examples

The following examples show how to use SETREG:

setreg @r3=0x50

Write the value 0x50 to processor register R3.

setreg @spsr_svc

Display a prompt, shown in Figure 2.4, containing the current value of ARM processor register SPSR_SVC (saved program status register, Supervisor mode). Use the text box to enter a new value.

setreg @v=1

Set the ALU overflow flag in the current program status register.

setreg

Invoke the Interactive Register Setting dialog shown in Figure 2.3.

See also

Copyright © 2002-2011 ARM. All rights reserved.ARM DUI 0175N
Non-ConfidentialID052111