dbg_setup_access.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <title>Configure debug access</title>
  7. <title>CMSIS-Pack: Configure debug access</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <link href="cmsis.css" rel="stylesheet" type="text/css" />
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <script type="text/javascript" src="printComponentTabs.js"></script>
  13. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  14. <script type="text/javascript" src="resize.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <script type="text/javascript">
  17. $(document).ready(initResizable);
  18. $(window).load(resizeHeight);
  19. </script>
  20. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  21. <script type="text/javascript" src="search/search.js"></script>
  22. <script type="text/javascript">
  23. $(document).ready(function() { searchBox.OnSelectItem(0); });
  24. </script>
  25. </head>
  26. <body>
  27. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  28. <div id="titlearea">
  29. <table cellspacing="0" cellpadding="0">
  30. <tbody>
  31. <tr style="height: 46px;">
  32. <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
  33. <td style="padding-left: 0.5em;">
  34. <div id="projectname">CMSIS-Pack
  35. &#160;<span id="projectnumber">Version 1.6.3</span>
  36. </div>
  37. <div id="projectbrief">Delivery Mechanism for Software Packs</div>
  38. </td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. </div>
  43. <!-- end header part -->
  44. <div id="CMSISnav" class="tabs1">
  45. <ul class="tablist">
  46. <script type="text/javascript">
  47. <!--
  48. writeComponentTabs.call(this);
  49. //-->
  50. </script>
  51. </ul>
  52. </div>
  53. <!-- Generated by Doxygen 1.8.6 -->
  54. <script type="text/javascript">
  55. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  56. </script>
  57. <div id="navrow1" class="tabs">
  58. <ul class="tablist">
  59. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  60. <li class="current"><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
  61. <li>
  62. <div id="MSearchBox" class="MSearchBoxInactive">
  63. <span class="left">
  64. <img id="MSearchSelect" src="search/mag_sel.png"
  65. onmouseover="return searchBox.OnSearchSelectShow()"
  66. onmouseout="return searchBox.OnSearchSelectHide()"
  67. alt=""/>
  68. <input type="text" id="MSearchField" value="Search" accesskey="S"
  69. onfocus="searchBox.OnSearchFieldFocus(true)"
  70. onblur="searchBox.OnSearchFieldFocus(false)"
  71. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  72. </span><span class="right">
  73. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  74. </span>
  75. </div>
  76. </li>
  77. </ul>
  78. </div>
  79. </div><!-- top -->
  80. <div id="side-nav" class="ui-resizable side-nav-resizable">
  81. <div id="nav-tree">
  82. <div id="nav-tree-contents">
  83. <div id="nav-sync" class="sync"></div>
  84. </div>
  85. </div>
  86. <div id="splitbar" style="-moz-user-select:none;"
  87. class="ui-resizable-handle">
  88. </div>
  89. </div>
  90. <script type="text/javascript">
  91. $(document).ready(function(){initNavTree('dbg_setup_access.html','');});
  92. </script>
  93. <div id="doc-content">
  94. <!-- window showing the filter options -->
  95. <div id="MSearchSelectWindow"
  96. onmouseover="return searchBox.OnSearchSelectShow()"
  97. onmouseout="return searchBox.OnSearchSelectHide()"
  98. onkeydown="return searchBox.OnSearchSelectKey(event)">
  99. <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Pages</a></div>
  100. <!-- iframe showing the search results (closed by default) -->
  101. <div id="MSearchResultsWindow">
  102. <iframe src="javascript:void(0)" frameborder="0"
  103. name="MSearchResults" id="MSearchResults">
  104. </iframe>
  105. </div>
  106. <div class="header">
  107. <div class="headertitle">
  108. <div class="title">Configure debug access </div> </div>
  109. </div><!--header-->
  110. <div class="contents">
  111. <div class="textblock"><p>Professional IDE debuggers provide great flexibility and multiple options for configuring debug of modern microcontrollers. But for software developers it is often challenging to correctly configure debug settings for their target system. Using <a class="el" href="debug_description.html#das_elements">debug description elements</a> chip vendors can specify debug parameters applicable to a particular device and provide the default settings to be used by the debugger tool.</p>
  112. <p>This chapter explains how to use the debug description elements.</p>
  113. <h1><a class="anchor" id="dbg_debug"></a>
  114. Specify CPU debug connection</h1>
  115. <p>An important item that needs to be specified for an MCU is the debug connection to the CPU. For that <a class="el" href="pdsc_family_pg.html#element_debug">debug</a> element shall be used. This element is most commonly used in DFPs to specify the <a href="../../SVD/html/index.html"><b>system view description file (.svd)</b></a>. But it also contains useful attributes to define the debug connection to the processor: <b>__dp</b> , <b>__ap</b> and <b>Pname</b>.</p>
  116. <p>An example code below defines debug connection for a dual-core device with one debug port and 2 access ports: indexed as <code>0</code> for Cortex-M4 and <code>1</code> for Cortex-M0+.</p>
  117. <div class="fragment"><div class="line">&lt;devices&gt;</div>
  118. <div class="line"> &lt;family Dfamily=<span class="stringliteral">&quot;LPC54114&quot;</span> Dvendor=<span class="stringliteral">&quot;NXP:11&quot;</span>&gt; </div>
  119. <div class="line"> ...</div>
  120. <div class="line"> &lt;device Dname=<span class="stringliteral">&quot;LPC54114J256&quot;</span>&gt;</div>
  121. <div class="line"> &lt;processor Pname=<span class="stringliteral">&quot;CM0plus&quot;</span> Dcore=<span class="stringliteral">&quot;Cortex-M0+&quot;</span> Dfpu=<span class="stringliteral">&quot;NO_FPU&quot;</span> Dmpu=<span class="stringliteral">&quot;NO_MPU&quot;</span> Dendian=<span class="stringliteral">&quot;Little-endian&quot;</span> Dclock=<span class="stringliteral">&quot;100000000&quot;</span>/&gt;</div>
  122. <div class="line"> &lt;processor Pname=<span class="stringliteral">&quot;CM4&quot;</span> Dcore=<span class="stringliteral">&quot;Cortex-M4&quot;</span> Dfpu=<span class="stringliteral">&quot;SP_FPU&quot;</span> Dmpu=<span class="stringliteral">&quot;MPU&quot;</span> Dendian=<span class="stringliteral">&quot;Little-endian&quot;</span> Dclock=<span class="stringliteral">&quot;100000000&quot;</span>/&gt;</div>
  123. <div class="line"> ...</div>
  124. <div class="line"> &lt;debug svd=<span class="stringliteral">&quot;SVD/LPC54114_cm0plus.xml&quot;</span> Pname=<span class="stringliteral">&quot;CM0plus&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;1&quot;</span>/&gt;</div>
  125. <div class="line"> &lt;debug svd=<span class="stringliteral">&quot;SVD/LPC54114_cm4.xml&quot;</span> Pname=<span class="stringliteral">&quot;CM4&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
  126. <div class="line"> ...</div>
  127. <div class="line"> &lt;/device&gt;</div>
  128. <div class="line"> ...</div>
  129. <div class="line"> &lt;/family&gt;</div>
  130. <div class="line">&lt;/devices&gt;</div>
  131. </div><!-- fragment --><p>The same <b>Pname</b> identifier shall be used in <a class="el" href="pdsc_family_pg.html#element_debug">debug</a> element as defined in the corresponding <a class="el" href="pdsc_family_pg.html#element_processor">processor</a> element ('CM0plus' or 'CM4' in this example).</p>
  132. <p>The numeric index values shall be typically specified for <b>__dp</b> attribute when multiple debug ports are available in the system and defined via <a class="el" href="pdsc_family_pg.html#element_debugport">debugport</a> element. See <a class="el" href="dbg_setup_access.html#dbg_debug_port">Specify debug port</a> for details about configuring debug ports.</p>
  133. <p>For the <b>__ap</b> attribute the numeric index values shall be assigned based on the debug system implementation.</p>
  134. <p>There's no need to specify all attributes in a single line at once, it can also be split over multiple assignments if it helps to better structure the sequences code. However the same <b>Pname</b> identifier shall be used. So the code below specifies the same debug connection for M4 processor as in the example above:</p>
  135. <div class="fragment"><div class="line">&lt;debug Pname=<span class="stringliteral">&quot;CM4&quot;</span> svd=<span class="stringliteral">&quot;SVD/LPC54114_cm4.xml&quot;</span>/&gt;</div>
  136. <div class="line">...</div>
  137. <div class="line">&lt;debug Pname=<span class="stringliteral">&quot;CM4&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
  138. <div class="line">...</div>
  139. </div><!-- fragment --><p>The attribute <a class="el" href="pdsc_family_pg.html#defaultResetSequence">defaultResetSequence</a> specifies the debug sequence that will be used by default to reset the device.</p>
  140. <p>The debug IDE may also allow users to specify the reset type in the project options thus overwriting this default configuration. In multi-core systems <b>Pname</b> shall be used to ensure that the default reset sequence is set for a correct core.</p>
  141. <div class="fragment"><div class="line">&lt;debug Pname=<span class="stringliteral">&quot;M4&quot;</span> defaultResetSequence=<span class="stringliteral">&quot;ResetProcessor&quot;</span>/&gt;</div>
  142. </div><!-- fragment --><h1><a class="anchor" id="dbg_debug_port"></a>
  143. Specify debug port</h1>
  144. <p>A microcontroller system can have one or more CoreSight debug ports with one or more supported debug protocols (for example JTAG and SWD). <a class="el" href="pdsc_family_pg.html#element_debugport">debugport</a> element can be used to describe the debug ports capabilities.</p>
  145. <p>For example if only Arm Serial Wire Debug (SWD) interface is supported, then <b>debugport</b> shall be defined only with <a class="el" href="pdsc_family_pg.html#element_dp_swd">swd</a> child element and no <a class="el" href="pdsc_family_pg.html#element_dp_jtag">jtag</a> elements. The <b>swd</b> element is really simple and can only take an <b>idcode</b> attribute that needs to be explicitly provided when you want to override the value of the SWD debug port's DPIDR register that will be read from the device.</p>
  146. <div class="fragment"><div class="line">...</div>
  147. <div class="line"> &lt;debugport __dp=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
  148. <div class="line"> &lt;swd/&gt;</div>
  149. <div class="line"> &lt;/debugport&gt;</div>
  150. <div class="line">...</div>
  151. </div><!-- fragment --><p>Vice versa is true as well, if only JTAG is supported then SWD shall not be listed in the <b>debugport</b> element.</p>
  152. <p>The numeric value assinged to the <b>__dp</b> identifies the debug port and is for the user to choose. When describing JTAG chains it is recommended to use the <b>tapindex</b> as the <b>__dp</b> value to avoid confusion.</p>
  153. <p>Debuggers can normally autodetect JTAG chains. But with some devices there is still a need to fully specify the JTAG chain to avoid potential detection issues by the debugger. Below is an example for the NXP IMX6 Solo X:</p>
  154. <div class="fragment"><div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;0&quot;</span>&gt;</div>
  155. <div class="line"> &lt;jtag tapindex=<span class="stringliteral">&quot;0&quot;</span> idcode=<span class="stringliteral">&quot;0x4BA00477&quot;</span> irlen=<span class="stringliteral">&quot;4&quot;</span>/&gt;</div>
  156. <div class="line">&lt;/debugport&gt;</div>
  157. <div class="line"> </div>
  158. <div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;1&quot;</span>&gt;</div>
  159. <div class="line"> &lt;jtag tapindex=<span class="stringliteral">&quot;1&quot;</span> idcode=<span class="stringliteral">&quot;0x4BA00477&quot;</span> irlen=<span class="stringliteral">&quot;4&quot;</span>/&gt;</div>
  160. <div class="line">&lt;/debugport&gt;</div>
  161. <div class="line"> </div>
  162. <div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;2&quot;</span>&gt;</div>
  163. <div class="line"> &lt;jtag tapindex=<span class="stringliteral">&quot;2&quot;</span> idcode=<span class="stringliteral">&quot;0x00000000&quot;</span> irlen=<span class="stringliteral">&quot;4&quot;</span>/&gt;</div>
  164. <div class="line">&lt;/debugport&gt;</div>
  165. <div class="line"> </div>
  166. <div class="line">&lt;debugport __dp=<span class="stringliteral">&quot;3&quot;</span>&gt;</div>
  167. <div class="line"> &lt;jtag tapindex=<span class="stringliteral">&quot;3&quot;</span> idcode=<span class="stringliteral">&quot;0x0891C01D&quot;</span> irlen=<span class="stringliteral">&quot;5&quot;</span>/&gt;</div>
  168. <div class="line">&lt;/debugport&gt;</div>
  169. <div class="line"> </div>
  170. <div class="line">&lt;debug Pname=<span class="stringliteral">&quot;Cortex-A9&quot;</span> __dp=<span class="stringliteral">&quot;1&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
  171. <div class="line">&lt;debug Pname=<span class="stringliteral">&quot;Cortex-M4&quot;</span> __dp=<span class="stringliteral">&quot;0&quot;</span> __ap=<span class="stringliteral">&quot;0&quot;</span>/&gt;</div>
  172. </div><!-- fragment --><p>Even though only two debug ports are used to access the processor cores, the other debug ports available in the system are specified as well. In this case it is needed to provide debugger with correct <b>irlen</b> values thus allowing it to correctly scan the JTAG chain and access the processors.</p>
  173. <p>The <b>tapindex</b> uniquely identifies the JTAG interface and typically its value is also used as the identifier for the debug port (<b>__dp</b>) index. Same as with the SWD the explicit specification of the <b>idcode</b> attribute is really necessary only when it needs to overwrite the IDCODe value read from the device. And <b>irlen</b> attribute may require explicit specification here if there're problems correctly obtaining its value from the device.</p>
  174. <h1><a class="anchor" id="dbg_debug_settings"></a>
  175. Default debugger configuration</h1>
  176. <p>To simplify the debugger configuration in an IDE the <a class="el" href="pdsc_family_pg.html#element_debugconfig">debugconfig</a> element can be used to specify the default working debugger configuration that should be used as a starting point until the user explicitely makes project-specific changes.</p>
  177. <p>For example the code below specifies SWD interface as default one with debug clock 5MHz. The debug port supports switching between SWD and JTAG debug protocols.</p>
  178. <div class="fragment"><div class="line">&lt;devices&gt;</div>
  179. <div class="line"> &lt;family Dfamily=<span class="stringliteral">&quot;LPC54000 Series&quot;</span> Dvendor=<span class="stringliteral">&quot;NXP:11&quot;</span>&gt;</div>
  180. <div class="line"> &lt;debugconfig <span class="keywordflow">default</span>=<span class="stringliteral">&quot;swd&quot;</span> clock=<span class="stringliteral">&quot;5000000&quot;</span> swj=<span class="stringliteral">&quot;true&quot;</span>/&gt;</div>
  181. <div class="line"> ...</div>
  182. <div class="line"> &lt;/family&gt;</div>
  183. <div class="line">&lt;/devices&gt;</div>
  184. </div><!-- fragment --><p>Using <a class="el" href="pdsc_family_pg.html#element_debug">debug</a> it is also possible to specify the default reset type to be used. See <a class="el" href="dbg_setup_access.html#dbg_debug">Specify CPU debug connection</a> for details. </p>
  185. </div></div><!-- contents -->
  186. </div><!-- doc-content -->
  187. <!-- start footer part -->
  188. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  189. <ul>
  190. <li class="navelem"><a class="el" href="coresight_setup.html">Debug Setup with CMSIS-Pack</a></li><li class="navelem"><a class="el" href="dbg_setup_tutorial.html">Debug Setup Tutorial</a></li>
  191. <li class="footer">Generated on Thu Apr 9 2020 15:49:54 for CMSIS-Pack Version 1.6.3 by Arm Ltd. All rights reserved.
  192. <!--
  193. <a href="http://www.doxygen.org/index.html">
  194. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6
  195. -->
  196. </li>
  197. </ul>
  198. </div>
  199. </body>
  200. </html>