flash/nor/tcl: Add 'read_memory' command

This command allows to read non-memory mapped flash content directly
via Tcl script. The API is the same as for the 'read_memory' command
for targets.

Change-Id: I4a8d0d7ea2f778ac8f1501227b60b964c881cb84
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8634
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marc Schink
2024-11-23 14:43:51 +00:00
committed by Antonio Borneo
parent 2065bac380
commit 6a40fe64d6
2 changed files with 143 additions and 0 deletions

View File

@@ -5870,6 +5870,24 @@ The flash bank to use is inferred from the @var{address} of
each block, and the specified length must stay within that bank.
@end deffn
@deffn {Command} {flash read_memory} address width count
This function provides an efficient way to read flash memory from a Tcl script.
A Tcl list containing the requested memory elements is returned by this function.
@itemize
@item @var{address} ... flash memory address
@item @var{width} ... memory access bit size, can be 8, 16, 32 or 64
@item @var{count} ... number of elements to read
@end itemize
For example, the following command reads two 32 bit words from the flash
memory at address 0x08000000:
@example
flash read_memory 0x08000000 32 2
@end example
@end deffn
@deffn {Command} {flash write_bank} num filename [offset]
Write the binary @file{filename} to flash bank @var{num},
starting at @var{offset} bytes from the beginning of the bank. If @var{offset}