[ac7d5ef0] | 1 | /* main |
---|
| 2 | * |
---|
| 3 | * This program is run to determine the data space and work space |
---|
| 4 | * requirements of the current version of RTEMS. |
---|
| 5 | * |
---|
| 6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * All rights assigned to U.S. Government, 1994. |
---|
| 9 | * |
---|
| 10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 12 | * notice must appear in all copies of this file and its derivatives. |
---|
| 13 | * |
---|
[3235ad9] | 14 | * $Id$ |
---|
[ac7d5ef0] | 15 | */ |
---|
| 16 | |
---|
| 17 | #include <rtems/system.h> |
---|
| 18 | #include <rtems/config.h> |
---|
[3a4ae6c] | 19 | #include <rtems/directives.h> |
---|
[5e9b32b] | 20 | #include <rtems/score/apiext.h> |
---|
| 21 | #include <rtems/score/copyrt.h> |
---|
[3a4ae6c] | 22 | #include <rtems/rtems/clock.h> |
---|
| 23 | #include <rtems/rtems/tasks.h> |
---|
| 24 | #include <rtems/rtems/dpmem.h> |
---|
| 25 | #include <rtems/rtems/event.h> |
---|
[ac7d5ef0] | 26 | #include <rtems/extension.h> |
---|
| 27 | #include <rtems/fatal.h> |
---|
| 28 | #include <rtems/init.h> |
---|
[18c5378] | 29 | #include <rtems/intthrd.h> |
---|
[5e9b32b] | 30 | #include <rtems/score/isr.h> |
---|
[3a4ae6c] | 31 | #include <rtems/rtems/intr.h> |
---|
[ac7d5ef0] | 32 | #include <rtems/io.h> |
---|
[3a4ae6c] | 33 | #include <rtems/rtems/message.h> |
---|
| 34 | #include <rtems/rtems/mp.h> |
---|
[5e9b32b] | 35 | #include <rtems/score/mpci.h> |
---|
[3a4ae6c] | 36 | #include <rtems/rtems/part.h> |
---|
[5e9b32b] | 37 | #include <rtems/score/priority.h> |
---|
[3a4ae6c] | 38 | #include <rtems/rtems/ratemon.h> |
---|
| 39 | #include <rtems/rtems/region.h> |
---|
| 40 | #include <rtems/rtems/sem.h> |
---|
| 41 | #include <rtems/rtems/signal.h> |
---|
[5e9b32b] | 42 | #include <rtems/score/sysstate.h> |
---|
| 43 | #include <rtems/score/thread.h> |
---|
[3a4ae6c] | 44 | #include <rtems/rtems/timer.h> |
---|
[5e9b32b] | 45 | #include <rtems/score/tod.h> |
---|
| 46 | #include <rtems/score/userext.h> |
---|
| 47 | #include <rtems/score/wkspace.h> |
---|
[ac7d5ef0] | 48 | |
---|
[637df35] | 49 | #include <stdlib.h> |
---|
| 50 | |
---|
[ac7d5ef0] | 51 | /* These are always defined by the executive. |
---|
| 52 | * |
---|
| 53 | * #include <rtems/copyrt.h> |
---|
| 54 | * #include <rtems/tables.h> |
---|
| 55 | * #include <rtems/sptables.h> |
---|
| 56 | */ |
---|
| 57 | #define HEAP_OVHD 16 /* wasted heap space per task stack */ |
---|
| 58 | #define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ |
---|
| 59 | #define READYCHAINS_SIZE \ |
---|
| 60 | ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control )) |
---|
| 61 | |
---|
| 62 | #define PER_TASK \ |
---|
[c3dcd6e] | 63 | (sizeof (Thread_Control) + \ |
---|
| 64 | NAME_PTR_SIZE + HEAP_OVHD + sizeof( RTEMS_API_Control )) |
---|
[ac7d5ef0] | 65 | #define PER_SEMAPHORE \ |
---|
| 66 | (sizeof (Semaphore_Control) + NAME_PTR_SIZE) |
---|
| 67 | #define PER_TIMER \ |
---|
| 68 | (sizeof (Timer_Control) + NAME_PTR_SIZE) |
---|
| 69 | #define PER_MSGQ \ |
---|
| 70 | (sizeof (Message_queue_Control) + NAME_PTR_SIZE) |
---|
| 71 | #define PER_REGN \ |
---|
| 72 | (sizeof (Region_Control) + NAME_PTR_SIZE) |
---|
| 73 | #define PER_PART \ |
---|
| 74 | (sizeof (Partition_Control) + NAME_PTR_SIZE) |
---|
| 75 | #define PER_PERIOD \ |
---|
| 76 | (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE) |
---|
| 77 | #define PER_PORT \ |
---|
| 78 | (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) |
---|
| 79 | #define PER_EXTENSION \ |
---|
| 80 | (sizeof (Extension_Control) + NAME_PTR_SIZE) |
---|
| 81 | |
---|
| 82 | #define PER_DRV (0) |
---|
| 83 | #define PER_FPTASK (CONTEXT_FP_SIZE) |
---|
| 84 | #define PER_GOBTBL (sizeof (Chain_Control)*4) |
---|
| 85 | #define PER_NODE PER_GOBTBL |
---|
| 86 | #define PER_GOBJECT (sizeof (Objects_MP_Control)) |
---|
| 87 | #define PER_PROXY (sizeof (Thread_Proxy_control)) |
---|
| 88 | |
---|
| 89 | #if (CPU_ALL_TASKS_ARE_FP == TRUE) |
---|
| 90 | #define SYSTEM_INITIALIZATION_FP (sizeof( Context_Control_fp )) |
---|
| 91 | #else |
---|
| 92 | #define SYSTEM_INITIALIZATION_FP 0 |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | #if (CPU_IDLE_TASK_IS_FP == TRUE) |
---|
| 96 | #define SYSTEM_IDLE_FP (sizeof( Context_Control_fp )) |
---|
| 97 | #else |
---|
| 98 | #define SYSTEM_IDLE_FP 0 |
---|
| 99 | #endif |
---|
| 100 | |
---|
| 101 | #define SYSTEM_TASKS \ |
---|
| 102 | (INTERNAL_THREADS_IDLE_THREAD_STACK_SIZE + \ |
---|
| 103 | INTERNAL_THREADS_SYSTEM_INITIALIZATION_THREAD_STACK_SIZE + \ |
---|
| 104 | (2*sizeof(Thread_Control))) + \ |
---|
| 105 | SYSTEM_INITIALIZATION_FP + \ |
---|
| 106 | SYSTEM_IDLE_FP |
---|
| 107 | |
---|
| 108 | #define rtems_unsigned32 unsigned32 |
---|
| 109 | |
---|
| 110 | rtems_unsigned32 sys_req; |
---|
| 111 | |
---|
| 112 | /* to avoid warnings */ |
---|
| 113 | int puts(); |
---|
| 114 | int printf(); |
---|
| 115 | int getint(); |
---|
| 116 | #undef getchar |
---|
| 117 | int getchar(); |
---|
| 118 | void help_size(); |
---|
| 119 | void print_formula(); |
---|
| 120 | |
---|
| 121 | void size_rtems( |
---|
| 122 | int mode |
---|
| 123 | ) |
---|
| 124 | { |
---|
| 125 | int uninitialized = 0; |
---|
| 126 | int initialized = 0; |
---|
| 127 | |
---|
| 128 | /* |
---|
| 129 | * The following data is allocated for each Manager: |
---|
| 130 | * |
---|
| 131 | * + Per Manager Object Information |
---|
| 132 | * - local pointer table |
---|
| 133 | * - local name table |
---|
| 134 | * - the object's control blocks |
---|
| 135 | * - global name chains |
---|
| 136 | * |
---|
| 137 | * The following is the data allocate from the RTEMS Workspace Area. |
---|
| 138 | * The order indicates the order in which RTEMS allocates it. |
---|
| 139 | * |
---|
| 140 | * + Object MP |
---|
| 141 | * - Global Object CB's |
---|
| 142 | * + Thread |
---|
| 143 | * - Ready Chain |
---|
| 144 | * + Thread MP |
---|
| 145 | * - Proxies Chain |
---|
| 146 | * + Interrupt Manager |
---|
| 147 | * - Interrupt Stack |
---|
| 148 | * + Timer Manager |
---|
| 149 | * - per Manager Object Data |
---|
| 150 | * + Extension Manager |
---|
| 151 | * - per Manager Object Data |
---|
| 152 | * + Message Queue Manager |
---|
| 153 | * - per Manager Object Data |
---|
| 154 | * - Message Buffers |
---|
| 155 | * + Semaphore Manager |
---|
| 156 | * - per Manager Object Data |
---|
| 157 | * + Partition Manager |
---|
| 158 | * - per Manager Object Data |
---|
| 159 | * + Region Manager |
---|
| 160 | * - per Manager Object Data |
---|
| 161 | * + Dual Ported Memory Manager |
---|
| 162 | * - per Manager Object Data |
---|
| 163 | * + Rate Monotonic Manager |
---|
| 164 | * - per Manager Object Data |
---|
| 165 | * + Internal Threads Handler |
---|
| 166 | * - SYSI Thread TCB |
---|
| 167 | * - IDLE Thread TCB |
---|
| 168 | * - SYSI Thread stack |
---|
| 169 | * - SYSI Thread FP area (if CPU requires this) |
---|
| 170 | * - IDLE Thread stack |
---|
| 171 | * - IDLE Thread FP area (if CPU requires this) |
---|
| 172 | * |
---|
| 173 | * This does not take into account any CPU dependent alignment requirements. |
---|
| 174 | * |
---|
| 175 | * The following calculates the overhead needed by RTEMS from the |
---|
| 176 | * Workspace Area. |
---|
| 177 | */ |
---|
| 178 | sys_req = SYSTEM_TASKS + /* SYSI and IDLE */ |
---|
| 179 | NAME_PTR_SIZE + /* Task Overhead */ |
---|
| 180 | READYCHAINS_SIZE + /* Ready Chains */ |
---|
| 181 | NAME_PTR_SIZE + /* Timer Overhead */ |
---|
| 182 | NAME_PTR_SIZE + /* Semaphore Overhead */ |
---|
| 183 | NAME_PTR_SIZE + /* Message Queue Overhead */ |
---|
| 184 | NAME_PTR_SIZE + /* Region Overhead */ |
---|
| 185 | NAME_PTR_SIZE + /* Partition Overhead */ |
---|
| 186 | NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ |
---|
| 187 | NAME_PTR_SIZE + /* Rate Monotonic Overhead */ |
---|
| 188 | NAME_PTR_SIZE + /* Extension Overhead */ |
---|
| 189 | PER_NODE; /* Extra Gobject Table */ |
---|
| 190 | |
---|
| 191 | uninitialized = |
---|
| 192 | /*address.h*/ 0 + |
---|
| 193 | |
---|
[18c5378] | 194 | /*apiext.h*/ (sizeof _API_extensions_List) + |
---|
| 195 | |
---|
[ac7d5ef0] | 196 | /*asr.h*/ 0 + |
---|
| 197 | |
---|
| 198 | /*attr.h*/ 0 + |
---|
| 199 | |
---|
| 200 | /*bitfield.h*/ 0 + |
---|
| 201 | |
---|
| 202 | /*chain.h*/ 0 + |
---|
| 203 | |
---|
| 204 | /*clock.h*/ 0 + |
---|
| 205 | |
---|
| 206 | /*config.h*/ (sizeof _Configuration_Table) + |
---|
| 207 | (sizeof _Configuration_MP_table) + |
---|
| 208 | |
---|
| 209 | /*context.h*/ (sizeof _Context_Switch_necessary) + |
---|
| 210 | |
---|
| 211 | /*copyrt.h*/ 0 + |
---|
| 212 | |
---|
[3a4ae6c] | 213 | /*debug.h*/ (sizeof _Debug_Level) + |
---|
| 214 | |
---|
[ac7d5ef0] | 215 | /*dpmem.h*/ (sizeof _Dual_ported_memory_Information) + |
---|
| 216 | |
---|
[8c8a924] | 217 | /*event.h*/ (sizeof _Event_Sync_state) + |
---|
[ac7d5ef0] | 218 | |
---|
| 219 | /*eventmp.h*/ 0 + |
---|
| 220 | |
---|
| 221 | /*eventset.h*/ 0 + |
---|
| 222 | |
---|
| 223 | /*extension.h*/ (sizeof _Extension_Information) + |
---|
| 224 | |
---|
| 225 | /*fatal.h*/ 0 + |
---|
| 226 | |
---|
| 227 | /*heap.h*/ 0 + |
---|
| 228 | |
---|
| 229 | /*init.h*/ 0 + |
---|
| 230 | |
---|
[3a4ae6c] | 231 | /*interr.h*/ (sizeof Internal_errors_What_happened) + |
---|
| 232 | |
---|
[ac7d5ef0] | 233 | /*inthrdmp.h*/ 0 + |
---|
| 234 | |
---|
| 235 | /*intr.h*/ 0 + |
---|
| 236 | |
---|
[3a4ae6c] | 237 | /*intthrd.h*/ (sizeof _Internal_threads_Information) + |
---|
| 238 | (sizeof _Internal_threads_System_initialization_thread) + |
---|
[ac7d5ef0] | 239 | (sizeof _Internal_threads_Idle_thread) + |
---|
| 240 | |
---|
| 241 | /*io.h*/ (sizeof _IO_Number_of_drivers) + |
---|
| 242 | (sizeof _IO_Driver_address_table) + |
---|
[3a4ae6c] | 243 | (sizeof _IO_Number_of_devices) + |
---|
| 244 | (sizeof _IO_Driver_name_table) + |
---|
[ac7d5ef0] | 245 | |
---|
| 246 | /*isr.h*/ (sizeof _ISR_Nest_level) + |
---|
| 247 | (sizeof _ISR_Vector_table) + |
---|
| 248 | (sizeof _ISR_Signals_to_thread_executing) + |
---|
| 249 | |
---|
[4b374f36] | 250 | /*message.h*/ (sizeof _Message_queue_Information) + |
---|
[ac7d5ef0] | 251 | |
---|
| 252 | /*modes.h*/ 0 + |
---|
| 253 | |
---|
| 254 | /*mp.h*/ 0 + |
---|
| 255 | |
---|
| 256 | /*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) + |
---|
[3a4ae6c] | 257 | (sizeof _MPCI_Semaphore) + |
---|
| 258 | (sizeof _MPCI_table) + |
---|
| 259 | (sizeof _MPCI_Receive_server_tcb) + |
---|
| 260 | (sizeof _MPCI_Packet_processors) + |
---|
[ac7d5ef0] | 261 | |
---|
| 262 | /*mppkt.h*/ 0 + |
---|
| 263 | |
---|
| 264 | /*mptables.h*/ 0 + |
---|
| 265 | |
---|
| 266 | /*msgmp.h*/ 0 + |
---|
| 267 | |
---|
| 268 | /*object.h*/ (sizeof _Objects_Local_node) + |
---|
[3a4ae6c] | 269 | (sizeof _Objects_Maximum_nodes) + |
---|
| 270 | (sizeof _Objects_Information_table) + |
---|
[ac7d5ef0] | 271 | |
---|
[3a4ae6c] | 272 | /*objectmp.h*/ (sizeof _Objects_MP_Maximum_global_objects) + |
---|
| 273 | (sizeof _Objects_MP_Inactive_global_objects) + |
---|
[ac7d5ef0] | 274 | |
---|
| 275 | /*options.h*/ 0 + |
---|
| 276 | |
---|
| 277 | /*part.h*/ (sizeof _Partition_Information) + |
---|
| 278 | |
---|
| 279 | /*partmp.h*/ 0 + |
---|
| 280 | |
---|
| 281 | /*priority.h*/ (sizeof _Priority_Major_bit_map) + |
---|
| 282 | (sizeof _Priority_Bit_map) + |
---|
| 283 | |
---|
| 284 | /*ratemon.h*/ (sizeof _Rate_monotonic_Information) + |
---|
| 285 | |
---|
| 286 | /*region.h*/ (sizeof _Region_Information) + |
---|
| 287 | |
---|
| 288 | /*regionmp.h*/ 0 + |
---|
| 289 | |
---|
| 290 | /*rtems.h*/ /* Not applicable */ |
---|
| 291 | |
---|
| 292 | /*sem.h*/ (sizeof _Semaphore_Information) + |
---|
| 293 | |
---|
| 294 | /*semmp.h*/ 0 + |
---|
| 295 | |
---|
| 296 | /*signal.h*/ 0 + |
---|
| 297 | |
---|
| 298 | /*signalmp.h*/ 0 + |
---|
| 299 | |
---|
| 300 | /*stack.h*/ 0 + |
---|
| 301 | |
---|
| 302 | /*states.h*/ 0 + |
---|
| 303 | |
---|
| 304 | /*status.h*/ 0 + |
---|
| 305 | |
---|
[3a4ae6c] | 306 | /*sysstate.h*/ (sizeof _System_state_Is_multiprocessing) + |
---|
| 307 | (sizeof _System_state_Current) + |
---|
[ac7d5ef0] | 308 | |
---|
[3a4ae6c] | 309 | /*system.h*/ (sizeof _CPU_Table) + |
---|
[ac7d5ef0] | 310 | |
---|
| 311 | /*taskmp.h*/ 0 + |
---|
| 312 | |
---|
[5250ff39] | 313 | /*tasks.h*/ (sizeof _RTEMS_tasks_Information) + |
---|
[3a4ae6c] | 314 | (sizeof _RTEMS_tasks_User_initialization_tasks) + |
---|
| 315 | (sizeof _RTEMS_tasks_Number_of_initialization_tasks) + |
---|
[ac7d5ef0] | 316 | |
---|
[3a4ae6c] | 317 | /*thread.h*/ (sizeof _Thread_BSP_context) + |
---|
| 318 | (sizeof _Thread_Dispatch_disable_level) + |
---|
| 319 | (sizeof _Thread_Maximum_extensions) + |
---|
[ac7d5ef0] | 320 | (sizeof _Thread_Ticks_remaining_in_timeslice) + |
---|
| 321 | (sizeof _Thread_Ticks_per_timeslice) + |
---|
| 322 | (sizeof _Thread_Ready_chain) + |
---|
| 323 | (sizeof _Thread_Executing) + |
---|
| 324 | (sizeof _Thread_Heir) + |
---|
| 325 | (sizeof _Thread_Allocated_fp) + |
---|
| 326 | |
---|
| 327 | /*threadmp.h*/ (sizeof _Thread_MP_Receive) + |
---|
| 328 | (sizeof _Thread_MP_Active_proxies) + |
---|
| 329 | (sizeof _Thread_MP_Inactive_proxies) + |
---|
| 330 | |
---|
[3a4ae6c] | 331 | /*threadq.h*/ (sizeof _Thread_queue_Extract_table) + |
---|
[ac7d5ef0] | 332 | |
---|
| 333 | /*timer.h*/ (sizeof _Timer_Information) + |
---|
| 334 | |
---|
| 335 | /*tod.h*/ (sizeof _TOD_Current) + |
---|
| 336 | (sizeof _TOD_Seconds_since_epoch) + |
---|
| 337 | (sizeof _TOD_Ticks_since_boot) + |
---|
| 338 | (sizeof _TOD_Microseconds_per_tick) + |
---|
| 339 | (sizeof _TOD_Ticks_per_second) + |
---|
| 340 | (sizeof _TOD_Seconds_watchdog) + |
---|
| 341 | |
---|
| 342 | /*tqdata.h*/ 0 + |
---|
| 343 | |
---|
| 344 | /*types.h*/ 0 + |
---|
| 345 | |
---|
| 346 | /*userext.h*/ (sizeof _User_extensions_Initial) + |
---|
| 347 | (sizeof _User_extensions_List) + |
---|
| 348 | |
---|
[3a4ae6c] | 349 | /*watchdog.h*/ (sizeof _Watchdog_Sync_level) + |
---|
[88d594a] | 350 | (sizeof _Watchdog_Sync_count) + |
---|
[3a4ae6c] | 351 | (sizeof _Watchdog_Ticks_chain) + |
---|
| 352 | (sizeof _Watchdog_Seconds_chain) + |
---|
[ac7d5ef0] | 353 | |
---|
| 354 | /*wkspace.h*/ (sizeof _Workspace_Area); |
---|
| 355 | |
---|
| 356 | uninitialized = 0; |
---|
| 357 | |
---|
[c4808ca] | 358 | #ifndef unix /* make sure this is not a native compile */ |
---|
| 359 | |
---|
[ac7d5ef0] | 360 | #ifdef i386 |
---|
| 361 | |
---|
| 362 | /* cpu.h */ |
---|
| 363 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
| 364 | (sizeof _CPU_Interrupt_stack_low) + |
---|
| 365 | (sizeof _CPU_Interrupt_stack_high); |
---|
| 366 | |
---|
| 367 | #endif |
---|
| 368 | |
---|
| 369 | #ifdef i960 |
---|
| 370 | |
---|
| 371 | /* cpu.h */ |
---|
| 372 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
| 373 | (sizeof _CPU_Interrupt_stack_high); |
---|
| 374 | |
---|
| 375 | #endif |
---|
| 376 | |
---|
| 377 | #ifdef hppa1_1 |
---|
| 378 | |
---|
| 379 | /* cpu.h */ |
---|
| 380 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
[6b782ab] | 381 | #ifndef RTEMS_UNIX |
---|
[ac7d5ef0] | 382 | (sizeof _CPU_Default_gr27) + |
---|
[6b782ab] | 383 | #endif |
---|
[ac7d5ef0] | 384 | (sizeof _CPU_Interrupt_stack_low) + |
---|
| 385 | (sizeof _CPU_Interrupt_stack_high); |
---|
| 386 | #endif |
---|
| 387 | |
---|
| 388 | #ifdef m68k |
---|
| 389 | |
---|
| 390 | /* cpu.h */ |
---|
| 391 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
| 392 | (sizeof _CPU_Interrupt_stack_high); |
---|
| 393 | |
---|
| 394 | #endif |
---|
| 395 | |
---|
[9700578] | 396 | #ifdef sparc |
---|
| 397 | |
---|
| 398 | /* cpu.h */ |
---|
| 399 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
| 400 | (sizeof _CPU_Interrupt_stack_high) + |
---|
| 401 | (sizeof _CPU_Null_fp_context) + |
---|
| 402 | (sizeof _CPU_Trap_Table_area); |
---|
| 403 | |
---|
| 404 | #ifdef erc32 |
---|
| 405 | uninitialized += (sizeof _ERC32_MEC_Timer_Control_Mirror); |
---|
| 406 | #endif |
---|
| 407 | |
---|
| 408 | |
---|
| 409 | #endif |
---|
| 410 | |
---|
| 411 | |
---|
[ac7d5ef0] | 412 | #ifdef no_cpu |
---|
| 413 | |
---|
| 414 | /* cpu.h */ |
---|
| 415 | uninitialized += (sizeof _CPU_Null_fp_context) + |
---|
| 416 | (sizeof _CPU_Interrupt_stack_low) + |
---|
| 417 | (sizeof _CPU_Interrupt_stack_high) + |
---|
| 418 | (sizeof _CPU_Thread_dispatch_pointer); |
---|
| 419 | |
---|
| 420 | #endif |
---|
| 421 | |
---|
[3a4ae6c] | 422 | #ifdef ppc |
---|
| 423 | |
---|
| 424 | /* cpu.h */ |
---|
| 425 | uninitialized += (sizeof _CPU_Interrupt_stack_low) + |
---|
| 426 | (sizeof _CPU_Interrupt_stack_high) + |
---|
| 427 | (sizeof _CPU_IRQ_info); |
---|
| 428 | |
---|
| 429 | #endif |
---|
[c4808ca] | 430 | #endif /* !unix */ |
---|
[3a4ae6c] | 431 | |
---|
[ac7d5ef0] | 432 | initialized += |
---|
| 433 | /*copyrt.h*/ (strlen(_Copyright_Notice)+1) + |
---|
| 434 | |
---|
[3a4ae6c] | 435 | /*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) + |
---|
[ac7d5ef0] | 436 | (strlen(_RTEMS_version)+1) + |
---|
| 437 | (sizeof _Entry_points) + |
---|
| 438 | |
---|
| 439 | |
---|
| 440 | /*tod.h*/ (sizeof _TOD_Days_per_month) + |
---|
| 441 | (sizeof _TOD_Days_to_date) + |
---|
| 442 | (sizeof _TOD_Days_since_last_leap_year); |
---|
| 443 | |
---|
[c4808ca] | 444 | #ifndef unix /* make sure this is not native */ |
---|
[9700578] | 445 | #ifdef sparc |
---|
| 446 | |
---|
| 447 | initialized += (sizeof _CPU_Trap_slot_template); |
---|
| 448 | |
---|
| 449 | #endif |
---|
[c4808ca] | 450 | #endif /* !unix */ |
---|
[9700578] | 451 | |
---|
[ac7d5ef0] | 452 | puts( "" ); |
---|
[9700578] | 453 | |
---|
[ac7d5ef0] | 454 | if ( mode == 0 ) help_size(); |
---|
| 455 | else print_formula(); |
---|
| 456 | |
---|
| 457 | printf( "\n" ); |
---|
| 458 | printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); |
---|
| 459 | printf( "RTEMS intialized data consumes %d bytes\n", initialized ); |
---|
| 460 | |
---|
| 461 | } |
---|
| 462 | |
---|
| 463 | void help_size() |
---|
| 464 | { |
---|
| 465 | int c = '\0'; |
---|
| 466 | int break_loop; |
---|
| 467 | int total_size; |
---|
| 468 | int task_stacks; |
---|
| 469 | int interrupt_stack; |
---|
| 470 | int maximum_tasks, size_tasks; |
---|
| 471 | int maximum_sems, size_sems; |
---|
| 472 | int maximum_timers, size_timers; |
---|
| 473 | int maximum_msgqs, size_msgqs; |
---|
[4b374f36] | 474 | int maximum_msgs, size_msgs_overhead; |
---|
[ac7d5ef0] | 475 | int maximum_regns, size_regns; |
---|
| 476 | int maximum_parts, size_parts; |
---|
| 477 | int maximum_ports, size_ports; |
---|
| 478 | int maximum_periods, size_periods; |
---|
| 479 | int maximum_extensions, size_extensions; |
---|
| 480 | int maximum_drvs, size_drvs; |
---|
| 481 | int maximum_fps, size_fps; |
---|
| 482 | int maximum_nodes, size_nodes; |
---|
| 483 | int maximum_gobjs, size_gobjs; |
---|
| 484 | int maximum_proxies, size_proxies; |
---|
| 485 | |
---|
| 486 | total_size = sys_req; /* Fixed Overhead */ |
---|
| 487 | printf( "What is maximum_tasks? " ); |
---|
| 488 | maximum_tasks = getint(); |
---|
| 489 | size_tasks = PER_TASK * maximum_tasks; |
---|
| 490 | total_size += size_tasks; |
---|
| 491 | |
---|
| 492 | printf( "What is maximum_semaphores? " ); |
---|
| 493 | maximum_sems = getint(); |
---|
| 494 | size_sems = PER_SEMAPHORE * maximum_sems; |
---|
| 495 | total_size += size_sems; |
---|
| 496 | |
---|
| 497 | printf( "What is maximum_timers? " ); |
---|
| 498 | maximum_timers = getint(); |
---|
| 499 | size_timers = PER_TIMER * maximum_timers; |
---|
| 500 | total_size += size_timers; |
---|
| 501 | |
---|
| 502 | printf( "What is maximum_message_queues? " ); |
---|
| 503 | maximum_msgqs = getint(); |
---|
| 504 | size_msgqs = PER_MSGQ * maximum_msgqs; |
---|
| 505 | total_size += size_msgqs; |
---|
| 506 | |
---|
[3652ad35] | 507 | printf( "What is maximum_messages? XXXX " ); |
---|
[ac7d5ef0] | 508 | maximum_msgs = getint(); |
---|
[3652ad35] | 509 | size_msgs_overhead = 0; |
---|
[4b374f36] | 510 | total_size += size_msgs_overhead; |
---|
[ac7d5ef0] | 511 | |
---|
| 512 | printf( "What is maximum_regions? " ); |
---|
| 513 | maximum_regns = getint(); |
---|
| 514 | size_regns = PER_REGN * maximum_regns; |
---|
| 515 | total_size += size_regns; |
---|
| 516 | |
---|
| 517 | printf( "What is maximum_partitions? " ); |
---|
| 518 | maximum_parts = getint(); |
---|
| 519 | size_parts = PER_PART * maximum_parts; |
---|
| 520 | total_size += size_parts; |
---|
| 521 | |
---|
| 522 | printf( "What is maximum_ports? " ); |
---|
| 523 | maximum_ports = getint(); |
---|
| 524 | size_ports = PER_PORT * maximum_ports; |
---|
| 525 | total_size += size_ports; |
---|
| 526 | |
---|
| 527 | printf( "What is maximum_periods? " ); |
---|
| 528 | maximum_periods = getint(); |
---|
| 529 | size_periods = PER_PORT * maximum_periods; |
---|
| 530 | total_size += size_periods; |
---|
| 531 | |
---|
| 532 | printf( "What is maximum_extensions? " ); |
---|
| 533 | maximum_extensions = getint(); |
---|
| 534 | size_extensions = PER_EXTENSION * maximum_extensions; |
---|
| 535 | total_size += size_extensions; |
---|
| 536 | |
---|
| 537 | printf( "What is number_of_device_drivers? " ); |
---|
| 538 | maximum_drvs = getint(); |
---|
| 539 | size_drvs = PER_DRV * maximum_drvs; |
---|
| 540 | total_size += size_drvs; |
---|
| 541 | |
---|
| 542 | printf( "What will be total stack requirement for all tasks? " ); |
---|
| 543 | task_stacks = getint(); |
---|
| 544 | total_size += task_stacks; |
---|
| 545 | |
---|
| 546 | printf( "What is the size of the interrupt stack? " ); |
---|
| 547 | interrupt_stack = getint(); |
---|
| 548 | total_size += interrupt_stack; |
---|
| 549 | |
---|
| 550 | printf( "How many tasks will be created with the FP flag? " ); |
---|
| 551 | maximum_fps = getint(); |
---|
| 552 | size_fps = PER_FPTASK * maximum_fps; |
---|
| 553 | total_size += size_fps; |
---|
| 554 | |
---|
| 555 | printf( "Is this a single processor system? " ); |
---|
| 556 | for ( break_loop=0 ; !break_loop; c = getchar() ) { |
---|
| 557 | switch ( c ) { |
---|
| 558 | case 'Y': case 'y': |
---|
| 559 | case 'N': case 'n': |
---|
| 560 | break_loop = 1; |
---|
| 561 | break; |
---|
| 562 | } |
---|
| 563 | } |
---|
| 564 | printf( "%c\n", c ); |
---|
| 565 | if ( c == 'n' || c == 'N' ) { |
---|
| 566 | printf( "What is maximum_nodes? " ); |
---|
| 567 | maximum_nodes = getint(); |
---|
| 568 | size_nodes = PER_NODE * maximum_nodes; |
---|
| 569 | total_size += size_nodes; |
---|
| 570 | printf( "What is maximum_global_objects? " ); |
---|
| 571 | maximum_gobjs = getint(); |
---|
| 572 | size_gobjs = PER_GOBJECT * maximum_gobjs; |
---|
| 573 | total_size += size_gobjs; |
---|
| 574 | printf( "What is maximum_proxies? " ); |
---|
| 575 | maximum_proxies = getint(); |
---|
| 576 | size_proxies = PER_PROXY * maximum_proxies; |
---|
| 577 | total_size += size_proxies; |
---|
| 578 | } else { |
---|
| 579 | maximum_nodes = 0; |
---|
| 580 | size_nodes = PER_NODE * 0; |
---|
| 581 | maximum_gobjs = 0; |
---|
| 582 | size_gobjs = PER_GOBJECT * 0; |
---|
| 583 | maximum_proxies = 0; |
---|
| 584 | size_proxies = PER_PROXY * 0; |
---|
| 585 | } |
---|
| 586 | |
---|
| 587 | printf( "\n\n" ); |
---|
| 588 | printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); |
---|
| 589 | printf( " Tasks - %03d * %03d = %d\n", |
---|
| 590 | maximum_tasks, PER_TASK, size_tasks ); |
---|
| 591 | printf( " Semaphores - %03d * %03d = %d\n", |
---|
| 592 | maximum_sems, PER_SEMAPHORE, size_sems ); |
---|
| 593 | printf( " Timers - %03d * %03d = %d\n", |
---|
| 594 | maximum_timers, PER_TIMER, size_timers ); |
---|
| 595 | printf( " Msg Queues - %03d * %03d = %d\n", |
---|
| 596 | maximum_msgqs, PER_MSGQ, size_msgqs ); |
---|
[4b374f36] | 597 | printf( " Messages Overhead - %03d * %03d = %d\n", |
---|
[3652ad35] | 598 | maximum_msgs, 0 /* PER_MSG_OVERHEAD */, size_msgs_overhead ); |
---|
[ac7d5ef0] | 599 | printf( " Regions - %03d * %03d = %d\n", |
---|
| 600 | maximum_regns, PER_REGN, size_regns); |
---|
| 601 | printf( " Partitions - %03d * %03d = %d\n", |
---|
| 602 | maximum_parts, PER_PART, size_parts ); |
---|
| 603 | printf( " Periods - %03d * %03d = %d\n", |
---|
| 604 | maximum_periods, PER_PERIOD, size_periods ); |
---|
| 605 | printf( " Extensions - %03d * %03d = %d\n", |
---|
| 606 | maximum_extensions, PER_EXTENSION, size_extensions ); |
---|
| 607 | printf( " Device Drivers - %03d * %03d = %d\n", |
---|
| 608 | maximum_drvs, PER_DRV, size_drvs ); |
---|
| 609 | |
---|
| 610 | printf( " System Requirements - %04d = %d\n", |
---|
| 611 | sys_req, sys_req ); |
---|
| 612 | |
---|
| 613 | printf( " Floating Point Tasks - %03d * %03d = %d\n", |
---|
| 614 | maximum_fps, PER_FPTASK, size_fps ); |
---|
| 615 | printf( " Application Task Stacks - = %d\n", |
---|
| 616 | task_stacks ); |
---|
| 617 | printf( " Interrupt Stacks - = %d\n", |
---|
| 618 | task_stacks ); |
---|
| 619 | printf( " \n" ); |
---|
| 620 | printf( " Global object tables - %03d * %03d = %d\n", |
---|
| 621 | maximum_nodes, PER_NODE, size_nodes ); |
---|
| 622 | printf( " Global objects - %03d * %03d = %d\n", |
---|
| 623 | maximum_gobjs, PER_GOBJECT, size_gobjs ); |
---|
| 624 | printf( " Proxies - %03d * %03d = %d\n", |
---|
| 625 | maximum_proxies, PER_PROXY, size_proxies ); |
---|
| 626 | printf( "\n\n" ); |
---|
| 627 | printf( " TOTAL = %d bytes\n", |
---|
| 628 | total_size ); |
---|
| 629 | } |
---|
| 630 | |
---|
| 631 | void print_formula() |
---|
| 632 | { |
---|
| 633 | printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); |
---|
| 634 | printf( " Tasks - maximum_tasks * %d\n", PER_TASK ); |
---|
| 635 | printf( " Timers - maximum_timers * %d\n", PER_TIMER ); |
---|
| 636 | printf( " Semaphores - maximum_semaphores * %d\n", PER_SEMAPHORE); |
---|
| 637 | printf( " Message Queues - maximum_message_queues * %d\n", PER_MSGQ ); |
---|
[4b374f36] | 638 | printf( " Messages -\n"); |
---|
[ac7d5ef0] | 639 | printf( " Regions - maximum_regions * %d\n", PER_REGN ); |
---|
| 640 | printf( " Partitions - maximum_partitions * %d\n", PER_PART ); |
---|
| 641 | printf( " Ports - maximum_ports * %d\n", PER_PORT ); |
---|
| 642 | printf( " Periods - maximum_periods * %d\n", PER_PORT ); |
---|
| 643 | printf( " Extensions - maximum_extensions * %d\n", PER_EXTENSION ); |
---|
| 644 | printf( " Device Drivers - number_of_device_drivers * %d\n", PER_DRV); |
---|
| 645 | printf( " System Requirements - %d\n", sys_req ); |
---|
| 646 | printf( " Floating Point Tasks - FPMASK Tasks * %d\n", CONTEXT_FP_SIZE ); |
---|
| 647 | printf( " User's Tasks' Stacks -\n" ); |
---|
| 648 | printf( " Interrupt Stack -\n" ); |
---|
| 649 | printf( " \n" ); |
---|
| 650 | printf( " Global object tables - maximum_nodes * %d\n", PER_NODE ); |
---|
| 651 | printf( " Global objects - maximum_global_objects * %d\n", PER_GOBJECT ); |
---|
| 652 | printf( " Proxies - maximum_proxies * %d\n", PER_PROXY ); |
---|
| 653 | } |
---|