LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
os_dbg.c
Go to the documentation of this file.
1 /*
2 ************************************************************************************************************************
3 * uC/OS-III
4 * The Real-Time Kernel
5 *
6 * (c) Copyright 2009-2012; Micrium, Inc.; Weston, FL
7 * All rights reserved. Protected by international copyright laws.
8 *
9 * DEBUGGER CONSTANTS
10 *
11 * File : OS_DBG.C
12 * By : JJL
13 * Version : V3.03.00
14 *
15 * LICENSING TERMS:
16 * ---------------
17 * uC/OS-III is provided in source form for FREE short-term evaluation, for educational use or
18 * for peaceful research. If you plan or intend to use uC/OS-III in a commercial application/
19 * product then, you need to contact Micrium to properly license uC/OS-III for its use in your
20 * application/product. We provide ALL the source code for your convenience and to help you
21 * experience uC/OS-III. The fact that the source is provided does NOT mean that you can use
22 * it commercially without paying a licensing fee.
23 *
24 * Knowledge of the source code may NOT be used to develop a similar product.
25 *
26 * Please help us continue to provide the embedded community with the finest software available.
27 * Your honesty is greatly appreciated.
28 *
29 * You can contact us at www.micrium.com, or by phone at +1 (954) 217-2036.
30 ************************************************************************************************************************
31 */
32 
33 #define MICRIUM_SOURCE
34 #include <os.h>
35 
36 #ifdef VSC_INCLUDE_SOURCE_FILE_NAMES
37 const CPU_CHAR *os_dbg__c = "$Id: $";
38 #endif
39 
40 CPU_INT16U const OSDbg_DbgEn = OS_CFG_DBG_EN; /* Debug constants are defined below */
41 
42 #if OS_CFG_DBG_EN > 0u
43 
44 /*
45 ************************************************************************************************************************
46 * DEBUG DATA
47 ************************************************************************************************************************
48 */
49 
50 CPU_INT08U const OSDbg_ArgChkEn = OS_CFG_ARG_CHK_EN;
51 CPU_INT08U const OSDbg_AppHooksEn = OS_CFG_APP_HOOKS_EN;
52 
53 CPU_INT32U const OSDbg_EndiannessTest = 0x12345678LU; /* Variable to test CPU endianness */
54 
55 CPU_INT08U const OSDbg_CalledFromISRChkEn = OS_CFG_CALLED_FROM_ISR_CHK_EN;
56 
57 CPU_INT08U const OSDbg_FlagEn = OS_CFG_FLAG_EN;
58 OS_FLAG_GRP const OSDbg_FlagGrp = { 0u };
59 #if OS_CFG_FLAG_EN > 0u
60 CPU_INT08U const OSDbg_FlagDelEn = OS_CFG_FLAG_DEL_EN;
61 CPU_INT08U const OSDbg_FlagModeClrEn = OS_CFG_FLAG_MODE_CLR_EN;
62 CPU_INT08U const OSDbg_FlagPendAbortEn = OS_CFG_FLAG_PEND_ABORT_EN;
63 CPU_INT16U const OSDbg_FlagGrpSize = sizeof(OS_FLAG_GRP); /* Size in Bytes of OS_FLAG_GRP */
64 CPU_INT16U const OSDbg_FlagWidth = sizeof(OS_FLAGS); /* Width (in bytes) of OS_FLAGS */
65 #else
66 CPU_INT08U const OSDbg_FlagDelEn = 0u;
67 CPU_INT08U const OSDbg_FlagModeClrEn = 0u;
68 CPU_INT08U const OSDbg_FlagPendAbortEn = 0u;
69 CPU_INT16U const OSDbg_FlagGrpSize = 0u;
70 CPU_INT16U const OSDbg_FlagWidth = 0u;
71 #endif
72 
73 #if OS_CFG_ISR_POST_DEFERRED_EN > 0u
74 CPU_INT16U const OSDbg_IntQ = sizeof(OS_INT_Q);
75 #else
76 CPU_INT16U const OSDbg_IntQ = 0u;
77 #endif
78 
79 CPU_INT08U const OSDbg_ISRPostDeferredEn = OS_CFG_ISR_POST_DEFERRED_EN;
80 
81 OS_MEM const OSDbg_Mem = { 0u };
82 CPU_INT08U const OSDbg_MemEn = OS_CFG_MEM_EN;
83 #if OS_CFG_MEM_EN > 0u
84 CPU_INT16U const OSDbg_MemSize = sizeof(OS_MEM); /* Mem. Partition header size (bytes) */
85 #else
86 CPU_INT16U const OSDbg_MemSize = 0u;
87 #endif
88 
89 
90 CPU_INT08U const OSDbg_MsgEn = OS_MSG_EN;
91 #if (OS_MSG_EN) > 0u
92 CPU_INT16U const OSDbg_MsgSize = sizeof(OS_MSG); /* OS_MSG size */
93 CPU_INT16U const OSDbg_MsgPoolSize = sizeof(OS_MSG_POOL);
94 CPU_INT16U const OSDbg_MsgQSize = sizeof(OS_MSG_Q);
95 #else
96 CPU_INT16U const OSDbg_MsgSize = 0u;
97 CPU_INT16U const OSDbg_MsgPoolSize = 0u;
98 CPU_INT16U const OSDbg_MsgQSize = 0u;
99 #endif
100 
101 
102 OS_MUTEX const OSDbg_Mutex = { 0u };
103 CPU_INT08U const OSDbg_MutexEn = OS_CFG_MUTEX_EN;
104 #if OS_CFG_MUTEX_EN > 0u
105 CPU_INT08U const OSDbg_MutexDelEn = OS_CFG_MUTEX_DEL_EN;
106 CPU_INT08U const OSDbg_MutexPendAbortEn = OS_CFG_MUTEX_PEND_ABORT_EN;
107 CPU_INT16U const OSDbg_MutexSize = sizeof(OS_MUTEX); /* Size in bytes of OS_MUTEX */
108 #else
109 CPU_INT08U const OSDbg_MutexDelEn = 0u;
110 CPU_INT08U const OSDbg_MutexPendAbortEn = 0u;
111 CPU_INT16U const OSDbg_MutexSize = 0u;
112 #endif
113 
114 CPU_INT08U const OSDbg_ObjTypeChkEn = OS_CFG_OBJ_TYPE_CHK_EN;
115 
116 
117 CPU_INT08U const OSDbg_PendMultiEn = OS_CFG_PEND_MULTI_EN;
118 CPU_INT16U const OSDbg_PendDataSize = sizeof(OS_PEND_DATA);
119 CPU_INT16U const OSDbg_PendListSize = sizeof(OS_PEND_LIST);
120 CPU_INT16U const OSDbg_PendObjSize = sizeof(OS_PEND_OBJ);
121 
122 
123 CPU_INT16U const OSDbg_PrioMax = OS_CFG_PRIO_MAX; /* Maximum number of priorities */
124 CPU_INT16U const OSDbg_PrioTblSize = sizeof(OSPrioTbl);
125 
126 CPU_INT16U const OSDbg_PtrSize = sizeof(void *); /* Size in Bytes of a pointer */
127 
128 
129 OS_Q const OSDbg_Q = { 0u };
130 CPU_INT08U const OSDbg_QEn = OS_CFG_Q_EN;
131 #if OS_CFG_Q_EN > 0u
132 CPU_INT08U const OSDbg_QDelEn = OS_CFG_Q_DEL_EN;
133 CPU_INT08U const OSDbg_QFlushEn = OS_CFG_Q_FLUSH_EN;
134 CPU_INT08U const OSDbg_QPendAbortEn = OS_CFG_Q_PEND_ABORT_EN;
135 CPU_INT16U const OSDbg_QSize = sizeof(OS_Q); /* Size in bytes of OS_Q structure */
136 #else
137 CPU_INT08U const OSDbg_QDelEn = 0u;
138 CPU_INT08U const OSDbg_QFlushEn = 0u;
139 CPU_INT08U const OSDbg_QPendAbortEn = 0u;
140 CPU_INT16U const OSDbg_QSize = 0u;
141 #endif
142 
143 
144 CPU_INT08U const OSDbg_SchedRoundRobinEn = OS_CFG_SCHED_ROUND_ROBIN_EN;
145 
146 
147 OS_SEM const OSDbg_Sem = { 0u };
148 CPU_INT08U const OSDbg_SemEn = OS_CFG_SEM_EN;
149 #if OS_CFG_SEM_EN > 0u
150 CPU_INT08U const OSDbg_SemDelEn = OS_CFG_SEM_DEL_EN;
151 CPU_INT08U const OSDbg_SemPendAbortEn = OS_CFG_SEM_PEND_ABORT_EN;
152 CPU_INT08U const OSDbg_SemSetEn = OS_CFG_SEM_SET_EN;
153 CPU_INT16U const OSDbg_SemSize = sizeof(OS_SEM); /* Size in bytes of OS_SEM */
154 #else
155 CPU_INT08U const OSDbg_SemDelEn = 0u;
156 CPU_INT08U const OSDbg_SemPendAbortEn = 0u;
157 CPU_INT08U const OSDbg_SemSetEn = 0u;
158 CPU_INT16U const OSDbg_SemSize = 0u;
159 #endif
160 
161 
162 CPU_INT16U const OSDbg_RdyList = sizeof(OS_RDY_LIST);
163 CPU_INT32U const OSDbg_RdyListSize = sizeof(OSRdyList); /* Number of bytes in the ready table */
164 
165 CPU_INT08U const OSDbg_StkWidth = sizeof(CPU_STK);
166 
167 CPU_INT08U const OSDbg_StatTaskEn = OS_CFG_STAT_TASK_EN;
168 CPU_INT08U const OSDbg_StatTaskStkChkEn = OS_CFG_STAT_TASK_STK_CHK_EN;
169 
170 CPU_INT08U const OSDbg_TaskChangePrioEn = OS_CFG_TASK_CHANGE_PRIO_EN;
171 CPU_INT08U const OSDbg_TaskDelEn = OS_CFG_TASK_DEL_EN;
172 CPU_INT08U const OSDbg_TaskQEn = OS_CFG_TASK_Q_EN;
173 CPU_INT08U const OSDbg_TaskQPendAbortEn = OS_CFG_TASK_Q_PEND_ABORT_EN;
174 CPU_INT08U const OSDbg_TaskProfileEn = OS_CFG_TASK_PROFILE_EN;
175 CPU_INT16U const OSDbg_TaskRegTblSize = OS_CFG_TASK_REG_TBL_SIZE;
176 CPU_INT08U const OSDbg_TaskSemPendAbortEn = OS_CFG_TASK_SEM_PEND_ABORT_EN;
177 CPU_INT08U const OSDbg_TaskSuspendEn = OS_CFG_TASK_SUSPEND_EN;
178 
179 
180 CPU_INT16U const OSDbg_TCBSize = sizeof(OS_TCB); /* Size in Bytes of OS_TCB */
181 
182 CPU_INT16U const OSDbg_TickSpokeSize = sizeof(OS_TICK_SPOKE);
183 
184 CPU_INT08U const OSDbg_TimeDlyHMSMEn = OS_CFG_TIME_DLY_HMSM_EN;
185 CPU_INT08U const OSDbg_TimeDlyResumeEn = OS_CFG_TIME_DLY_RESUME_EN;
186 
187 #if defined(OS_CFG_TLS_TBL_SIZE) && (OS_CFG_TLS_TBL_SIZE > 0u)
188 CPU_INT16U const OSDbg_TLS_TblSize = OS_CFG_TLS_TBL_SIZE * sizeof(OS_TLS);
189 #else
190 CPU_INT16U const OSDbg_TLS_TblSize = 0u;
191 #endif
192 
193 
194 OS_TMR const OSDbg_Tmr = { 0u };
195 CPU_INT08U const OSDbg_TmrEn = OS_CFG_TMR_EN;
196 #if OS_CFG_TMR_EN > 0u
197 CPU_INT08U const OSDbg_TmrDelEn = OS_CFG_TMR_DEL_EN;
198 CPU_INT16U const OSDbg_TmrSize = sizeof(OS_TMR);
199 CPU_INT16U const OSDbg_TmrSpokeSize = sizeof(OS_TMR_SPOKE);
200 #else
201 CPU_INT08U const OSDbg_TmrDelEn = 0u;
202 CPU_INT16U const OSDbg_TmrSize = 0u;
203 CPU_INT16U const OSDbg_TmrSpokeSize = 0u;
204 #endif
205 
206 CPU_INT16U const OSDbg_VersionNbr = OS_VERSION;
207 
208 /*$PAGE*/
209 /*
210 ************************************************************************************************************************
211 * DEBUG DATA
212 * TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-III
213 ************************************************************************************************************************
214 */
215 
216 CPU_INT32U const OSDbg_DataSize = sizeof(OSIntNestingCtr)
217 
218 #if OS_CFG_APP_HOOKS_EN > 0u
219  + sizeof(OS_AppTaskCreateHookPtr)
220  + sizeof(OS_AppTaskDelHookPtr)
221  + sizeof(OS_AppTaskReturnHookPtr)
222 
223  + sizeof(OS_AppIdleTaskHookPtr)
224  + sizeof(OS_AppStatTaskHookPtr)
225  + sizeof(OS_AppTaskSwHookPtr)
226  + sizeof(OS_AppTimeTickHookPtr)
227 #endif
228 
229  + sizeof(OSIdleTaskCtr)
230  + sizeof(OSIdleTaskTCB)
231 
232 #ifdef CPU_CFG_INT_DIS_MEAS_EN
233  + sizeof(OSIntDisTimeMax)
234 #endif
235 
237  + sizeof(OSIntQInPtr)
238  + sizeof(OSIntQOutPtr)
239  + sizeof(OSIntQNbrEntries)
240  + sizeof(OSIntQNbrEntriesMax)
241  + sizeof(OSIntQOvfCtr)
242  + sizeof(OSIntQTaskTCB)
243  + sizeof(OSIntQTaskTimeMax)
244 #endif
245 
246  + sizeof(OSRunning)
247 
248 #ifdef OS_SAFETY_CRITICAL_IEC61508
249  + sizeof(OSSafetyCriticalStartFlag)
250 #endif
251 
252 #if OS_CFG_FLAG_EN > 0u
253  + sizeof(OSFlagDbgListPtr)
254  + sizeof(OSFlagQty)
255 #endif
256 
257 #if OS_CFG_MEM_EN > 0u
258 #if OS_CFG_DBG_EN > 0u
259  + sizeof(OSMemDbgListPtr)
260 #endif
261  + sizeof(OSMemQty)
262 #endif
263 
264 #if OS_MSG_EN > 0u
265  + sizeof(OSMsgPool)
266 #endif
267 
268 #if OS_CFG_MUTEX_EN > 0u
269 #if OS_CFG_DBG_EN > 0u
270  + sizeof(OSMutexDbgListPtr)
271 #endif
272  + sizeof(OSMutexQty)
273 #endif
274 
275  + sizeof(OSPrioCur)
276  + sizeof(OSPrioHighRdy)
277  + sizeof(OSPrioSaved)
278  + sizeof(OSPrioTbl)
279 
280 #if OS_CFG_Q_EN > 0u
281 #if OS_CFG_DBG_EN > 0u
282  + sizeof(OSQDbgListPtr)
283 #endif
284  + sizeof(OSQQty)
285 #endif
286 
287  + sizeof(OSRdyList)
288 
289  + sizeof(OSSchedLockNestingCtr)
290 
292  + sizeof(OSSchedLockTimeBegin)
293  + sizeof(OSSchedLockTimeMax)
294  + sizeof(OSSchedLockTimeMaxCur)
295 #endif
296 
297 #if OS_CFG_SCHED_ROUND_ROBIN_EN
298  + sizeof(OSSchedRoundRobinDfltTimeQuanta)
299  + sizeof(OSSchedRoundRobinEn)
300 #endif
301 
302 #if OS_CFG_SEM_EN > 0u
303 #if OS_CFG_DBG_EN > 0u
304  + sizeof(OSSemDbgListPtr)
305 #endif
306  + sizeof(OSSemQty)
307 #endif
308  + sizeof(OSTaskCtxSwCtr)
309 #if OS_CFG_DBG_EN > 0u
310  + sizeof(OSTaskDbgListPtr)
311 #endif
312  + sizeof(OSTaskQty)
313 
314 #if OS_CFG_STAT_TASK_EN > 0u
315  + sizeof(OSStatResetFlag)
316  + sizeof(OSStatTaskCPUUsage)
317  + sizeof(OSStatTaskCPUUsageMax)
318  + sizeof(OSStatTaskCtr)
319  + sizeof(OSStatTaskCtrMax)
320  + sizeof(OSStatTaskCtrRun)
321  + sizeof(OSStatTaskRdy)
322  + sizeof(OSStatTaskTCB)
323  + sizeof(OSStatTaskTimeMax)
324 #endif
325 
326  + sizeof(OSTickCtr)
327  + sizeof(OSTickTaskTCB)
328  + sizeof(OSTickTaskTimeMax)
329 
330 #if OS_CFG_TMR_EN > 0u
331 #if OS_CFG_DBG_EN > 0u
332  + sizeof(OSTmrDbgListPtr)
333 #endif
334  + sizeof(OSTmrQty)
335  + sizeof(OSTmrTaskTCB)
336  + sizeof(OSTmrTaskTimeMax)
337  + sizeof(OSTmrTickCtr)
338  + sizeof(OSTmrUpdateCnt)
339  + sizeof(OSTmrUpdateCtr)
340 #endif
341 
342 #if OS_CFG_TASK_REG_TBL_SIZE > 0u
343  + sizeof(OSTaskRegNextAvailID)
344 #endif
345 
346  + sizeof(OSTCBCurPtr)
347  + sizeof(OSTCBHighRdyPtr);
348 
349 /*$PAGE*/
350 /*
351 ************************************************************************************************************************
352 * OS DEBUG INITIALIZATION
353 *
354 * Description: This function is used to make sure that debug variables that are unused in the application are not
355 * optimized away. This function might not be necessary for all compilers. In this case, you should simply
356 * DELETE the code in this function while still leaving the declaration of the function itself.
357 *
358 * Arguments : none
359 *
360 * Returns : none
361 *
362 * Note(s) : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out the 'const'
363 * variables which are declared in this file.
364 * (2) You may decide to 'compile out' the code (by using #if 0/#endif) INSIDE the function if your compiler
365 * DOES NOT optimize out the 'const' variables above.
366 ************************************************************************************************************************
367 */
368 
369 void OS_Dbg_Init (void)
370 {
371  void const *p_temp;
372 
373 
374  p_temp = (void const *)&OSDbg_DbgEn;
375 
376  p_temp = (void const *)&OSDbg_DataSize;
377 
378  p_temp = (void const *)&OSDbg_ArgChkEn;
379  p_temp = (void const *)&OSDbg_AppHooksEn;
380 
381  p_temp = (void const *)&OSDbg_EndiannessTest;
382 
383  p_temp = (void const *)&OSDbg_CalledFromISRChkEn;
384 
385  p_temp = (void const *)&OSDbg_FlagGrp;
386  p_temp = (void const *)&OSDbg_FlagEn;
387 #if OS_CFG_FLAG_EN > 0u
388  p_temp = (void const *)&OSDbg_FlagDelEn;
389  p_temp = (void const *)&OSDbg_FlagModeClrEn;
390  p_temp = (void const *)&OSDbg_FlagPendAbortEn;
391  p_temp = (void const *)&OSDbg_FlagGrpSize;
392  p_temp = (void const *)&OSDbg_FlagWidth;
393 #endif
394 
395 #if OS_CFG_ISR_POST_DEFERRED_EN > 0u
396  p_temp = (void const *)&OSDbg_IntQ;
397 #endif
398 
399  p_temp = (void const *)&OSDbg_ISRPostDeferredEn;
400 
401  p_temp = (void const *)&OSDbg_Mem;
402  p_temp = (void const *)&OSDbg_MemEn;
403 #if OS_CFG_MEM_EN > 0u
404  p_temp = (void const *)&OSDbg_MemSize;
405 #endif
406 
407  p_temp = (void const *)&OSDbg_MsgEn;
408 #if (OS_MSG_EN) > 0u
409  p_temp = (void const *)&OSDbg_MsgSize;
410  p_temp = (void const *)&OSDbg_MsgPoolSize;
411  p_temp = (void const *)&OSDbg_MsgQSize;
412 #endif
413 
414  p_temp = (void const *)&OSDbg_Mutex;
415  p_temp = (void const *)&OSDbg_MutexEn;
416 #if (OS_CFG_MUTEX_EN) > 0u
417  p_temp = (void const *)&OSDbg_MutexDelEn;
418  p_temp = (void const *)&OSDbg_MutexPendAbortEn;
419  p_temp = (void const *)&OSDbg_MutexSize;
420 #endif
421 
422  p_temp = (void const *)&OSDbg_ObjTypeChkEn;
423 
424  p_temp = (void const *)&OSDbg_PendMultiEn;
425  p_temp = (void const *)&OSDbg_PendDataSize;
426  p_temp = (void const *)&OSDbg_PendListSize;
427  p_temp = (void const *)&OSDbg_PendObjSize;
428 
429  p_temp = (void const *)&OSDbg_PrioMax;
430  p_temp = (void const *)&OSDbg_PrioTblSize;
431 
432  p_temp = (void const *)&OSDbg_PtrSize;
433 
434  p_temp = (void const *)&OSDbg_Q;
435  p_temp = (void const *)&OSDbg_QEn;
436 #if (OS_CFG_Q_EN) > 0u
437  p_temp = (void const *)&OSDbg_QDelEn;
438  p_temp = (void const *)&OSDbg_QFlushEn;
439  p_temp = (void const *)&OSDbg_QPendAbortEn;
440  p_temp = (void const *)&OSDbg_QSize;
441 #endif
442 
443  p_temp = (void const *)&OSDbg_SchedRoundRobinEn;
444 
445  p_temp = (void const *)&OSDbg_Sem;
446  p_temp = (void const *)&OSDbg_SemEn;
447 #if (OS_CFG_SEM_EN) > 0u
448  p_temp = (void const *)&OSDbg_SemDelEn;
449  p_temp = (void const *)&OSDbg_SemPendAbortEn;
450  p_temp = (void const *)&OSDbg_SemSetEn;
451  p_temp = (void const *)&OSDbg_SemSize;
452 #endif
453 
454  p_temp = (void const *)&OSDbg_RdyList;
455  p_temp = (void const *)&OSDbg_RdyListSize;
456 
457  p_temp = (void const *)&OSDbg_StkWidth;
458 
459  p_temp = (void const *)&OSDbg_StatTaskEn;
460  p_temp = (void const *)&OSDbg_StatTaskStkChkEn;
461 
462  p_temp = (void const *)&OSDbg_TaskChangePrioEn;
463  p_temp = (void const *)&OSDbg_TaskDelEn;
464  p_temp = (void const *)&OSDbg_TaskQEn;
465  p_temp = (void const *)&OSDbg_TaskQPendAbortEn;
466  p_temp = (void const *)&OSDbg_TaskProfileEn;
467  p_temp = (void const *)&OSDbg_TaskRegTblSize;
468  p_temp = (void const *)&OSDbg_TaskSemPendAbortEn;
469  p_temp = (void const *)&OSDbg_TaskSuspendEn;
470 
471  p_temp = (void const *)&OSDbg_TCBSize;
472 
473  p_temp = (void const *)&OSDbg_TickSpokeSize;
474 
475  p_temp = (void const *)&OSDbg_TimeDlyHMSMEn;
476  p_temp = (void const *)&OSDbg_TimeDlyResumeEn;
477 
478 
479  p_temp = (void const *)&OSDbg_Tmr;
480  p_temp = (void const *)&OSDbg_TmrEn;
481 #if (OS_CFG_TMR_EN) > 0u
482  p_temp = (void const *)&OSDbg_TmrDelEn;
483  p_temp = (void const *)&OSDbg_TmrSize;
484  p_temp = (void const *)&OSDbg_TmrSpokeSize;
485 #endif
486 
487  p_temp = (void const *)&OSDbg_VersionNbr;
488 
489  p_temp = p_temp; /* Prevent compiler warning for not using 'p_temp' */
490 }
491 #endif