EXAMPLE RAM USAGE:
==============================================================================
The following is detailed RAM usage analysis for the example XMK project:
    projects/win32/cross/xmk/h8300/edk38024/standalone/kernel/simple

XMK Configuration Options: 
    USE_XMK_CORE_KERNEL - Minimal Kernel Services only

Platform:
    H8/300L using Hitachi's HEW2 Tiny C/C++ compiler

Summary Memory Usage:
    Kernel ROM:= 336 bytes (with no interrupts service routines)
    Kernel RAM:=  18 bytes (amount with ZERO application threads)


PARAMETERS
------------------------------------------------------------------------------
Name   Description   
----   ----------    
Sa     APP: Amount of stack needed for application threads
Sia    APP: Maximum stack usage of the Application's individual ISR routines
Ni     APP: Number of levels of nested interrupts (for no-nesting, set to 1)
Si     APP: Total stack overhead to support all ISRs (includes XMK overhead)

Sda    APP: Amount of memory needed for the application's boot-up/main()
Sd     APP: Total stack memory needed for the boot-up/idle thread.
St     APP: Total stack memory for an application thread

K      XMK: Amount of RAM needed by the scheduler/kernel with 0 threads.
TCB    XMK: Thread-control-block 
Sx     XMK: Minimum application stack memory required by XMK for context 
            switching.
Sxi    XMK: Idle thread stack memory required by XMK for context switching.
Sil    XMK: Amount of stack memory required for a single 'level' of interrupt 
            processing.
Sik    XMK: Amount ofadditional kernel overhead per 'level' of interrupt
            processing.


EXAMPLE: H8/300L platform with only 1 level of interrupts (no nested IRQs)
------------------------------------------------------------------------------

Name   Size (in bytes)                  H8/300L
----   ---------------                  ------
Sa     <application dependent>          40
Sia    <application dependent>          10
Ni     non-nested interrupts            1 
Sik    See palkrn.h file                4
Sil    <RetAddr+PSW+VolatileGPRegs>     8       // 2+2+(2*2)
Si     (Sik+Sia)*Ni + Sil+(Ni-1)        14      // (4+10)*1 + 8*0

Sda    <application dependent>          4
Sxi    Sil                              8
Sd     max(Sxi,Sda)                     8       // max(8,4)

TCB    sizeof(stackptr) + 1             3
K      7 (is 8 if nested irqs)          7
Sx     Sil + <non volatileGPRegisters>  18      // 8 + 5*2

St     Sx+Sa                            58      // 18+40             

Total Kernel =  K+Sd+(TCB)*(N+1) = 18+(3*N)
                where N is the number of application threads

For N=3, Ni=1, and only one ISR 

    RAM
        Kernel                  = 18+(3*3) 
                                = 27
        Application Stacks      = (58)*3
                                = 174
        Interrupts Stack        = 14
                                -----------
        Total                   = 27 + 174 + 14
                                = 215

    ROM:
        Base Kernel             = 336
        Additional per ISR      = 34 * 1   
                                = 34
                                ---------------
        Total                   = 336 + 34 
                                = 370
