Memory Read Commands#

The readmem command reads data from a device and can either store it to file or print it in human-readable format. The location and length to be read from the device is defined by the --range and --region options. You can combine one or more ranges and regions to read and combine several different areas in flash to one file.

Note: Like flash, the commands in this section all require a working debug connection for communicating with the device. You would normally always use one of the J-Link connection options when running readmem, but this is left out of the examples to keep them short and concise.

The --range option supports two different range formats:

  • The first is <startaddress>:<endaddress>, for example, --range 0x4000:0x6000. The range is non-inclusive, meaning that all bytes from 0x4000 up to and including 0x5FFF are read out.

  • The second is <startaddress>:+<length>, which takes an address to start reading from, and a number of bytes to read. For example, the equivalent command line input to the previous example is --range 0x4000:+0x2000.

The --region option takes a named flash region with an @ prefix. Valid regions for use with the --region option are listed below.

Series 0 EFM32, EZR32, EFR32: @mainflash, @userdata, @lockbits, @devinfo

Series 1 EFM32, EFR32: @mainflash, @userdata, @lockbits, @devinfo, @bootloader

Series 2 EFM32, EFR32: @mainflash, @userdata, @devinfo

EM3xx: @mfb, @cib, @fib

Print Flash Contents#

Specifies the range of memory to read from flash and prints data.

Command Line Syntax

$ commander readmem --range <startaddress>:<endaddress>

OR

Command Line Syntax

$ commander readmem --range <startaddress>:+<length>

Command Line Input Example

$ commander readmem --range 0x100:+128

Reads 128 bytes from flash starting at address 0x100 and prints it to standard out.

Command Line Output Example

Reading 128 bytes from 0x00000100...
{address:  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F}
00000100: 12 F0 40 72 11 00 DF F8 C0 24 90 42 07 D2 DF F8
00000110: BC 24 90 42 03 D3 5F F0 80 72 11 00 01 E0 00 22
00000120: 11 00 DF F8 84 26 12 68 32 F0 40 72 0A 43 DF F8
00000130: 78 36 1A 60 70 47 80 B5 00 F0 90 FC FF F7 DD FF
00000140: 01 BD DF F8 70 16 09 68 08 00 70 47 38 B5 DF F8
00000150: 4C 06 00 F0 9F F9 05 00 ED B2 28 00 07 28 05 D0
00000160: 08 28 07 D1 00 F0 7C FC 04 00 0B E0 FF F7 E9 FF
00000170: 04 00 07 E0 40 F2 25 11 DF F8 3C 06 00 F0 B0 FC
DONE

Dump Flash Contents to File#

Reads the contents of the specified user page and stores it in the specified filename. File format will be auto-detected based on file extension (.bin, .hex, or .s37). See File Format Overview for more information on file formats.

Command Line Syntax

$ commander readmem --region <@region> --outfile <filename>

Command Line Input Example

$ commander readmem --region @userdata --outfile userpage.hex

Reads the contents of the region named userdata and stores it in an output file named userpage.hex.

Command Line Output Example

Reading 2048 bytes from 0x0fe00000...
Writing to userpage.hex...
DONE