[05b3db65] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
[ac7d5ef0] | 4 | * This program is run to determine the data space and work space |
---|
| 5 | * requirements of the current version of RTEMS. |
---|
[05b3db65] | 6 | */ |
---|
| 7 | |
---|
| 8 | /* |
---|
| 9 | * COPYRIGHT (c) 1989-2014. |
---|
[ac7d5ef0] | 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
[98e4ebf5] | 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
---|
[ac7d5ef0] | 15 | */ |
---|
| 16 | |
---|
[7d3f9c6] | 17 | #ifdef HAVE_CONFIG_H |
---|
| 18 | #include "config.h" |
---|
| 19 | #endif |
---|
| 20 | |
---|
[ac7d5ef0] | 21 | #include <rtems/system.h> |
---|
| 22 | #include <rtems/config.h> |
---|
[5e9b32b] | 23 | #include <rtems/score/apiext.h> |
---|
| 24 | #include <rtems/score/copyrt.h> |
---|
[3a4ae6c] | 25 | #include <rtems/rtems/clock.h> |
---|
[c404828] | 26 | #include <rtems/rtems/tasksimpl.h> |
---|
[562815c] | 27 | #include <rtems/rtems/dpmemimpl.h> |
---|
[e151eb1] | 28 | #include <rtems/rtems/eventimpl.h> |
---|
[ac252bdc] | 29 | #include <rtems/extensionimpl.h> |
---|
[ac7d5ef0] | 30 | #include <rtems/fatal.h> |
---|
| 31 | #include <rtems/init.h> |
---|
[5e9b32b] | 32 | #include <rtems/score/isr.h> |
---|
[3a4ae6c] | 33 | #include <rtems/rtems/intr.h> |
---|
[ac7d5ef0] | 34 | #include <rtems/io.h> |
---|
[993a888] | 35 | #include <rtems/rtems/messageimpl.h> |
---|
[07a3253d] | 36 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[3a4ae6c] | 37 | #include <rtems/rtems/mp.h> |
---|
[7f04cb18] | 38 | #include <rtems/score/mpciimpl.h> |
---|
[07a3253d] | 39 | #endif |
---|
[8695cae] | 40 | #include <rtems/rtems/partimpl.h> |
---|
[5e9b32b] | 41 | #include <rtems/score/priority.h> |
---|
[ecdcf01] | 42 | #include <rtems/rtems/ratemonimpl.h> |
---|
[f6c7c57d] | 43 | #include <rtems/rtems/regionimpl.h> |
---|
[2bbea657] | 44 | #include <rtems/rtems/semimpl.h> |
---|
[3a4ae6c] | 45 | #include <rtems/rtems/signal.h> |
---|
[95ec9e98] | 46 | #include <rtems/score/scheduler.h> |
---|
[5e9b32b] | 47 | #include <rtems/score/sysstate.h> |
---|
| 48 | #include <rtems/score/thread.h> |
---|
[e90b1df] | 49 | #include <rtems/rtems/timerimpl.h> |
---|
[f031df0e] | 50 | #include <rtems/score/todimpl.h> |
---|
[3be0c9a] | 51 | #include <rtems/score/userextimpl.h> |
---|
[4b48ece0] | 52 | #include <rtems/score/watchdogimpl.h> |
---|
[5e9b32b] | 53 | #include <rtems/score/wkspace.h> |
---|
[15cf2cb] | 54 | #if defined(RTEMS_SMP) |
---|
| 55 | #include <rtems/score/smp.h> |
---|
| 56 | #endif |
---|
[ac7d5ef0] | 57 | |
---|
[637df35] | 58 | #include <stdlib.h> |
---|
[3aa4c2e0] | 59 | #include <stdio.h> |
---|
[18ee864] | 60 | #include <unistd.h> |
---|
[3aa4c2e0] | 61 | #include <tmacros.h> |
---|
[637df35] | 62 | |
---|
[95ec9e98] | 63 | #include "system.h" |
---|
| 64 | |
---|
[18ee864] | 65 | /* external function prototypes */ |
---|
| 66 | int getint( void ); |
---|
[b84f1fdc] | 67 | void size_rtems(int mode); |
---|
| 68 | void help_size(void); |
---|
| 69 | void print_formula(void); |
---|
| 70 | |
---|
[18ee864] | 71 | |
---|
[ac7d5ef0] | 72 | /* These are always defined by the executive. |
---|
| 73 | * |
---|
| 74 | * #include <rtems/copyrt.h> |
---|
| 75 | * #include <rtems/tables.h> |
---|
| 76 | * #include <rtems/sptables.h> |
---|
| 77 | */ |
---|
| 78 | #define HEAP_OVHD 16 /* wasted heap space per task stack */ |
---|
| 79 | #define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ |
---|
[95ec9e98] | 80 | |
---|
[5bbc204] | 81 | /* |
---|
| 82 | * This assumes the default Priority Scheduler |
---|
| 83 | */ |
---|
[f0bfd7d8] | 84 | #include <rtems/score/prioritybitmapimpl.h> |
---|
[5bbc204] | 85 | #include <rtems/score/schedulerpriority.h> |
---|
[95ec9e98] | 86 | |
---|
[5bbc204] | 87 | /* Priority scheduling per-thread consumption. Gets |
---|
| 88 | * included in the PER_TASK consumption. |
---|
| 89 | */ |
---|
[beab7329] | 90 | #define SCHEDULER_TASK_WKSP (sizeof(Scheduler_priority_Node)) |
---|
[95ec9e98] | 91 | |
---|
[5bbc204] | 92 | /* Priority scheduling workspace consumption |
---|
| 93 | * |
---|
[e1598a6] | 94 | * Include allocation of ready queue. |
---|
[5bbc204] | 95 | */ |
---|
| 96 | #define SCHEDULER_WKSP_SIZE \ |
---|
[e1598a6] | 97 | (sizeof(Scheduler_priority_Context) + \ |
---|
[494c2e3] | 98 | RTEMS_MAXIMUM_PRIORITY * sizeof(Chain_Control )) |
---|
[5bbc204] | 99 | /****** END OF MEMORY USAGE OF DEFAULT PRIORITY SCHEDULER ******/ |
---|
[ac7d5ef0] | 100 | |
---|
| 101 | #define PER_TASK \ |
---|
[f8700f77] | 102 | (long) (sizeof (Thread_Control) + \ |
---|
[95ec9e98] | 103 | NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control ) + \ |
---|
| 104 | SCHEDULER_TASK_WKSP ) |
---|
[ac7d5ef0] | 105 | #define PER_SEMAPHORE \ |
---|
[f8700f77] | 106 | (long) (sizeof (Semaphore_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 107 | #define PER_TIMER \ |
---|
[f8700f77] | 108 | (long) (sizeof (Timer_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 109 | #define PER_MSGQ \ |
---|
[f8700f77] | 110 | (long) (sizeof (Message_queue_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 111 | #define PER_REGN \ |
---|
[f8700f77] | 112 | (long) (sizeof (Region_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 113 | #define PER_PART \ |
---|
[f8700f77] | 114 | (long) (sizeof (Partition_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 115 | #define PER_PERIOD \ |
---|
[f8700f77] | 116 | (long) (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 117 | #define PER_PORT \ |
---|
[f8700f77] | 118 | (long) (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 119 | #define PER_EXTENSION \ |
---|
[f8700f77] | 120 | (long) (sizeof (Extension_Control) + NAME_PTR_SIZE) |
---|
[ac7d5ef0] | 121 | |
---|
[f8700f77] | 122 | #define PER_DRV (long) (0) |
---|
| 123 | #define PER_FPTASK (long) (CONTEXT_FP_SIZE) |
---|
| 124 | #define PER_GOBTBL (long) (sizeof (Chain_Control)*4) |
---|
| 125 | #define PER_NODE (long) PER_GOBTBL |
---|
[97e2729d] | 126 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[f8700f77] | 127 | #define PER_GOBJECT (long) (sizeof (Objects_MP_Control)) |
---|
[97e2729d] | 128 | #else |
---|
| 129 | #define PER_GOBJECT (long) 0 |
---|
| 130 | #endif |
---|
[f8700f77] | 131 | #define PER_PROXY (long) (sizeof (Thread_Proxy_control)) |
---|
[ac7d5ef0] | 132 | |
---|
[97e2729d] | 133 | #if !defined(RTEMS_MULTIPROCESSING) || (CPU_ALL_TASKS_ARE_FP != TRUE) |
---|
[f8700f77] | 134 | #define MPCI_RECEIVE_SERVER_FP (long) 0 |
---|
[97e2729d] | 135 | #else |
---|
| 136 | #define MPCI_RECEIVE_SERVER_FP (long) (sizeof( Context_Control_fp )) |
---|
[ac7d5ef0] | 137 | #endif |
---|
| 138 | |
---|
| 139 | #if (CPU_IDLE_TASK_IS_FP == TRUE) |
---|
[f8700f77] | 140 | #define SYSTEM_IDLE_FP (long) (sizeof( Context_Control_fp )) |
---|
[ac7d5ef0] | 141 | #else |
---|
[f8700f77] | 142 | #define SYSTEM_IDLE_FP (long) 0 |
---|
[ac7d5ef0] | 143 | #endif |
---|
| 144 | |
---|
[62e1271a] | 145 | #if !defined(RTEMS_MULTIPROCESSING) |
---|
[97e2729d] | 146 | #define MPCI_RECEIVE_SERVER_STACK_SIZE 0 |
---|
| 147 | #endif |
---|
| 148 | |
---|
[07a3253d] | 149 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[bbd655a3] | 150 | #define MPCI_RECEIVE_SERVER_STACK_SIZE \ |
---|
| 151 | |
---|
[07a3253d] | 152 | #define MP_SYSTEM_TASKS \ |
---|
[bbd655a3] | 153 | (STACK_MINIMUM_SIZE + CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \ |
---|
[07a3253d] | 154 | sizeof(Thread_Control) + \ |
---|
| 155 | MPCI_RECEIVE_SERVER_FP) |
---|
[40c2d41e] | 156 | |
---|
| 157 | extern CORE_semaphore_Control _MPCI_Semaphore; |
---|
[07a3253d] | 158 | #else |
---|
| 159 | #define MP_SYSTEM_TASKS 0 |
---|
| 160 | #endif |
---|
| 161 | |
---|
| 162 | /* |
---|
| 163 | * Idle and the MPCI Receive Server Threads |
---|
| 164 | */ |
---|
| 165 | |
---|
[ac7d5ef0] | 166 | #define SYSTEM_TASKS \ |
---|
[07a3253d] | 167 | (STACK_MINIMUM_SIZE + sizeof(Thread_Control) + SYSTEM_IDLE_FP + \ |
---|
| 168 | MP_SYSTEM_TASKS) |
---|
[ac7d5ef0] | 169 | |
---|
[44c6b5b] | 170 | /* FIXME: uint32_t doesn't seem right */ |
---|
[c87608f] | 171 | uint32_t sys_req; |
---|
[ac7d5ef0] | 172 | |
---|
| 173 | void size_rtems( |
---|
| 174 | int mode |
---|
| 175 | ) |
---|
| 176 | { |
---|
| 177 | int uninitialized = 0; |
---|
| 178 | int initialized = 0; |
---|
| 179 | |
---|
| 180 | /* |
---|
| 181 | * The following data is allocated for each Manager: |
---|
| 182 | * |
---|
| 183 | * + Per Manager Object Information |
---|
| 184 | * - local pointer table |
---|
| 185 | * - local name table |
---|
| 186 | * - the object's control blocks |
---|
| 187 | * - global name chains |
---|
| 188 | * |
---|
| 189 | * The following is the data allocate from the RTEMS Workspace Area. |
---|
| 190 | * The order indicates the order in which RTEMS allocates it. |
---|
| 191 | * |
---|
| 192 | * + Object MP |
---|
| 193 | * - Global Object CB's |
---|
| 194 | * + Thread MP |
---|
| 195 | * - Proxies Chain |
---|
[95ec9e98] | 196 | * + Scheduler |
---|
| 197 | * - Ready queue |
---|
[ac7d5ef0] | 198 | * + Interrupt Manager |
---|
| 199 | * - Interrupt Stack |
---|
| 200 | * + Timer Manager |
---|
| 201 | * - per Manager Object Data |
---|
| 202 | * + Extension Manager |
---|
| 203 | * - per Manager Object Data |
---|
| 204 | * + Message Queue Manager |
---|
| 205 | * - per Manager Object Data |
---|
| 206 | * - Message Buffers |
---|
| 207 | * + Semaphore Manager |
---|
| 208 | * - per Manager Object Data |
---|
| 209 | * + Partition Manager |
---|
| 210 | * - per Manager Object Data |
---|
| 211 | * + Region Manager |
---|
| 212 | * - per Manager Object Data |
---|
| 213 | * + Dual Ported Memory Manager |
---|
| 214 | * - per Manager Object Data |
---|
| 215 | * + Rate Monotonic Manager |
---|
| 216 | * - per Manager Object Data |
---|
| 217 | * + Internal Threads Handler |
---|
[0e0d88b] | 218 | * - MPCI Receive Server Thread TCB |
---|
[ac7d5ef0] | 219 | * - IDLE Thread TCB |
---|
[0e0d88b] | 220 | * - MPCI Receive Server Thread stack |
---|
| 221 | * - MPCI Receive Server Thread FP area (if CPU requires this) |
---|
[ac7d5ef0] | 222 | * - IDLE Thread stack |
---|
| 223 | * - IDLE Thread FP area (if CPU requires this) |
---|
| 224 | * |
---|
| 225 | * This does not take into account any CPU dependent alignment requirements. |
---|
| 226 | * |
---|
| 227 | * The following calculates the overhead needed by RTEMS from the |
---|
| 228 | * Workspace Area. |
---|
| 229 | */ |
---|
[95ec9e98] | 230 | sys_req = SYSTEM_TASKS + /* MPCI Receive Server and IDLE */ |
---|
| 231 | NAME_PTR_SIZE + /* Task Overhead */ |
---|
| 232 | SCHEDULER_WKSP_SIZE + /* Scheduler Overhead */ |
---|
| 233 | NAME_PTR_SIZE + /* Timer Overhead */ |
---|
| 234 | NAME_PTR_SIZE + /* Semaphore Overhead */ |
---|
| 235 | NAME_PTR_SIZE + /* Message Queue Overhead */ |
---|
| 236 | NAME_PTR_SIZE + /* Region Overhead */ |
---|
| 237 | NAME_PTR_SIZE + /* Partition Overhead */ |
---|
| 238 | NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ |
---|
| 239 | NAME_PTR_SIZE + /* Rate Monotonic Overhead */ |
---|
| 240 | NAME_PTR_SIZE + /* Extension Overhead */ |
---|
| 241 | PER_NODE; /* Extra Gobject Table */ |
---|
[ac7d5ef0] | 242 | |
---|
| 243 | uninitialized = |
---|
| 244 | /*address.h*/ 0 + |
---|
| 245 | |
---|
| 246 | /*asr.h*/ 0 + |
---|
| 247 | |
---|
| 248 | /*attr.h*/ 0 + |
---|
| 249 | |
---|
| 250 | /*bitfield.h*/ 0 + |
---|
| 251 | |
---|
| 252 | /*chain.h*/ 0 + |
---|
| 253 | |
---|
| 254 | /*clock.h*/ 0 + |
---|
| 255 | |
---|
[bb9c80df] | 256 | /*config.h*/ |
---|
[e58077c] | 257 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 258 | (sizeof _Configuration_MP_table) + |
---|
[e58077c] | 259 | #endif |
---|
[ac7d5ef0] | 260 | |
---|
[4817082] | 261 | /*context.h*/ (sizeof _Thread_Dispatch_necessary) + |
---|
[ac7d5ef0] | 262 | |
---|
| 263 | /*copyrt.h*/ 0 + |
---|
| 264 | |
---|
[562815c] | 265 | /*dpmemimpl.h*/ (sizeof _Dual_ported_memory_Information) + |
---|
[ac7d5ef0] | 266 | |
---|
[97e2729d] | 267 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 268 | /*eventmp.h*/ 0 + |
---|
[97e2729d] | 269 | #endif |
---|
[ac7d5ef0] | 270 | |
---|
[ac252bdc] | 271 | /*extensionimpl.h*/ (sizeof _Extension_Information) + |
---|
[ac7d5ef0] | 272 | |
---|
| 273 | /*fatal.h*/ 0 + |
---|
| 274 | |
---|
| 275 | /*heap.h*/ 0 + |
---|
| 276 | |
---|
| 277 | /*init.h*/ 0 + |
---|
| 278 | |
---|
[d0941512] | 279 | /*interr.h*/ (sizeof _Internal_errors_What_happened) + |
---|
[3a4ae6c] | 280 | |
---|
[ac7d5ef0] | 281 | /*intr.h*/ 0 + |
---|
| 282 | |
---|
| 283 | /*isr.h*/ (sizeof _ISR_Nest_level) + |
---|
[86db88d2] | 284 | #if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE) |
---|
[ac7d5ef0] | 285 | (sizeof _ISR_Vector_table) + |
---|
[86db88d2] | 286 | #endif |
---|
[ac7d5ef0] | 287 | |
---|
[993a888] | 288 | /*messageimpl.h*/ (sizeof _Message_queue_Information) + |
---|
[ac7d5ef0] | 289 | |
---|
| 290 | /*modes.h*/ 0 + |
---|
| 291 | |
---|
[97e2729d] | 292 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 293 | /*mp.h*/ 0 + |
---|
[97e2729d] | 294 | #endif |
---|
[ac7d5ef0] | 295 | |
---|
[97e2729d] | 296 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[7f04cb18] | 297 | /*mpciimpl.h*/ (sizeof _MPCI_Remote_blocked_threads) + |
---|
[3a4ae6c] | 298 | (sizeof _MPCI_Semaphore) + |
---|
| 299 | (sizeof _MPCI_table) + |
---|
| 300 | (sizeof _MPCI_Receive_server_tcb) + |
---|
| 301 | (sizeof _MPCI_Packet_processors) + |
---|
[97e2729d] | 302 | #endif |
---|
[ac7d5ef0] | 303 | |
---|
[97e2729d] | 304 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 305 | /*mppkt.h*/ 0 + |
---|
[97e2729d] | 306 | #endif |
---|
[ac7d5ef0] | 307 | |
---|
[97e2729d] | 308 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 309 | /*mptables.h*/ 0 + |
---|
[97e2729d] | 310 | #endif |
---|
[ac7d5ef0] | 311 | |
---|
[97e2729d] | 312 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 313 | /*msgmp.h*/ 0 + |
---|
[97e2729d] | 314 | #endif |
---|
[ac7d5ef0] | 315 | |
---|
| 316 | /*object.h*/ (sizeof _Objects_Local_node) + |
---|
[3a4ae6c] | 317 | (sizeof _Objects_Maximum_nodes) + |
---|
| 318 | (sizeof _Objects_Information_table) + |
---|
[ac7d5ef0] | 319 | |
---|
[97e2729d] | 320 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[3a4ae6c] | 321 | /*objectmp.h*/ (sizeof _Objects_MP_Maximum_global_objects) + |
---|
| 322 | (sizeof _Objects_MP_Inactive_global_objects) + |
---|
[97e2729d] | 323 | #endif |
---|
[ac7d5ef0] | 324 | |
---|
| 325 | /*options.h*/ 0 + |
---|
| 326 | |
---|
[8695cae] | 327 | /*partimpl.h*/ (sizeof _Partition_Information) + |
---|
[ac7d5ef0] | 328 | |
---|
[97e2729d] | 329 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 330 | /*partmp.h*/ 0 + |
---|
[97e2729d] | 331 | #endif |
---|
[ac7d5ef0] | 332 | |
---|
[edde99b] | 333 | /*percpu.h*/ (_SMP_Get_processor_count() * sizeof(Per_CPU_Control)) + |
---|
[56cdd5e8] | 334 | |
---|
[ecdcf01] | 335 | /*ratemonimpl.h*/ (sizeof _Rate_monotonic_Information) + |
---|
[ac7d5ef0] | 336 | |
---|
[f6c7c57d] | 337 | /*regionimpl.h*/ (sizeof _Region_Information) + |
---|
[ac7d5ef0] | 338 | |
---|
[97e2729d] | 339 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 340 | /*regionmp.h*/ 0 + |
---|
[97e2729d] | 341 | #endif |
---|
[ac7d5ef0] | 342 | |
---|
| 343 | /*rtems.h*/ /* Not applicable */ |
---|
| 344 | |
---|
[2bbea657] | 345 | /*semimpl.h*/ (sizeof _Semaphore_Information) + |
---|
[ac7d5ef0] | 346 | |
---|
[97e2729d] | 347 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 348 | /*semmp.h*/ 0 + |
---|
[97e2729d] | 349 | #endif |
---|
[ac7d5ef0] | 350 | |
---|
| 351 | /*signal.h*/ 0 + |
---|
| 352 | |
---|
| 353 | /*signalmp.h*/ 0 + |
---|
| 354 | |
---|
| 355 | /*stack.h*/ 0 + |
---|
| 356 | |
---|
| 357 | /*states.h*/ 0 + |
---|
| 358 | |
---|
| 359 | /*status.h*/ 0 + |
---|
| 360 | |
---|
[02d989c] | 361 | /*sysstate.h*/ (sizeof _System_state_Current) + |
---|
| 362 | #if defined(RTEMS_MULTIPROCESSING) |
---|
| 363 | (sizeof _System_state_Is_multiprocessing) + |
---|
| 364 | #endif |
---|
[ac7d5ef0] | 365 | |
---|
[97e2729d] | 366 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[ac7d5ef0] | 367 | /*taskmp.h*/ 0 + |
---|
[97e2729d] | 368 | #endif |
---|
[ac7d5ef0] | 369 | |
---|
[c404828] | 370 | /*tasksimpl.h*/ (sizeof _RTEMS_tasks_Information) + |
---|
[ac7d5ef0] | 371 | |
---|
[514705d] | 372 | /*thread.h*/ (sizeof _Thread_Dispatch_disable_level) + |
---|
[ac7d5ef0] | 373 | (sizeof _Thread_Executing) + |
---|
| 374 | (sizeof _Thread_Heir) + |
---|
[ca7858bb] | 375 | #if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1) |
---|
[ac7d5ef0] | 376 | (sizeof _Thread_Allocated_fp) + |
---|
[ca7858bb] | 377 | #endif |
---|
[0e0d88b] | 378 | (sizeof _Thread_Internal_information) + |
---|
[ac7d5ef0] | 379 | |
---|
[97e2729d] | 380 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[0c30bc5] | 381 | /*threadmp.h*/ (sizeof _Thread_MP_Active_proxies) + |
---|
[ac7d5ef0] | 382 | (sizeof _Thread_MP_Inactive_proxies) + |
---|
[97e2729d] | 383 | #endif |
---|
[ac7d5ef0] | 384 | |
---|
[a9047a0] | 385 | /*threadq.h*/ |
---|
[ac7d5ef0] | 386 | |
---|
[e90b1df] | 387 | /*timerimpl.h*/ (sizeof _Timer_Information) + |
---|
[ac7d5ef0] | 388 | |
---|
| 389 | /*tqdata.h*/ 0 + |
---|
| 390 | |
---|
| 391 | /*types.h*/ 0 + |
---|
| 392 | |
---|
[d07d3eec] | 393 | /*userext.h*/ (sizeof _User_extensions_List) + |
---|
[ac7d5ef0] | 394 | |
---|
[1ccbd052] | 395 | /*watchdog.h*/ (sizeof _Watchdog_Ticks_since_boot) + |
---|
[54cf0e34] | 396 | (sizeof _Watchdog_Ticks_header) + |
---|
| 397 | (sizeof _Watchdog_Seconds_header) + |
---|
[ac7d5ef0] | 398 | |
---|
| 399 | /*wkspace.h*/ (sizeof _Workspace_Area); |
---|
| 400 | |
---|
[c4808ca] | 401 | #ifndef unix /* make sure this is not a native compile */ |
---|
| 402 | |
---|
[3ec7bfc] | 403 | #ifdef __i386__ |
---|
[ac7d5ef0] | 404 | |
---|
| 405 | /* cpu.h */ |
---|
[3dc936c1] | 406 | uninitialized += (sizeof _CPU_Null_fp_context); |
---|
| 407 | |
---|
| 408 | #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) |
---|
| 409 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
[ac7d5ef0] | 410 | (sizeof _CPU_Interrupt_stack_high); |
---|
[3dc936c1] | 411 | #endif |
---|
[ac7d5ef0] | 412 | |
---|
| 413 | #endif |
---|
| 414 | |
---|
[3ec7bfc] | 415 | #ifdef __mc68000__ |
---|
[ac7d5ef0] | 416 | |
---|
| 417 | /* cpu.h */ |
---|
| 418 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
| 419 | (sizeof _CPU_Interrupt_stack_high); |
---|
| 420 | |
---|
| 421 | #endif |
---|
| 422 | |
---|
[3ec7bfc] | 423 | #ifdef __sparc__ |
---|
[1b4f2b30] | 424 | |
---|
[9700578] | 425 | /* cpu.h */ |
---|
| 426 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
| 427 | (sizeof _CPU_Interrupt_stack_high) + |
---|
[d135fc52] | 428 | (sizeof _CPU_Null_fp_context); |
---|
| 429 | |
---|
[9700578] | 430 | #endif |
---|
| 431 | |
---|
| 432 | |
---|
[ac7d5ef0] | 433 | #ifdef no_cpu |
---|
| 434 | |
---|
| 435 | /* cpu.h */ |
---|
| 436 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
| 437 | (sizeof _CPU_Interrupt_stack_low) + |
---|
| 438 | (sizeof _CPU_Interrupt_stack_high) + |
---|
| 439 | (sizeof _CPU_Thread_dispatch_pointer); |
---|
| 440 | |
---|
| 441 | #endif |
---|
| 442 | |
---|
[3ec7bfc] | 443 | #ifdef __PPC__ |
---|
[3a4ae6c] | 444 | |
---|
| 445 | /* cpu.h */ |
---|
| 446 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
[7f28f237] | 447 | (sizeof _CPU_Interrupt_stack_high); |
---|
[3a4ae6c] | 448 | |
---|
| 449 | #endif |
---|
[c4808ca] | 450 | #endif /* !unix */ |
---|
[3a4ae6c] | 451 | |
---|
[ac7d5ef0] | 452 | initialized += |
---|
| 453 | /*copyrt.h*/ (strlen(_Copyright_Notice)+1) + |
---|
| 454 | |
---|
[eb5d942a] | 455 | #if defined(RTEMS_MULTIPROCESSING) |
---|
[3a4ae6c] | 456 | /*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) + |
---|
[eb5d942a] | 457 | #endif |
---|
[3c68f96d] | 458 | (strlen(_RTEMS_version)+1); |
---|
[ac7d5ef0] | 459 | |
---|
| 460 | |
---|
| 461 | |
---|
[c4808ca] | 462 | #ifndef unix /* make sure this is not native */ |
---|
[3ec7bfc] | 463 | #ifdef __sparc__ |
---|
[9700578] | 464 | |
---|
| 465 | initialized += (sizeof _CPU_Trap_slot_template); |
---|
| 466 | |
---|
| 467 | #endif |
---|
[c4808ca] | 468 | #endif /* !unix */ |
---|
[9700578] | 469 | |
---|
[ac7d5ef0] | 470 | puts( "" ); |
---|
[9700578] | 471 | |
---|
[ac7d5ef0] | 472 | if ( mode == 0 ) help_size(); |
---|
| 473 | else print_formula(); |
---|
| 474 | |
---|
| 475 | printf( "\n" ); |
---|
| 476 | printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); |
---|
[6227170] | 477 | printf( "RTEMS initialized data consumes %d bytes\n", initialized ); |
---|
[ac7d5ef0] | 478 | |
---|
| 479 | } |
---|
| 480 | |
---|
| 481 | void help_size() |
---|
| 482 | { |
---|
| 483 | int c = '\0'; |
---|
| 484 | int break_loop; |
---|
| 485 | int total_size; |
---|
| 486 | int task_stacks; |
---|
| 487 | int interrupt_stack; |
---|
| 488 | int maximum_tasks, size_tasks; |
---|
| 489 | int maximum_sems, size_sems; |
---|
| 490 | int maximum_timers, size_timers; |
---|
| 491 | int maximum_msgqs, size_msgqs; |
---|
[4b374f36] | 492 | int maximum_msgs, size_msgs_overhead; |
---|
[ac7d5ef0] | 493 | int maximum_regns, size_regns; |
---|
| 494 | int maximum_parts, size_parts; |
---|
| 495 | int maximum_ports, size_ports; |
---|
| 496 | int maximum_periods, size_periods; |
---|
| 497 | int maximum_extensions, size_extensions; |
---|
| 498 | int maximum_drvs, size_drvs; |
---|
| 499 | int maximum_fps, size_fps; |
---|
| 500 | int maximum_nodes, size_nodes; |
---|
| 501 | int maximum_gobjs, size_gobjs; |
---|
| 502 | int maximum_proxies, size_proxies; |
---|
| 503 | |
---|
| 504 | total_size = sys_req; /* Fixed Overhead */ |
---|
| 505 | printf( "What is maximum_tasks? " ); |
---|
| 506 | maximum_tasks = getint(); |
---|
| 507 | size_tasks = PER_TASK * maximum_tasks; |
---|
| 508 | total_size += size_tasks; |
---|
| 509 | |
---|
| 510 | printf( "What is maximum_semaphores? " ); |
---|
| 511 | maximum_sems = getint(); |
---|
| 512 | size_sems = PER_SEMAPHORE * maximum_sems; |
---|
| 513 | total_size += size_sems; |
---|
| 514 | |
---|
| 515 | printf( "What is maximum_timers? " ); |
---|
| 516 | maximum_timers = getint(); |
---|
| 517 | size_timers = PER_TIMER * maximum_timers; |
---|
| 518 | total_size += size_timers; |
---|
| 519 | |
---|
| 520 | printf( "What is maximum_message_queues? " ); |
---|
| 521 | maximum_msgqs = getint(); |
---|
| 522 | size_msgqs = PER_MSGQ * maximum_msgqs; |
---|
| 523 | total_size += size_msgqs; |
---|
| 524 | |
---|
[3652ad35] | 525 | printf( "What is maximum_messages? XXXX " ); |
---|
[ac7d5ef0] | 526 | maximum_msgs = getint(); |
---|
[3652ad35] | 527 | size_msgs_overhead = 0; |
---|
[4b374f36] | 528 | total_size += size_msgs_overhead; |
---|
[ac7d5ef0] | 529 | |
---|
| 530 | printf( "What is maximum_regions? " ); |
---|
| 531 | maximum_regns = getint(); |
---|
| 532 | size_regns = PER_REGN * maximum_regns; |
---|
| 533 | total_size += size_regns; |
---|
| 534 | |
---|
| 535 | printf( "What is maximum_partitions? " ); |
---|
| 536 | maximum_parts = getint(); |
---|
| 537 | size_parts = PER_PART * maximum_parts; |
---|
| 538 | total_size += size_parts; |
---|
| 539 | |
---|
| 540 | printf( "What is maximum_ports? " ); |
---|
| 541 | maximum_ports = getint(); |
---|
| 542 | size_ports = PER_PORT * maximum_ports; |
---|
| 543 | total_size += size_ports; |
---|
| 544 | |
---|
| 545 | printf( "What is maximum_periods? " ); |
---|
| 546 | maximum_periods = getint(); |
---|
[05b3db65] | 547 | size_periods = PER_PERIOD * maximum_periods; |
---|
[ac7d5ef0] | 548 | total_size += size_periods; |
---|
| 549 | |
---|
| 550 | printf( "What is maximum_extensions? " ); |
---|
| 551 | maximum_extensions = getint(); |
---|
| 552 | size_extensions = PER_EXTENSION * maximum_extensions; |
---|
| 553 | total_size += size_extensions; |
---|
| 554 | |
---|
| 555 | printf( "What is number_of_device_drivers? " ); |
---|
| 556 | maximum_drvs = getint(); |
---|
| 557 | size_drvs = PER_DRV * maximum_drvs; |
---|
| 558 | total_size += size_drvs; |
---|
| 559 | |
---|
| 560 | printf( "What will be total stack requirement for all tasks? " ); |
---|
| 561 | task_stacks = getint(); |
---|
| 562 | total_size += task_stacks; |
---|
| 563 | |
---|
| 564 | printf( "What is the size of the interrupt stack? " ); |
---|
| 565 | interrupt_stack = getint(); |
---|
| 566 | total_size += interrupt_stack; |
---|
| 567 | |
---|
| 568 | printf( "How many tasks will be created with the FP flag? " ); |
---|
| 569 | maximum_fps = getint(); |
---|
| 570 | size_fps = PER_FPTASK * maximum_fps; |
---|
| 571 | total_size += size_fps; |
---|
| 572 | |
---|
| 573 | printf( "Is this a single processor system? " ); |
---|
| 574 | for ( break_loop=0 ; !break_loop; c = getchar() ) { |
---|
| 575 | switch ( c ) { |
---|
| 576 | case 'Y': case 'y': |
---|
| 577 | case 'N': case 'n': |
---|
| 578 | break_loop = 1; |
---|
| 579 | break; |
---|
| 580 | } |
---|
| 581 | } |
---|
| 582 | printf( "%c\n", c ); |
---|
| 583 | if ( c == 'n' || c == 'N' ) { |
---|
| 584 | printf( "What is maximum_nodes? " ); |
---|
| 585 | maximum_nodes = getint(); |
---|
| 586 | size_nodes = PER_NODE * maximum_nodes; |
---|
| 587 | total_size += size_nodes; |
---|
| 588 | printf( "What is maximum_global_objects? " ); |
---|
| 589 | maximum_gobjs = getint(); |
---|
| 590 | size_gobjs = PER_GOBJECT * maximum_gobjs; |
---|
| 591 | total_size += size_gobjs; |
---|
| 592 | printf( "What is maximum_proxies? " ); |
---|
| 593 | maximum_proxies = getint(); |
---|
| 594 | size_proxies = PER_PROXY * maximum_proxies; |
---|
| 595 | total_size += size_proxies; |
---|
| 596 | } else { |
---|
| 597 | maximum_nodes = 0; |
---|
| 598 | size_nodes = PER_NODE * 0; |
---|
| 599 | maximum_gobjs = 0; |
---|
| 600 | size_gobjs = PER_GOBJECT * 0; |
---|
| 601 | maximum_proxies = 0; |
---|
| 602 | size_proxies = PER_PROXY * 0; |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | printf( "\n\n" ); |
---|
| 606 | printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); |
---|
[f8700f77] | 607 | printf( " Tasks - %03d * %03ld = %ld\n", |
---|
| 608 | maximum_tasks, PER_TASK, (long) size_tasks ); |
---|
| 609 | printf( " Semaphores - %03d * %03ld = %ld\n", |
---|
| 610 | maximum_sems, PER_SEMAPHORE, (long) size_sems ); |
---|
| 611 | printf( " Timers - %03d * %03ld = %ld\n", |
---|
| 612 | maximum_timers, PER_TIMER, (long) size_timers ); |
---|
| 613 | printf( " Msg Queues - %03d * %03ld = %ld\n", |
---|
| 614 | maximum_msgqs, PER_MSGQ, (long) size_msgqs ); |
---|
| 615 | printf( " Messages Overhead - %03d * %03d = %ld\n", |
---|
| 616 | maximum_msgs, 0 /* PER_MSG_OVERHEAD */, (long) size_msgs_overhead ); |
---|
| 617 | printf( " Regions - %03d * %03ld = %ld\n", |
---|
| 618 | maximum_regns, PER_REGN, (long) size_regns); |
---|
| 619 | printf( " Partitions - %03d * %03ld = %ld\n", |
---|
| 620 | maximum_parts, PER_PART, (long) size_parts ); |
---|
| 621 | printf( " Periods - %03d * %03ld = %ld\n", |
---|
| 622 | maximum_periods, PER_PERIOD, (long) size_periods ); |
---|
| 623 | printf( " Extensions - %03d * %03ld = %ld\n", |
---|
| 624 | maximum_extensions, PER_EXTENSION, (long) size_extensions ); |
---|
| 625 | printf( " Device Drivers - %03d * %03ld = %ld\n", |
---|
| 626 | maximum_drvs, PER_DRV, (long) size_drvs ); |
---|
[ac7d5ef0] | 627 | |
---|
[44c6b5b] | 628 | printf( " System Requirements - %04" PRIu32 " = %"PRIu32 "\n", |
---|
[ac7d5ef0] | 629 | sys_req, sys_req ); |
---|
| 630 | |
---|
[f8700f77] | 631 | printf( " Floating Point Tasks - %03d * %03ld = %ld\n", |
---|
| 632 | maximum_fps, PER_FPTASK, (long) size_fps ); |
---|
[ac7d5ef0] | 633 | printf( " Application Task Stacks - = %d\n", |
---|
| 634 | task_stacks ); |
---|
| 635 | printf( " Interrupt Stacks - = %d\n", |
---|
| 636 | task_stacks ); |
---|
| 637 | printf( " \n" ); |
---|
[f8700f77] | 638 | printf( " Global object tables - %03d * %03ld = %ld\n", |
---|
| 639 | maximum_nodes, PER_NODE, (long) size_nodes ); |
---|
| 640 | printf( " Global objects - %03d * %03ld = %ld\n", |
---|
| 641 | maximum_gobjs, PER_GOBJECT, (long) size_gobjs ); |
---|
| 642 | printf( " Proxies - %03d * %03ld = %ld\n", |
---|
| 643 | maximum_proxies, PER_PROXY, (long) size_proxies ); |
---|
[ac7d5ef0] | 644 | printf( "\n\n" ); |
---|
| 645 | printf( " TOTAL = %d bytes\n", |
---|
| 646 | total_size ); |
---|
| 647 | } |
---|
| 648 | |
---|
| 649 | void print_formula() |
---|
| 650 | { |
---|
| 651 | printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); |
---|
[f8700f77] | 652 | printf( " Tasks - maximum_tasks * %ld\n", PER_TASK ); |
---|
| 653 | printf( " Timers - maximum_timers * %ld\n", PER_TIMER ); |
---|
| 654 | printf( " Semaphores - maximum_semaphores * %ld\n", PER_SEMAPHORE); |
---|
| 655 | printf( " Message Queues - maximum_message_queues * %ld\n", PER_MSGQ ); |
---|
[4b374f36] | 656 | printf( " Messages -\n"); |
---|
[f8700f77] | 657 | printf( " Regions - maximum_regions * %ld\n", PER_REGN ); |
---|
| 658 | printf( " Partitions - maximum_partitions * %ld\n", PER_PART ); |
---|
| 659 | printf( " Ports - maximum_ports * %ld\n", PER_PORT ); |
---|
| 660 | printf( " Periods - maximum_periods * %ld\n", PER_PORT ); |
---|
| 661 | printf( " Extensions - maximum_extensions * %ld\n", PER_EXTENSION ); |
---|
| 662 | printf( " Device Drivers - number_of_device_drivers * %ld\n", PER_DRV); |
---|
[44c6b5b] | 663 | printf( " System Requirements - %" PRIu32 "\n", sys_req ); |
---|
[f8700f77] | 664 | printf( " Floating Point Tasks - FPMASK Tasks * %ld\n", PER_FPTASK ); |
---|
[ac7d5ef0] | 665 | printf( " User's Tasks' Stacks -\n" ); |
---|
| 666 | printf( " Interrupt Stack -\n" ); |
---|
| 667 | printf( " \n" ); |
---|
[f8700f77] | 668 | printf( " Global object tables - maximum_nodes * %ld\n", PER_NODE ); |
---|
| 669 | printf( " Global objects - maximum_global_objects * %ld\n", PER_GOBJECT ); |
---|
| 670 | printf( " Proxies - maximum_proxies * %ld\n", PER_PROXY ); |
---|
[ac7d5ef0] | 671 | } |
---|