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