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.
 
 
 
 
 

329 lines
14 KiB

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