Target Memory
mrd
Memory Read
Syntax
mrd [options] <address> [num]
Read <num>
data values from the active target's memory address specified by <address>
.
Options
Option | Description |
---|---|
-force |
Overwrite access protection. By default accesses to reserved and invalid address ranges are blocked. |
-size <access-size> |
<access-size> can be one of the values below: b = Bytes accesses h = Half-word accesses w = Word accesses d = Double-word accesses Default access size is w Address will be aligned to access-size before reading memory, if '-unaligned-access' option is not used. For targets which do not support double-word access, debugger uses 2 word accesses. If number of data values to be read is more than 1, then debugger selects appropriate access size. For example, 1. mrd -size b 0x0 4 Debugger accesses one word from the memory, displays 4 bytes. 2. mrd -size b 0x0 3 Debugger accesses one half-word and one byte from the memory, displays 3 bytes. 3. mrd 0x0 3 Debugger accesses 3 words from the memory and displays 3 words. |
-value |
Return a Tcl list of values, instead of displaying the result on console. |
-bin |
Return data read from the target in binary format. |
-file <file-name> |
Write binary data read from the target to <file-name> . |
-address-space <name> |
Access specified memory space instead default memory space of current target. For ARM DAP targets, address spaces DPR, APR and AP<n> can be used to access DP Registers, AP Registers and MEM-AP addresses, respectively. For backwards compatibility -arm-dap and -arm-ap options can be used as shorthand for "-address-space APR" and "-address-space AP<n> ", respectively. The APR address range is 0x0 - 0xfffc, where the higher 8 bits select an AP and lower 8 bits are the register address for that AP. |
-unaligned-access |
Memory address is not aligned to access size, before performing a read operation. Support for unaligned accesses is target architecture dependent. If this option is not specified, addresses are automatically aligned to access size. |
Note(s)
- Select a APU target to access ARM DAP and MEM-AP address space.
Returns
Memory addresses and data in requested format, if successful. Error string, if the target memory cannot be read.
Example(s)
mrd 0x0
Read a word at 0x0.
mrd 0x0 10
Read 10 words at 0x0.
mrd -value 0x0 10
Read 10 words at 0x0 and return a Tcl list of values.
mrd -size b 0x1 3
Read 3 bytes at address 0x1.
mrd -size h 0x2 2
Read 2 half-words at address 0x2.
mrd -bin -file mem.bin 0 100
Read 100 words at address 0x0 and write the binary data to mem.bin.
mrd -address-space APR 0x100
Read APB-AP CSW on Zynq. The higher 8 bits (0x1) select the APB-AP and lower 8 bits (0x0) is the address of CSW.
mrd -address-space APR 0x04
Read AHB-AP TAR on Zynq. The higher 8 bits (0x0) select the AHB-AP and lower 8 bits (0x4) is the address of TAR.
mrd -address-space AP1 0x80090088
Read address 0x80090088 on DAP APB-AP. 0x80090088 corresponds to DBGDSCR register of Cortex-A9#0, on Zynq AP 1 selects the APB-AP.
mrd -address-space AP0 0xe000d000
Read address 0xe000d000 on DAP AHB-AP. 0xe000d000 corresponds to QSPI device on Zynq AP 0 selects the AHB-AP.
mwr
Memory Write.
Syntax
mwr [options] <address> <values> [num]
Write <num>
data values from list of <values>
to active target memory address specified by <address>
. If <num>
is not specified, all the <values>
from the list are written sequentially from the address specifed by <address>
If <num>
is greater than the size of the <values>
list, the last word in the list is filled at the remaining address locations.
mwr [options] -bin -file <file-name> <address> [num]
Read <num>
data values from a binary file and write to active target memory address specified by <address>
. If <num>
is not specified, all the data from the file is written sequentially from the address specifed by <address>
.
Options
Option | Description |
---|---|
-force |
Overwrite access protection. By default accesses to reserved and invalid address ranges are blocked. |
-bypass-cache-sync |
Do not flush/invalidate CPU caches during memory write. Without this option, debugger flushes/invalidates caches to make sure caches are in sync. |
-size <access-size> |
<access-size> can be one of the values below: b = Bytes accesses h = Half-word accesses w = Word accesses d = Double-word accesses Default access size is w. Address will be aligned to accesss-size before writing to memory, if '-unaligned-access' option is not used. If target does not support double-word access, the debugger uses 2 word accesses. If number of data values to be written is more than 1, then debugger selects appropriate access size. For example, 1. mwr -size b 0x0 {0x0 0x13 0x45 0x56} Debugger writes one word to the memory, combining 4 bytes. 2. mwr -size b 0x0 {0x0 0x13 0x45} Debugger writes one half-word and one byte to the memory, combining the 3 bytes. 3. mwr 0x0 {0x0 0x13 0x45} Debugger writes 3 words to the memory. |
-bin |
Read binary data from a file and write it to target address space. |
-file <file-name> |
File from which binary data is read to write to target address space. |
-address-space <name> |
Access specified memory space instead default memory space of current target. For ARM DAP targets, address spaces DPR, APR and AP<n> can be used to access DP Registers, AP Registers and MEM-AP addresses, respectively. For backwards compatibility -arm-dap and -arm-ap options can be used as shorthand for "-address-space APR" and "-address-space AP<n> ", respectively. The APR address range is 0x0 - 0xfffc, where the higher 8 bits select an AP and lower 8 bits are the register address for that AP. |
-unaligned-accesses |
Memory address is not aligned to access size, before performing a write operation. Support for unaligned accesses is target architecture dependent. If this option is not specified, addresses are automatically aligned to access size. |
Note(s)
- Select a APU target to access ARM DAP and MEM-AP address space.
Returns
Nothing, if successful. Error string, if the target memory cannot be written.
Example(s)
mwr 0x0 0x1234
Write 0x1234 to address 0x0.
mwr 0x0 {0x12 0x23 0x34 0x45}
Write 4 words from the list of values to address 0x0.
mwr 0x0 {0x12 0x23 0x34 0x45} 10
Write 4 words from the list of values to address 0x0 and fill the last word from the list at remaining 6 address locations.
mwr -size b 0x1 {0x1 0x2 0x3} 3
Write 3 bytes from the list at address 0x1.
mwr -size h 0x2 {0x1234 0x5678} 2
Write 2 half-words from the list at address 0x2.
mwr -bin -file mem.bin 0 100
Read 100 words from binary file mem.bin and write the data at target address 0x0.
mwr -arm-dap 0x100 0x80000042
Write 0x80000042 to APB-AP CSW on Zynq The higher 8 bits (0x1) select the APB-AP and lower 8 bits (0x0) is the address of CSW.
mwr -arm-dap 0x04 0xf8000120
Write 0xf8000120 to AHB-AP TAR on Zynq The higher 8 bits (0x0) select the AHB-AP and lower 8 bits (0x4) is the address of TAR.
mwr -arm-ap 1 0x80090088 0x03186003
Write 0x03186003 to address 0x80090088 on DAP APB-AP 0x80090088 corresponds to DBGDSCR register of Cortex-A9#0, on Zynq AP 1 selects the APB-AP.
mwr -arm-ap 0 0xe000d000 0x80020001
Write 0x80020001 to address 0xe000d000 on DAP AHB-AP 0xe000d000 corresponds to QSPI device on Zynq AP 0 selects the AHB-AP.
osa
Configure OS awareness for a symbol file.
Syntax
osa -file <file-name> [options]
Configure OS awareness for the symbol file <file-name>
specified. If no symbol file is specifed and only one symbol file exists in target's memory map, then that symbol file is used. If no symbol file is specifed and multiple symbol files exist in target's memory map, then an error is thrown.
Options
Option | Description |
---|---|
-disable |
Disable OS awareness for a symbol file. If this option is not specified, OS awareness is enabled. |
-fast-exec |
Enable fast process start. New processes will not be tracked for debug and are not visible in the debug targets view. |
-fast-step |
Enable fast stepping. Only the current process will be re-synced after stepping. All other processes will not be re-synced when this flag is turned on. |
Note(s)
- fast-exec and fast-step options are not valid with disable option.
Returns
Nothing, if OSA is configured successfully. Error, if ambiguous options are specified.
Example(s)
osa -file <symbol-file>
-fast-step -fast-exec
Enable OSA for <symbole-file>
and turn on fast-exec and fast-step modes.
osa -disable -file <symbol-file>
Disable OSA for <symbol-file>
.
memmap
Modify Memory Map.
Syntax
memmap <options>
Add/remove a memory map entry for the active target.
Options
Option | Description |
---|---|
-addr <memory-address> |
Address of the memory region that should be added/removed from the target's memory map. |
-alignment <bytes> |
Force alignment during memory accesses for a memory region. If alignment is not specified, default alignment is chosen during memory accesses. |
-size <memory-size> |
Size of the memory region. |
-flags <protection-flags> |
Protection flags for the memory region. <protection-flags> can be a bitwise OR of the values below: 0x1 = Read access is allowed 0x2 = Write access is allowed 0x4 = Instruction fetch access is allowed Default value of <protection-flags> is 0x3 (Read/Write Access). |
-list |
List the memory regions added to the active target's memory map. |
-clear |
Specify whether the memory region should be removed from the target's memory map. |
-relocate-section-map <addr> |
Relocate the address map of the program sections to <addr> . This option should be used when the code is self-relocating, so that the debugger can find the debug symbol info for the code. <addr> is the relative address, to which all the program sections are relocated. |
-osa |
Enable OS awareness for the symbol file. Fast process start and fast stepping options are turned off by default. These options can be enabled using the osa command. See "help osa" for more details. |
-properties <dict> |
Specify advanced memory map properties. |
-meta-data <dict> |
Specify meta-data of advanced memory map properties. |
Note(s)
- Only the memory regions previously added through memmap command can be removed.
Returns
Nothing, while setting the memory map, or list of memory maps when -list option is used.
Example(s)
memmap -addr 0xfc000000 -size 0x1000 -flags 3
Add the memory region 0xfc000000 - 0xfc000fff to target's memory map Read/Write accesses are allowed to this region.
memmap -addr 0xfc000000 -clear
Remove the previously added memory region at 0xfc000000 from target's memory map.