OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_EFMG890F128_IAR/] [CMSIS/] [CMSIS debug support.htm] - Blame information for rev 620

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 597 jeremybenn
<html>
2
 
3
<head>
4
<title>CMSIS Debug Support</title>
5
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
6
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
7
<meta name="ProgId" content="FrontPage.Editor.Document">
8
<style>
9
<!--
10
/*-----------------------------------------------------------
11
Keil Software CHM Style Sheet
12
-----------------------------------------------------------*/
13
body         { color: #000000; background-color: #FFFFFF; font-size: 75%; font-family:
14
               Verdana, Arial, 'Sans Serif' }
15
a:link       { color: #0000FF; text-decoration: underline }
16
a:visited    { color: #0000FF; text-decoration: underline }
17
a:active     { color: #FF0000; text-decoration: underline }
18
a:hover      { color: #FF0000; text-decoration: underline }
19
h1           { font-family: Verdana; font-size: 18pt; color: #000080; font-weight: bold;
20
               text-align: Center; margin-right: 3 }
21
h2           { font-family: Verdana; font-size: 14pt; color: #000080; font-weight: bold;
22
               background-color: #CCCCCC; margin-top: 24; margin-bottom: 3;
23
               padding: 6 }
24
h3           { font-family: Verdana; font-size: 10pt; font-weight: bold; background-color:
25
               #CCCCCC; margin-top: 24; margin-bottom: 3; padding: 6 }
26
pre          { font-family: Courier New; font-size: 10pt; background-color: #CCFFCC;
27
               margin-left: 24; margin-right: 24 }
28
ul           { list-style-type: square; margin-top: 6pt; margin-bottom: 0 }
29
ol           { margin-top: 6pt; margin-bottom: 0 }
30
li           { clear: both; margin-bottom: 6pt }
31
table        { font-size: 100%; border-width: 0; padding: 0 }
32
th           { color: #FFFFFF; background-color: #000080; text-align: left; vertical-align:
33
               bottom; padding-right: 6pt }
34
tr           { text-align: left; vertical-align: top }
35
td           { text-align: left; vertical-align: top; padding-right: 6pt }
36
.ToolT       { font-size: 8pt; color: #808080 }
37
.TinyT       { font-size: 8pt; text-align: Center }
38
code         { color: #000000; background-color: #E0E0E0; font-family: 'Courier New', Courier;
39
               line-height: 120%; font-style: normal }
40
/*-----------------------------------------------------------
41
Notes
42
-----------------------------------------------------------*/
43
p.note       { font-weight: bold; clear: both; margin-bottom: 3pt; padding-top: 6pt }
44
/*-----------------------------------------------------------
45
Expanding/Contracting Divisions
46
-----------------------------------------------------------*/
47
#expand      { text-decoration: none; margin-bottom: 3pt }
48
img.expand   { border-style: none; border-width: medium }
49
div.expand   { display: none; margin-left: 9pt; margin-top: 0 }
50
/*-----------------------------------------------------------
51
Where List Tags
52
-----------------------------------------------------------*/
53
p.wh         { font-weight: bold; clear: both; margin-top: 6pt; margin-bottom: 3pt }
54
table.wh     { width: 100% }
55
td.whItem    { white-space: nowrap; font-style: italic; padding-right: 6pt; padding-bottom:
56
               6pt }
57
td.whDesc    { padding-bottom: 6pt }
58
/*-----------------------------------------------------------
59
Keil Table Tags
60
-----------------------------------------------------------*/
61
table.kt     { border: 1pt solid #000000 }
62
th.kt        { white-space: nowrap; border-bottom: 1pt solid #000000; padding-left: 6pt;
63
               padding-right: 6pt; padding-top: 4pt; padding-bottom: 4pt }
64
tr.kt        {  }
65
td.kt        { color: #000000; background-color: #E0E0E0; border-top: 1pt solid #A0A0A0;
66
               padding-left: 6pt; padding-right: 6pt; padding-top: 2pt;
67
               padding-bottom: 2pt }
68
/*-----------------------------------------------------------
69
-----------------------------------------------------------*/
70
-->
71
 
72
</style>
73
</head>
74
 
75
<body>
76
 
77
<h1>CMSIS Debug Support</h1>
78
 
79
<hr>
80
 
81
<h2>Cortex-M3 ITM Debug Access</h2>
82
<p>
83
  The Cortex-M3 incorporates the Instrumented Trace Macrocell (ITM) that provides together with
84
  the Serial Viewer Output trace capabilities for the microcontroller system. The ITM has
85
  32 communication channels which are able to transmit 32 / 16 / 8 bit values; two ITM
86
  communication channels are used by CMSIS to output the following information:
87
</p>
88
<ul>
89
        <li>ITM Channel 0: used for printf-style output via the debug interface.</li>
90
        <li>ITM Channel 31: is reserved for RTOS kernel awareness debugging.</li>
91
</ul>
92
 
93
<h2>Debug IN / OUT functions</h2>
94
<p>CMSIS provides following debug functions:</p>
95
<ul>
96
        <li>ITM_SendChar (uses ITM channel 0)</li>
97
        <li>ITM_ReceiveChar (uses global variable)</li>
98
        <li>ITM_CheckChar (uses global variable)</li>
99
</ul>
100
 
101
<h3>ITM_SendChar</h3>
102
<p>
103
  <strong>ITM_SendChar</strong> is used to transmit a character over ITM channel 0 from
104
  the microcontroller system to the debug system. <br>
105
  Only a 8 bit value is transmitted.
106
</p>
107
<pre>
108
static __INLINE uint32_t ITM_SendChar (uint32_t ch)
109
{
110
  /* check if debugger connected and ITM channel enabled for tracing */
111
  if ((CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA)  &amp;&amp;
112
      (ITM-&gt;TCR & ITM_TCR_ITMENA)                  &amp;&amp;
113
      (ITM-&gt;TER & (1UL &lt;&lt; 0))  )
114
  {
115
    while (ITM-&gt;PORT[0].u32 == 0);
116
    ITM-&gt;PORT[0].u8 = (uint8_t)ch;
117
  }
118
  return (ch);
119
}</pre>
120
 
121
<h3>ITM_ReceiveChar</h3>
122
<p>
123
  ITM communication channel is only capable for OUT direction. For IN direction
124
  a globel variable is used. A simple mechansim detects if a character is received.
125
  The project to test need to be build with debug information.
126
</p>
127
 
128
<p>
129
  The globale variable <strong>ITM_RxBuffer</strong> is used to transmit a 8 bit value from debug system
130
  to microcontroller system. <strong>ITM_RxBuffer</strong> is 32 bit wide to enshure a proper handshake.
131
</p>
132
<pre>
133
extern volatile int ITM_RxBuffer;                    /* variable to receive characters                             */
134
</pre>
135
<p>
136
  A dedicated bit pattern is used to determin if <strong>ITM_RxBuffer</strong> is empty
137
  or contains a valid value.
138
</p>
139
<pre>
140
#define             ITM_RXBUFFER_EMPTY    0x5AA55AA5 /* value identifying ITM_RxBuffer is ready for next character */
141
</pre>
142
<p>
143
  <strong>ITM_ReceiveChar</strong> is used to receive a 8 bit value from the debug system. The function is nonblocking.
144
  It returns the received character or '-1' if no character was available.
145
</p>
146
<pre>
147
static __INLINE int ITM_ReceiveChar (void) {
148
  int ch = -1;                               /* no character available */
149
 
150
  if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) {
151
    ch = ITM_RxBuffer;
152
    ITM_RxBuffer = ITM_RXBUFFER_EMPTY;       /* ready for next character */
153
  }
154
 
155
  return (ch);
156
}
157
</pre>
158
 
159
<h3>ITM_CheckChar</h3>
160
<p>
161
  <strong>ITM_CheckChar</strong> is used to check if a character is received.
162
</p>
163
<pre>
164
static __INLINE int ITM_CheckChar (void) {
165
 
166
  if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) {
167
    return (0);                                 /* no character available */
168
  } else {
169
    return (1);                                 /*    character available */
170
  }
171
}</pre>
172
 
173
 
174
<h2>ITM Debug Support in uVision</h2>
175
<p>
176
  uVision uses in a debug session the <strong>Debug (printf) Viewer</strong> window to
177
  display the debug data.
178
</p>
179
<p>Direction microcontroller system -&gt; uVision:</p>
180
<ul>
181
  <li>
182
    Characters received via ITM communication channel 0 are written in a printf style
183
    to <strong>Debug (printf) Viewer</strong> window.
184
  </li>
185
</ul>
186
 
187
<p>Direction uVision -&gt; microcontroller system:</p>
188
<ul>
189
  <li>Check if <strong>ITM_RxBuffer</strong> variable is available (only performed once).</li>
190
  <li>Read character from <strong>Debug (printf) Viewer</strong> window.</li>
191
  <li>If <strong>ITM_RxBuffer</strong> empty write character to <strong>ITM_RxBuffer</strong>.</li>
192
</ul>
193
 
194
<p class="Note">Note</p>
195
<ul>
196
  <li><p>Current solution does not use a buffer machanism for trasmitting the characters.</p>
197
  </li>
198
</ul>
199
 
200
<h2>RTX Kernel awareness in uVision</h2>
201
<p>
202
  uVision / RTX are using a simple and efficient solution for RTX Kernel awareness.
203
  No format overhead is necessary.<br>
204
  uVsion debugger decodes the RTX events via the 32 / 16 / 8 bit ITM write access
205
  to ITM communication channel 31.
206
</p>
207
 
208
<p>Following RTX events are traced:</p>
209
<ul>
210
  <li>Task Create / Delete event
211
    <ol>
212
      <li>32 bit access. Task start address is transmitted</li>
213
      <li>16 bit access. Task ID and Create/Delete flag are transmitted<br>
214
          High byte holds Create/Delete flag, Low byte holds TASK ID.
215
      </li>
216
    </ol>
217
  </li>
218
  <li>Task switch event
219
    <ol>
220
      <li>8 bit access. Task ID of current task is transmitted</li>
221
    </ol>
222
  </li>
223
</ul>
224
 
225
<p class="Note">Note</p>
226
<ul>
227
  <li><p>Other RTOS information could be retrieved via memory read access in a polling mode manner.</p>
228
  </li>
229
</ul>
230
 
231
 
232
<p class="MsoNormal"><span lang="EN-GB">&nbsp;</span></p>
233
 
234
<hr>
235
 
236
<p class="TinyT">Copyright © KEIL - An ARM Company.<br>
237
All rights reserved.<br>
238
Visit our web site at <a href="http://www.keil.com">www.keil.com</a>.
239
</p>
240
 
241
</body>
242
 
243
</html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.