Simon Glass | 671c454 | 2021-02-06 09:57:29 -0700 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
Heinrich Schuchardt | 60971e6 | 2024-01-14 14:53:13 +0100 | [diff] [blame] | 3 | .. index:: |
| 4 | single: md (command) |
| 5 | |
Simon Glass | 671c454 | 2021-02-06 09:57:29 -0700 | [diff] [blame] | 6 | md command |
| 7 | ========== |
| 8 | |
Heinrich Schuchardt | 98b5ea1 | 2024-03-16 11:09:36 +0100 | [diff] [blame] | 9 | Synopsis |
| 10 | -------- |
Simon Glass | 671c454 | 2021-02-06 09:57:29 -0700 | [diff] [blame] | 11 | |
| 12 | :: |
| 13 | |
| 14 | md <address>[<data_size>] [<length>] |
| 15 | |
| 16 | Description |
| 17 | ----------- |
| 18 | |
| 19 | The md command is used to dump the contents of memory. It uses a standard |
| 20 | format that includes the address, hex data and ASCII display. It supports |
| 21 | various data sizes and uses the endianness of the target. |
| 22 | |
| 23 | The specified data_size and length become the defaults for future memory |
| 24 | commands commands. |
| 25 | |
| 26 | address |
| 27 | start address to display |
| 28 | |
| 29 | data_size |
| 30 | size of each value to display (defaults to .l): |
| 31 | |
| 32 | ========= =================== |
| 33 | data_size Output size |
| 34 | ========= =================== |
| 35 | .b byte |
| 36 | .w word (16 bits) |
| 37 | .l long (32 bits) |
| 38 | .q quadword (64 bits) |
| 39 | ========= =================== |
| 40 | |
| 41 | length |
| 42 | number of values to dump. Defaults to 40 (0d64). Note that this is not |
| 43 | the same as the number of bytes, unless .b is used. |
| 44 | |
Simon Glass | 008ae72 | 2021-02-06 09:57:30 -0700 | [diff] [blame] | 45 | Note that the format of 'md.b' can be emulated from linux with:: |
| 46 | |
| 47 | # This works but requires using sed to get the extra spaces |
| 48 | # <addr> is the address, <f> is the filename |
| 49 | xxd -o <addr> -g1 <f> |sed 's/ / /' >bad |
| 50 | |
| 51 | # This uses a single tool but the offset always starts at 0 |
| 52 | # <f> is the filename |
| 53 | hexdump -v -e '"%08.8_ax: " 16/1 "%02x " " "' -e '16/1 "%_p" "\n" ' <f> |
| 54 | |
Simon Glass | 671c454 | 2021-02-06 09:57:29 -0700 | [diff] [blame] | 55 | |
| 56 | Example |
| 57 | ------- |
| 58 | |
| 59 | :: |
| 60 | |
| 61 | => md 10000 |
| 62 | 00010000: 00010000 00000000 f0f30f00 00005596 .............U.. |
| 63 | 00010010: 10011010 00000000 10011010 00000000 ................ |
| 64 | 00010020: 10011050 00000000 b96d4cd8 00007fff P........Lm..... |
| 65 | 00010030: 00000000 00000000 f0f30f18 00005596 .............U.. |
| 66 | 00010040: 10011040 00000000 10011040 00000000 @.......@....... |
| 67 | 00010050: b96d4cd8 00007fff 10011020 00000000 .Lm..... ....... |
| 68 | 00010060: 00000003 000000c3 00000000 00000000 ................ |
| 69 | 00010070: 00000000 00000000 f0e892f3 00005596 .............U.. |
| 70 | 00010080: 00000000 000000a1 00000000 00000000 ................ |
| 71 | 00010090: 00000000 00000000 f0e38aa6 00005596 .............U.. |
| 72 | 000100a0: 00000000 000000a6 00000022 00000000 ........"....... |
| 73 | 000100b0: 00000001 00000000 f0e38aa1 00005596 .............U.. |
| 74 | 000100c0: 00000000 000000be 00000000 00000000 ................ |
| 75 | 000100d0: 00000000 00000000 00000000 00000000 ................ |
| 76 | 000100e0: 00000000 00000000 00000000 00000000 ................ |
| 77 | 000100f0: 00000000 00000000 00000000 00000000 ................ |
| 78 | => md.b 10000 |
| 79 | 00010000: 00 00 01 00 00 00 00 00 00 0f f3 f0 96 55 00 00 .............U.. |
| 80 | 00010010: 10 10 01 10 00 00 00 00 10 10 01 10 00 00 00 00 ................ |
| 81 | 00010020: 50 10 01 10 00 00 00 00 d8 4c 6d b9 ff 7f 00 00 P........Lm..... |
| 82 | 00010030: 00 00 00 00 00 00 00 00 18 0f f3 f0 96 55 00 00 .............U.. |
| 83 | => md.b 10000 10 |
| 84 | 00010000: 00 00 01 00 00 00 00 00 00 0f f3 f0 96 55 00 00 .............U.. |
| 85 | => |
| 86 | 00010010: 10 10 01 10 00 00 00 00 10 10 01 10 00 00 00 00 ................ |
| 87 | => |
| 88 | 00010020: 50 10 01 10 00 00 00 00 d8 4c 6d b9 ff 7f 00 00 P........Lm..... |
| 89 | => |
| 90 | => md.q 10000 |
| 91 | 00010000: 0000000000010000 00005596f0f30f00 .............U.. |
| 92 | 00010010: 0000000010011010 0000000010011010 ................ |
| 93 | 00010020: 0000000010011050 00007fffb96d4cd8 P........Lm..... |
| 94 | 00010030: 0000000000000000 00005596f0f30f18 .............U.. |
| 95 | 00010040: 0000000010011040 0000000010011040 @.......@....... |
| 96 | 00010050: 00007fffb96d4cd8 0000000010011020 .Lm..... ....... |
| 97 | 00010060: 000000c300000003 0000000000000000 ................ |
| 98 | 00010070: 0000000000000000 00005596f0e892f3 .............U.. |
| 99 | |
| 100 | The empty commands cause a 'repeat', so that md shows the next available data |
| 101 | in the same format as before. |
| 102 | |
| 103 | |
| 104 | Return value |
| 105 | ------------ |
| 106 | |
| 107 | The return value $? is always 0 (true). |