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.
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
|
Size Calculation Method (in bytes)
|
|
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
|
|
|
|
4 * VTMAX_SEM + down ( VTMAX_SEM / 8 + 1)
However, when VTMAX_SEM is 0, the size of the semaphore control block is 0.
|
|
8 * VTMAX_FLG + 2 * down ( VTMAX_FLG / 8 + 1)
However, when VTMAX_FLG is 0, the size of the eventflag control block is 0.
|
|
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.
|
|
8 * VTMAX_MBX + 2 * down ( VTMAX_MBX / 8 + 1)
However, when VTMAX_MBX is 0, the size of the mailbox control block is 0.
|
|
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
|
|
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
|
|
Cyclic handler control block
|
|
Alarm handler control block
|
|
|
|
|
|
|
1592 + 8 ( VTMAX_TSK + 1 )
|
Note Each keyword in the size calculation methods has the following meaning.
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.
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.
message_buffer[].mbf_size
( memorypool[].siz_block * memorypool[].num_block)
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.
The system stack area is located in the SI section.