20.23 RAM Capacity Estimation
Memory areas used and managed by the RI600PX are broadly classified into four types of sections.

- BRI_RAM section: The RI600PX's management data, data queue area created by the system configuration file, message buffer area created by the system configuration file without specifying section

- RRI_RAM section: The RI600PX's management data (when dynamic creation function is used)

- BURI_HEAP section: Fixed-sized memory pool area and variable-sized memory pool area created by the system configuration file without specifying section

- SURI_STACK section: User stack area of tasks created by the system configuration file without specifying section

- SI section: System stack area

20.23.1 BRI_RAM and RRI_RAM section

The RI600PX's management data is located in the BRI_RAM and RRI_RAM section.

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

Table 20-11 BRI_RAM and RRI_RAM Section Size Calculation Method

Object Name

Section

Size Calculation Method (in bytes)

System control block

BRI_RAM

28 + 4down( ( TMAX_TPRI - 1) / 32 + 1) + TMAX_TPRI

+ VTMAX_SEM + 2VTMAX_DTQ + VTMAX_FLG + VTMAX_MBX

+ VTMAX_MTX + 2VTMAX_MBF + VTMAX_MPF + VTMAX_MPL

+ 57VTMAX_DOMAIN

RRI_RAM1

4 + VTMAX_SEM + 2VTMAX_DTQ + VTMAX_FLG + VTMAX_MBX

+ VTMAX_MTX + 2VTMAX_MBF + VTMAX_MPF + VTMAX_MPL

Task control block

BRI_RAM

28VTMAX_TSK

RRI_RAM2

24VTMAX_TSK

Semaphore control block3

BRI_RAM

4VTMAX_SEM + down ( VTMAX_SEM / 8 + 1)

RRI_RAM4

4VTMAX_SEM

Eventflag control block5

BRI_RAM

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

RRI_RAM6

4VTMAX_FLG

Data queue control block7

BRI_RAM

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

RRI_RAM8

8VTMAX_DTQ

Mailbox control block9

BRI_RAM

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

RRI_RAM10

VTMAX_MBX

Mutex control block11

BRI_RAM

VTMAX_MTX + down ( VTMAX_MTX / 8 + 1)

RRI_RAM12

VTMAX_MTX

Message buffer control block13

BRI_RAM

16VTMAX_MBF + MBF_ALLSIZE

RRI_RAM14

8VTMAX_MBF

Fixed-sized memory pool control block15

BRI_RAM

8VTMAX_MPF + down ( VTMAX_MPF / 8 + 1)

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

RRI_RAM16

12VTMAX_MPF

Variable-sized memory pool control block17

BRI_RAM

36VTMAX_MPL

RRI_RAM18

20VTMAX_MPL

Cyclic handler control block19

BRI_RAM

8VTMAX_CYH

RRI_RAM20

20VTMAX_CYH

Alarm handler control block21

BRI_RAM

8VTMAX_ALH

RRI_RAM22

8VTMAX_ALH

2
This area is generated only when Maximum task ID (max_task) is defined.



3
This area is not generated when VTMAX_SEM is 0.



4
This area is generated only when Maximum semaphore ID (max_sem) is defined.



5
This area is not generated when VTMAX_FLG is 0.



6
This area is generated only when Maximum eventflag ID (max_flag) is defined.



7
This area is not generated when VTMAX_DTQ is 0.



8
This area is generated only when Maximum data queue ID (max_dtq) is defined.



9
This area is not generated when VTMAX_MBX is 0.



10
This area is generated only when Maximum mailbox ID (max_mbx) is defined.



11
This area is not generated when VTMAX_MTX is 0.



12
This area is generated only when Maximum mutex ID (max_mtx) is defined.



13
This area is not generated when VTMAX_MBF is 0.



14
This area is generated only when Maximum message buffer ID (max_mbf) is defined.



15
This area is not generated when VTMAX_MPF is 0.



16
This area is generated only when Maximum fixed-sized memory pool ID (max_mpf) is defined.



17
This area is not generated when VTMAX_MPL is 0.



18
This area is generated only when Maximum variable-sized memory pool ID (max_mpl) is defined.



19
This area is not generated when VTMAX_CYH is 0.



20
This area is generated only when Maximum cyclic handler ID (max_cyh) is defined.



21
This area is not generated when VTMAX_ALH is 0.



22
This area is generated only when Maximum alarm handler ID (max_alh) is defined.





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

TMAX_TPRI: The TMAX_TPRI represents maximum task priority.
The cfg600px outputs the macro TMAX_TPRI which defines the value set as Maximum task priority (priority) in System Information (system) to the system information header file kernel_id.h.


VTMAX_TSK: The VTMAX_TSK represents the maximum task ID.
The cfg600px outputs the macro of VTMAX_TSK to the system information header file kernel_id.h. For details, refer to "Maximum task ID (max_task)".


VTMAX_SEM: The VTMAX_SEM represents the maximum semaphore ID.
The cfg600px outputs the macro of VTMAX_SEM to the system information header file kernel_id.h. For details, refer to "Maximum semaphore ID (max_sem)".


VTMAX_FLG: The VTMAX_FLG represents the maximum eventflag ID.
The cfg600px outputs the macro of VTMAX_FLG to the system information header file kernel_id.h. For details, refer to "Maximum eventflag ID (max_flag)".


VTMAX_DTQ: The VTMAX_DTQ represents the maximum data queue ID.
The cfg600px outputs the macro of VTMAX_DTQ to the system information header file kernel_id.h. For details, refer to "Maximum data queue ID (max_dtq)".


DTQ_ALLSIZE: Total of size of data queue area created in the system configuration file. 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 VTMAX_MBX represents the maximum mailbox ID.
The cfg600px outputs the macro of VTMAX_MBX to the system information header file kernel_id.h. For details, refer to "Maximum mailbox ID (max_mbx)".


VTMAX_MTX: The VTMAX_MTX represents the maximum mutex ID.
The cfg600px outputs the macro of VTMAX_MTX to the system information header file kernel_id.h. For details, refer to "Maximum mutex ID (max_mtx)".


VTMAX_MBF: The VTMAX_MBF represents the maximum message buffer ID.
The cfg600px outputs the macro of VTMAX_MBF to the system information header file kernel_id.h. For details, refer to "Maximum message buffer ID (max_mbf)".


MBF_ALLSIZE: Total of size of message buffer area created in the system configuration file without specifying "mbf_section". Concretely, it is calculated by the following expressions.
message_buffer[].mbf_size * 4


VTMAX_MPF: The VTMAX_MPF represents the maximum fixed-sized memory pool ID.
The cfg600px outputs the macro of VTMAX_MPF to the system information header file kernel_id.h. For details, refer to "Maximum fixed-sized memory pool ID (max_mpf)".


VTMAX_MPL: The VTMAX_MPL represents the maximum variable-sized memory pool ID.
The cfg600px outputs the macro of VTMAX_MPL to the system information header file kernel_id.h. For details, refer to "Maximum variable-sized memory pool ID (max_mpl)".


VTMAX_CYH: The VTMAX_CYH represents the maximum cyclic handler ID.
The cfg600px outputs the macro of VTMAX_CYH to the system information header file kernel_id.h. For details, refer to "Maximum cyclic handler ID (max_cyh)".


VTMAX_ALH: The VTMAX_ALH represents the maximum alarm handler ID.
The cfg600px outputs the macro of VTMAX_ALH to the system information header file kernel_id.h. For details, refer to "Maximum alarm handler ID (max_alh)".


VTMAX_DOMAIN: The VTMAX_DOMAIN represents the maximum domain ID.
The cfg600px outputs the macro of VTMAX_DOMAIN to the system information header file kernel_id.h. For details, refer to "Maximum domain ID (max_domain)".


20.23.2 BURI_HEAP section

The fixed-sized memory pool area and variable-sized memory pool area are located in the BURI_HEAP section. Note, when a 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 BURI_HEAP section is calculated by the total of following. In addition, when user specific data is generated in the BURI_HEAP section, the size should be added.

- 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

20.23.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. In addition, when user specific data is generated in the SURI_STACK section, the size should be added.

task[].stack_size

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

20.23.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".