os_dbg_r.c 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. /*
  2. *********************************************************************************************************
  3. * uC/OS-II
  4. * The Real-Time Kernel
  5. *
  6. * Copyright 1992-2020 Silicon Laboratories Inc. www.silabs.com
  7. *
  8. * SPDX-License-Identifier: APACHE-2.0
  9. *
  10. * This software is subject to an open source license and is distributed by
  11. * Silicon Laboratories Inc. pursuant to the terms of the Apache License,
  12. * Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
  13. *
  14. *********************************************************************************************************
  15. */
  16. /*
  17. *********************************************************************************************************
  18. *
  19. * DEBUGGER CONSTANTS
  20. *
  21. * Filename : os_dbg_r.c
  22. * Version : V2.93.00
  23. *********************************************************************************************************
  24. */
  25. #define MICRIUM_SOURCE
  26. #include <ucos_ii.h>
  27. /*
  28. *********************************************************************************************************
  29. * DEBUG DATA
  30. *********************************************************************************************************
  31. */
  32. INT16U const OSDebugEn = OS_DEBUG_EN; /* Debug constants are defined below */
  33. #if OS_DEBUG_EN > 0u
  34. INT32U const OSEndiannessTest = 0x12345678uL; /* Variable to test CPU endianness */
  35. INT16U const OSEventEn = OS_EVENT_EN;
  36. INT16U const OSEventMax = OS_MAX_EVENTS; /* Number of event control blocks */
  37. INT16U const OSEventNameEn = OS_EVENT_NAME_EN;
  38. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
  39. INT16U const OSEventSize = sizeof(OS_EVENT); /* Size in Bytes of OS_EVENT */
  40. INT16U const OSEventTblSize = sizeof(OSEventTbl); /* Size of OSEventTbl[] in bytes */
  41. #else
  42. INT16U const OSEventSize = 0u;
  43. INT16U const OSEventTblSize = 0u;
  44. #endif
  45. INT16U const OSEventMultiEn = OS_EVENT_MULTI_EN;
  46. INT16U const OSFlagEn = OS_FLAG_EN;
  47. #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
  48. INT16U const OSFlagGrpSize = sizeof(OS_FLAG_GRP); /* Size in Bytes of OS_FLAG_GRP */
  49. INT16U const OSFlagNodeSize = sizeof(OS_FLAG_NODE); /* Size in Bytes of OS_FLAG_NODE */
  50. INT16U const OSFlagWidth = sizeof(OS_FLAGS); /* Width (in bytes) of OS_FLAGS */
  51. #else
  52. INT16U const OSFlagGrpSize = 0u;
  53. INT16U const OSFlagNodeSize = 0u;
  54. INT16U const OSFlagWidth = 0u;
  55. #endif
  56. INT16U const OSFlagMax = OS_MAX_FLAGS;
  57. INT16U const OSFlagNameEn = OS_FLAG_NAME_EN;
  58. INT16U const OSLowestPrio = OS_LOWEST_PRIO;
  59. INT16U const OSMboxEn = OS_MBOX_EN;
  60. INT16U const OSMemEn = OS_MEM_EN;
  61. INT16U const OSMemMax = OS_MAX_MEM_PART; /* Number of memory partitions */
  62. INT16U const OSMemNameEn = OS_MEM_NAME_EN;
  63. #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
  64. INT16U const OSMemSize = sizeof(OS_MEM); /* Mem. Partition header sine (bytes) */
  65. INT16U const OSMemTblSize = sizeof(OSMemTbl);
  66. #else
  67. INT16U const OSMemSize = 0u;
  68. INT16U const OSMemTblSize = 0u;
  69. #endif
  70. INT16U const OSMutexEn = OS_MUTEX_EN;
  71. INT16U const OSPtrSize = sizeof(void *); /* Size in Bytes of a pointer */
  72. INT16U const OSQEn = OS_Q_EN;
  73. INT16U const OSQMax = OS_MAX_QS; /* Number of queues */
  74. #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
  75. INT16U const OSQSize = sizeof(OS_Q); /* Size in bytes of OS_Q structure */
  76. #else
  77. INT16U const OSQSize = 0u;
  78. #endif
  79. INT16U const OSRdyTblSize = OS_RDY_TBL_SIZE; /* Number of bytes in the ready table */
  80. INT16U const OSSemEn = OS_SEM_EN;
  81. INT16U const OSStkWidth = sizeof(OS_STK); /* Size in Bytes of a stack entry */
  82. INT16U const OSTaskCreateEn = OS_TASK_CREATE_EN;
  83. INT16U const OSTaskCreateExtEn = OS_TASK_CREATE_EXT_EN;
  84. INT16U const OSTaskDelEn = OS_TASK_DEL_EN;
  85. INT16U const OSTaskIdleStkSize = OS_TASK_IDLE_STK_SIZE;
  86. INT16U const OSTaskProfileEn = OS_TASK_PROFILE_EN;
  87. INT16U const OSTaskMax = OS_MAX_TASKS + OS_N_SYS_TASKS; /* Total max. number of tasks */
  88. INT16U const OSTaskNameEn = OS_TASK_NAME_EN;
  89. INT16U const OSTaskStatEn = OS_TASK_STAT_EN;
  90. INT16U const OSTaskStatStkSize = OS_TASK_STAT_STK_SIZE;
  91. INT16U const OSTaskStatStkChkEn = OS_TASK_STAT_STK_CHK_EN;
  92. INT16U const OSTaskSwHookEn = OS_TASK_SW_HOOK_EN;
  93. INT16U const OSTaskRegTblSize = OS_TASK_REG_TBL_SIZE;
  94. INT16U const OSTCBPrioTblMax = OS_LOWEST_PRIO + 1u; /* Number of entries in OSTCBPrioTbl[] */
  95. INT16U const OSTCBSize = sizeof(OS_TCB); /* Size in Bytes of OS_TCB */
  96. INT16U const OSTicksPerSec = OS_TICKS_PER_SEC;
  97. INT16U const OSTimeTickHookEn = OS_TIME_TICK_HOOK_EN;
  98. INT16U const OSVersionNbr = OS_VERSION;
  99. #if OS_TASK_CREATE_EXT_EN > 0u
  100. #if defined(OS_TLS_TBL_SIZE) && (OS_TLS_TBL_SIZE > 0u)
  101. INT16U const OS_TLS_TblSize = OS_TLS_TBL_SIZE * sizeof(OS_TLS);
  102. #else
  103. INT16U const OS_TLS_TblSize = 0u;
  104. #endif
  105. #endif
  106. INT16U const OSTmrEn = OS_TMR_EN;
  107. INT16U const OSTmrCfgMax = OS_TMR_CFG_MAX;
  108. INT16U const OSTmrCfgNameEn = OS_TMR_CFG_NAME_EN;
  109. INT16U const OSTmrCfgWheelSize = OS_TMR_CFG_WHEEL_SIZE;
  110. INT16U const OSTmrCfgTicksPerSec = OS_TMR_CFG_TICKS_PER_SEC;
  111. #if (OS_TMR_EN > 0u) && (OS_TMR_CFG_MAX > 0u)
  112. INT16U const OSTmrSize = sizeof(OS_TMR);
  113. INT16U const OSTmrTblSize = sizeof(OSTmrTbl);
  114. INT16U const OSTmrWheelSize = sizeof(OS_TMR_WHEEL);
  115. INT16U const OSTmrWheelTblSize = sizeof(OSTmrWheelTbl);
  116. #else
  117. INT16U const OSTmrSize = 0u;
  118. INT16U const OSTmrTblSize = 0u;
  119. INT16U const OSTmrWheelSize = 0u;
  120. INT16U const OSTmrWheelTblSize = 0u;
  121. #endif
  122. #endif
  123. /*
  124. *********************************************************************************************************
  125. * DEBUG DATA
  126. * TOTAL DATA SPACE (i.e. RAM) USED BY uC/OS-II
  127. *********************************************************************************************************
  128. */
  129. #if OS_DEBUG_EN > 0u
  130. INT16U const OSDataSize = sizeof(OSCtxSwCtr)
  131. #if (OS_EVENT_EN) && (OS_MAX_EVENTS > 0u)
  132. + sizeof(OSEventFreeList)
  133. + sizeof(OSEventTbl)
  134. #endif
  135. #if (OS_FLAG_EN > 0u) && (OS_MAX_FLAGS > 0u)
  136. + sizeof(OSFlagTbl)
  137. + sizeof(OSFlagFreeList)
  138. #endif
  139. #if OS_TASK_STAT_EN > 0u
  140. + sizeof(OSCPUUsage)
  141. + sizeof(OSIdleCtrMax)
  142. + sizeof(OSIdleCtrRun)
  143. + sizeof(OSStatRdy)
  144. + sizeof(OSTaskStatStk)
  145. #endif
  146. #if OS_TICK_STEP_EN > 0u
  147. + sizeof(OSTickStepState)
  148. #endif
  149. #if (OS_MEM_EN > 0u) && (OS_MAX_MEM_PART > 0u)
  150. + sizeof(OSMemFreeList)
  151. + sizeof(OSMemTbl)
  152. #endif
  153. #ifdef OS_SAFETY_CRITICAL_IEC61508
  154. + sizeof(OSSafetyCriticalStartFlag)
  155. #endif
  156. #if (OS_Q_EN > 0u) && (OS_MAX_QS > 0u)
  157. + sizeof(OSQFreeList)
  158. + sizeof(OSQTbl)
  159. #endif
  160. #if OS_TASK_REG_TBL_SIZE > 0u
  161. + sizeof(OSTaskRegNextAvailID)
  162. #endif
  163. #if OS_TIME_GET_SET_EN > 0u
  164. + sizeof(OSTime)
  165. #endif
  166. #if (OS_TMR_EN > 0u) && (OS_TMR_CFG_MAX > 0u)
  167. + sizeof(OSTmrFree)
  168. + sizeof(OSTmrUsed)
  169. + sizeof(OSTmrTime)
  170. + sizeof(OSTmrSem)
  171. + sizeof(OSTmrSemSignal)
  172. + sizeof(OSTmrTbl)
  173. + sizeof(OSTmrFreeList)
  174. + sizeof(OSTmrTaskStk)
  175. + sizeof(OSTmrWheelTbl)
  176. #endif
  177. + sizeof(OSIntNesting)
  178. + sizeof(OSLockNesting)
  179. + sizeof(OSPrioCur)
  180. + sizeof(OSPrioHighRdy)
  181. + sizeof(OSRdyGrp)
  182. + sizeof(OSRdyTbl)
  183. + sizeof(OSRunning)
  184. + sizeof(OSTaskCtr)
  185. + sizeof(OSIdleCtr)
  186. + sizeof(OSTaskIdleStk)
  187. + sizeof(OSTCBCur)
  188. + sizeof(OSTCBFreeList)
  189. + sizeof(OSTCBHighRdy)
  190. + sizeof(OSTCBList)
  191. + sizeof(OSTCBPrioTbl)
  192. + sizeof(OSTCBTbl);
  193. #endif
  194. /*
  195. *********************************************************************************************************
  196. * OS DEBUG INITIALIZATION
  197. *
  198. * Description: This function is used to make sure that debug variables that are unused in the application
  199. * are not optimized away. This function might not be necessary for all compilers. In this
  200. * case, you should simply DELETE the code in this function while still leaving the declaration
  201. * of the function itself.
  202. *
  203. * Arguments : none
  204. *
  205. * Returns : none
  206. *
  207. * Note(s) : (1) This code doesn't do anything, it simply prevents the compiler from optimizing out
  208. * the 'const' variables which are declared in this file.
  209. * (2) You may decide to 'compile out' the code (by using #if 0/#endif) INSIDE the function
  210. * if your compiler DOES NOT optimize out the 'const' variables above.
  211. *********************************************************************************************************
  212. */
  213. #if OS_DEBUG_EN > 0u
  214. void OSDebugInit (void)
  215. {
  216. void const *ptemp;
  217. ptemp = (void const *)&OSDebugEn;
  218. ptemp = (void const *)&OSEndiannessTest;
  219. ptemp = (void const *)&OSEventMax;
  220. ptemp = (void const *)&OSEventNameEn;
  221. ptemp = (void const *)&OSEventEn;
  222. ptemp = (void const *)&OSEventSize;
  223. ptemp = (void const *)&OSEventTblSize;
  224. ptemp = (void const *)&OSEventMultiEn;
  225. ptemp = (void const *)&OSFlagEn;
  226. ptemp = (void const *)&OSFlagGrpSize;
  227. ptemp = (void const *)&OSFlagNodeSize;
  228. ptemp = (void const *)&OSFlagWidth;
  229. ptemp = (void const *)&OSFlagMax;
  230. ptemp = (void const *)&OSFlagNameEn;
  231. ptemp = (void const *)&OSLowestPrio;
  232. ptemp = (void const *)&OSMboxEn;
  233. ptemp = (void const *)&OSMemEn;
  234. ptemp = (void const *)&OSMemMax;
  235. ptemp = (void const *)&OSMemNameEn;
  236. ptemp = (void const *)&OSMemSize;
  237. ptemp = (void const *)&OSMemTblSize;
  238. ptemp = (void const *)&OSMutexEn;
  239. ptemp = (void const *)&OSPtrSize;
  240. ptemp = (void const *)&OSQEn;
  241. ptemp = (void const *)&OSQMax;
  242. ptemp = (void const *)&OSQSize;
  243. ptemp = (void const *)&OSRdyTblSize;
  244. ptemp = (void const *)&OSSemEn;
  245. ptemp = (void const *)&OSStkWidth;
  246. ptemp = (void const *)&OSTaskCreateEn;
  247. ptemp = (void const *)&OSTaskCreateExtEn;
  248. ptemp = (void const *)&OSTaskDelEn;
  249. ptemp = (void const *)&OSTaskIdleStkSize;
  250. ptemp = (void const *)&OSTaskProfileEn;
  251. ptemp = (void const *)&OSTaskMax;
  252. ptemp = (void const *)&OSTaskNameEn;
  253. ptemp = (void const *)&OSTaskStatEn;
  254. ptemp = (void const *)&OSTaskStatStkSize;
  255. ptemp = (void const *)&OSTaskStatStkChkEn;
  256. ptemp = (void const *)&OSTaskSwHookEn;
  257. ptemp = (void const *)&OSTCBPrioTblMax;
  258. ptemp = (void const *)&OSTCBSize;
  259. ptemp = (void const *)&OSTicksPerSec;
  260. ptemp = (void const *)&OSTimeTickHookEn;
  261. #if OS_TMR_EN > 0u
  262. ptemp = (void const *)&OSTmrTbl[0];
  263. ptemp = (void const *)&OSTmrWheelTbl[0];
  264. ptemp = (void const *)&OSTmrEn;
  265. ptemp = (void const *)&OSTmrCfgMax;
  266. ptemp = (void const *)&OSTmrCfgNameEn;
  267. ptemp = (void const *)&OSTmrCfgWheelSize;
  268. ptemp = (void const *)&OSTmrCfgTicksPerSec;
  269. ptemp = (void const *)&OSTmrSize;
  270. ptemp = (void const *)&OSTmrTblSize;
  271. ptemp = (void const *)&OSTmrWheelSize;
  272. ptemp = (void const *)&OSTmrWheelTblSize;
  273. #endif
  274. ptemp = (void const *)&OSVersionNbr;
  275. ptemp = (void const *)&OSDataSize;
  276. ptemp = ptemp; /* Prevent compiler warning for 'ptemp' not being used! */
  277. }
  278. #endif