19.20 RAM Capacity Estimation
Memory areas used and managed by the RI600V4 are broadly classified into six types of sections. Subsequent paragraphs explain BRI_RAM, BURI_HEAP, SURI_STACK and SI section.

- BRI_RAM section: The RI600V4's management data and data queue area.

- BRI_HEAP section: Default section for message buffer area, fixed-sized memory pool area and variable-sized memory pool area.

- SURI_STACK section: Default section for user stack area

- SI section: System stack area

- RRI_RAM section: The RI600V4's management data. The size is 4 bytes.

- BRI_TRCBUF section: This section is generated only when "Taking in trace chart by software trace mode" and "Kernel buffer" are selected in [ Task Analyzer ] tab. The size is specified in [ Task Analyzer ] tab.

19.20.1 BRI_RAM section

The RI600V4's management data is located in the BRI_RAM section.

The Table 19-11 shows the size calculation method for the BRI_RAM section (unit: bytes). In addition, actual size may become larger than the value computed by Table 19-11 for boundary adjustment.

Table 19-11 BRI_RAM Section Size Calculation Method

Object Name

Size Calculation Method (in bytes)

System control block

36 + 4 * down( TMAX_TPRI - 1) / 32 + 1) + TMAX_TPRI + VTMAX_SEM + 2 * VTMAX_DTQ + VTMAX_FLG + VTMAX_MBX + VTMAX_MTX + 2 * VTMAX_MBF + VTMAX_MPF + VTMAX_MPL

Task control block

24 * VTMAX_TSK

Semaphore control block

4 * VTMAX_SEM + down ( VTMAX_SEM / 8 + 1)

However, when VTMAX_SEM is 0, the size of the semaphore control block is 0.

Eventflag control block

8 * VTMAX_FLG + 2 * down ( VTMAX_FLG / 8 + 1)

However, when VTMAX_FLG is 0, the size of the eventflag control block is 0.

Data queue control block

6 * VTMAX_DTQ + down ( VTMAX_DTQ / 8 + 1) + DTQ_ALLSIZE

However, when VTMAX_DTQ is 0, the size of the data queue control block is 0.

Mailbox control block

8 * VTMAX_MBX + 2 * down ( VTMAX_MBX / 8 + 1)

However, when VTMAX_MBX is 0, the size of the mailbox control block is 0.

Mutex control block

VTMAX_MTX + down ( VTMAX_MTX / 8 + 1)

However, when VTMAX_MTX is 0, the size of the mutex control block is 0.

Message buffer control block

16 * VTMAX_MBF

Fixed-sized memory pool control block

8 * VTMAX_MPF + 2 * down ( VTMAX_MPF / 8 + 1)

+ (down( memorypool[].num_block / 8 + 1) )

However, when VTMAX_MPF is 0, the size of the fixed-sized memory pool control block is 0.

Variable-sized memory pool control block

208 * VTMAX_MPL

Cyclic handler control block

8 * VTMAX_CYH

Alarm handler control block

8 * VTMAX_ALH

"Taking in trace chart by hardware trace mode" is selected in [ Task Analyzer ] tab

4

"Taking in trace chart by software trace mode" is selected in [ Task Analyzer ] tab

28

"Taking in long-statistics by software trace mode" is selected in [ Task Analyzer ] tab

1592 + 8 ( VTMAX_TSK + 1 )



Note Each keyword in the size calculation methods has the following meaning.

TMAX_TPRI: The set value of Maximum task priority (priority) in System Information (system).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_TSK: The number of Task Information (task[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_SEM: The number of Semaphore Information (semaphore[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_FLG: The number of Eventflag Information (flag[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_DTQ: The number of Data Queue Information (dataqueue[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


DTQ_ALLSIZE: Total of size of data queue area. Concretely, it is calculated by the following expressions.
dataqueue[].buffer_size * 4
Note, DTQ_ALLSIZE is 4 when this calculation result is 0.



VTMAX_MBX: The number of Mailbox Information (mailbox[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_MTX: The number of Mutex Information (mutex[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_MBF: The number of Message Buffer Information (message_buffer[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_MPF: The number of Fixed-sized Memory Pool Information (memorypool[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_MPL: The number of Variable-sized Memory Pool Information (variable_memorypool[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_CYH: The number of Cyclic Handler Information (cyclic_hand[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


VTMAX_ALH: The number of Alarm Handler Information (alarm_handl[]).
The cfg600 outputs the macro of this name to the system information header file kernel_id.h.


19.20.2 BRI_HEAP section

The message buffer area, fixed-sized memory pool area and variable-sized memory pool area are located in the BRI_HEAP section. Note, when a message buffer, fixed-sized memory pool and variable-sized memory pool are defined, the area can be located into the user-specific section.

The size of the BRI_HEAP section is calculated by the total of following.

- Total size of message buffer area
This is calculated about the definition of Message Buffer Information (message_buffer[]) that omits to specify "mbf_section" by the following expressions.


message_buffer[].mbf_size

- Total size of fixed-sized memory pool area
This is calculated about the definition of Fixed-sized Memory Pool Information (memorypool[]) that omits to specify "section" by the following expressions.


( memorypool[].siz_block * memorypool[].num_block)

- Total size of variable-sized memory pool area
This is calculated about the definition of Variable-sized Memory Pool Information (variable_memorypool[]) that omits to specify "mpl_section" by the following expressions.


variable_memorypool[].heap_size

19.20.3 SURI_STACK section

The user stack area is located in the SURI_STACK section. Note, when a task is defined, the user stack area can be located into the user-specific section.

The size of the SURI_STACK section is calculated about the definition of Task Information (task[]) that omits to specify "stack_section" by the following expressions.

task[].stack_size

Note For estimation of stack size, refer to "APPENDIX D STACK SIZE ESTIMATION".

19.20.4 SI section

The system stack area is located in the SI section.

The system stack size is the same as a set value for System stack size (stack_size) in System Information (system).

Note For estimation of stack size, refer to "APPENDIX D STACK SIZE ESTIMATION".