Copy Between Memory and a File

官方文档路径 Copy Between Memory and a File

导出内存为一个文件

1
2
dump [format] memory filename start_addr end_addr
dump [format] value filename expr

Dump the contents of memory from start_addr to end_addr, or the value of expr, to filename in the given format.

The format parameter may be any one of:

  • binary

    Raw binary form.

  • ihex

    Intel hex format.

  • srec

    Motorola S-record format.

  • tekhex

    Tektronix Hex format.

  • verilog

    Verilog Hex format.

将一个文件加载进内存

1
restore filename [binary] bias start end

Restore the contents of file filename into memory. The restore command can automatically recognize any known BFD file format, except for raw binary. To restore a raw binary file you must specify the optional keyword binary after the filename.

If bias is non-zero, its value will be added to the addresses contained in the file. Binary files always start at address zero, so they will be restored at address bias. Other bfd files have a built-in location; they will be restored at offset bias from that location.

If start and/or end are non-zero, then only data between file offset start and file offset end will be restored. These offsets are relative to the addresses in the file, before the bias argument is applied.

Usage

将 /dev/fb0 的文件 dump 出来

1
2
3
4
dump binary memory fb0.argb start_addr end_addr

需要知道虚拟地址(基于物理地址的测试未进行)

将裸数据加载进 fb0

1
restore fb0.argb binary start_addr

可以忽略 end_addr, 加载完后会显示加载到的地址范围