You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Memory-Map-Format.html 7.1KB

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Memory Map Format (Debugging with GDB)</title>
  17. <meta name="description" content="Memory Map Format (Debugging with GDB)">
  18. <meta name="keywords" content="Memory Map Format (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Remote-Protocol.html#Remote-Protocol" rel="up" title="Remote Protocol">
  26. <link href="Thread-List-Format.html#Thread-List-Format" rel="next" title="Thread List Format">
  27. <link href="Library-List-Format-for-SVR4-Targets.html#Library-List-Format-for-SVR4-Targets" rel="prev" title="Library List Format for SVR4 Targets">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Memory-Map-Format"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Thread-List-Format.html#Thread-List-Format" accesskey="n" rel="next">Thread List Format</a>, Previous: <a href="Library-List-Format-for-SVR4-Targets.html#Library-List-Format-for-SVR4-Targets" accesskey="p" rel="prev">Library List Format for SVR4 Targets</a>, Up: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="u" rel="up">Remote Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Memory-Map-Format-1"></a>
  64. <h3 class="section">E.16 Memory Map Format</h3>
  65. <a name="index-memory-map-format"></a>
  66. <p>To be able to write into flash memory, <small>GDB</small> needs to obtain a
  67. memory map from the target. This section describes the format of the
  68. memory map.
  69. </p>
  70. <p>The memory map is obtained using the &lsquo;<samp>qXfer:memory-map:read</samp>&rsquo;
  71. (see <a href="General-Query-Packets.html#qXfer-memory-map-read">qXfer memory map read</a>) packet and is an XML document that
  72. lists memory regions.
  73. </p>
  74. <p><small>GDB</small> must be linked with the Expat library to support XML
  75. memory maps. See <a href="Requirements.html#Expat">Expat</a>.
  76. </p>
  77. <p>The top-level structure of the document is shown below:
  78. </p>
  79. <div class="smallexample">
  80. <pre class="smallexample">&lt;?xml version=&quot;1.0&quot;?&gt;
  81. &lt;!DOCTYPE memory-map
  82. PUBLIC &quot;+//IDN gnu.org//DTD GDB Memory Map V1.0//EN&quot;
  83. &quot;http://sourceware.org/gdb/gdb-memory-map.dtd&quot;&gt;
  84. &lt;memory-map&gt;
  85. region...
  86. &lt;/memory-map&gt;
  87. </pre></div>
  88. <p>Each region can be either:
  89. </p>
  90. <ul>
  91. <li> A region of RAM starting at <var>addr</var> and extending for <var>length</var>
  92. bytes from there:
  93. <div class="smallexample">
  94. <pre class="smallexample">&lt;memory type=&quot;ram&quot; start=&quot;<var>addr</var>&quot; length=&quot;<var>length</var>&quot;/&gt;
  95. </pre></div>
  96. </li><li> A region of read-only memory:
  97. <div class="smallexample">
  98. <pre class="smallexample">&lt;memory type=&quot;rom&quot; start=&quot;<var>addr</var>&quot; length=&quot;<var>length</var>&quot;/&gt;
  99. </pre></div>
  100. </li><li> A region of flash memory, with erasure blocks <var>blocksize</var>
  101. bytes in length:
  102. <div class="smallexample">
  103. <pre class="smallexample">&lt;memory type=&quot;flash&quot; start=&quot;<var>addr</var>&quot; length=&quot;<var>length</var>&quot;&gt;
  104. &lt;property name=&quot;blocksize&quot;&gt;<var>blocksize</var>&lt;/property&gt;
  105. &lt;/memory&gt;
  106. </pre></div>
  107. </li></ul>
  108. <p>Regions must not overlap. <small>GDB</small> assumes that areas of memory not covered
  109. by the memory map are RAM, and uses the ordinary &lsquo;<samp>M</samp>&rsquo; and &lsquo;<samp>X</samp>&rsquo;
  110. packets to write to addresses in such ranges.
  111. </p>
  112. <p>The formal DTD for memory map format is given below:
  113. </p>
  114. <div class="smallexample">
  115. <pre class="smallexample">&lt;!-- ................................................... --&gt;
  116. &lt;!-- Memory Map XML DTD ................................ --&gt;
  117. &lt;!-- File: memory-map.dtd .............................. --&gt;
  118. &lt;!-- .................................... .............. --&gt;
  119. &lt;!-- memory-map.dtd --&gt;
  120. &lt;!-- memory-map: Root element with versioning --&gt;
  121. &lt;!ELEMENT memory-map (memory)*&gt;
  122. &lt;!ATTLIST memory-map version CDATA #FIXED &quot;1.0.0&quot;&gt;
  123. &lt;!ELEMENT memory (property)*&gt;
  124. &lt;!-- memory: Specifies a memory region,
  125. and its type, or device. --&gt;
  126. &lt;!ATTLIST memory type (ram|rom|flash) #REQUIRED
  127. start CDATA #REQUIRED
  128. length CDATA #REQUIRED&gt;
  129. &lt;!-- property: Generic attribute tag --&gt;
  130. &lt;!ELEMENT property (#PCDATA | property)*&gt;
  131. &lt;!ATTLIST property name (blocksize) #REQUIRED&gt;
  132. </pre></div>
  133. <hr>
  134. <div class="header">
  135. <p>
  136. Next: <a href="Thread-List-Format.html#Thread-List-Format" accesskey="n" rel="next">Thread List Format</a>, Previous: <a href="Library-List-Format-for-SVR4-Targets.html#Library-List-Format-for-SVR4-Targets" accesskey="p" rel="prev">Library List Format for SVR4 Targets</a>, Up: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="u" rel="up">Remote Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  137. </div>
  138. </body>
  139. </html>