APPENDIX B SIZE OF MEMORY


This appendix explains the size of the memory area.

B.1 Description

The memory areas used and managed by the RI850V4 are divided into eight sections by use.

Table B-1 Memory Area

Section Name

Outline

.kernel_system

Area where executable code of RI850V4 is allocated.

.kernel_const

Area where static data of RI850V4 is allocated.

.kernel_data

Area where dynamic data of RI850V4 is allocated.

.kernel_data_init

Area where kernel initialization flag of RI850V4 is allocated.

.kernel_const_trace.const

Area where static data of trace function is allocated.

.kernel_data_trace.bss

Area where dynamic data of trace function is allocated.

.kernel_work

Area where system stack, task stack, data queue, fixed-sized memory pool and variable-sized memory pool is allocated.

.sec_namuser-defined area

Area where task stack, data queue, fixed-sized memory pool or variable-sized memory pool is allocated.



B.1.1 .kernel_system

The size of ".kernel_system" section depends on the trace mode and the kernel library used.

There are four types of kernel library as follows.

- CC-RH version, not supporting the FPU

- CC-RH version, supporting the FPU

- CCV850 version, not supporting the FPU

- CCV850 version, supporting the FPU

The type of the trace mode is selected in the Property panel -> [Task Analyzer] tab -> [Trace] category -> [Selection of trace mode].

1 ) CC-RH version, not supporting the FPU

Type of the Trace Mode

Size of the Memory Area

Not tracing

20.0K Bytes

Taking in trace chart by hardware trace mode

20.3K Bytes

Taking in trace chart by software trace mode

20.8K Bytes

Taking in long-statistics by software trace mode

20.7K Bytes



2 ) CC-RH version, supporting the FPU

Type of the Trace Mode

Size of the Memory Area

Not tracing

20.3K Bytes

Taking in trace chart by hardware trace mode

20.6K Bytes

Taking in trace chart by software trace mode

21.1K Bytes

Taking in long-statistics by software trace mode

20.9K Bytes



3 ) CCV850 version, not supporting the FPU

Type of the Trace Mode

Size of the Memory Area

Not tracing

20.0K Bytes

Taking in trace chart by hardware trace mode

20.3K Bytes

Taking in trace chart by software trace mode

20.8K Bytes

Taking in long-statistics by software trace mode

20.6K Bytes



4 ) CCV850 version, supporting the FPU

Type of the Trace Mode

Size of the Memory Area

Not tracing

20.2K Bytes

Taking in trace chart by hardware trace mode

20.5K Bytes

Taking in trace chart by software trace mode

21.0K Bytes

Taking in long-statistics by software trace mode

20.9K Bytes



Note The above values are maximum, when using all service calls provided by RI850V4. The value fluctuate corresponding to the type of service calls using.

B.1.2 .kernel_const

The size of ".kernel_const" section depends on the number of information items defined (such as Memory area information and Task information) and the details of the definitions.

The following shows an expression required for estimation ".kernel_const" section size.

In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.

 KERNEL_CONST =
     224
     + 8 * MEM_AREA_num
     + 24 * CRE_TSK_num
     + 8 * CRE_SEM_num
     + 8 * CRE_FLG_num
     + 8 * CRE_DTQ_num
     + 4 * CRE_MBX_num
     + align42 * CRE_MTX_num
     + 12 * CRE_MPF_num
     + 12 * CRE_MPL_num
     + 20 * CRE_CYC_num
     + 8 * DEF_INH_num
     + 8 * DEF_SVC_num
     + 12 * ATT_INI_num
     + 8 * VATT_IDL_num
     + align4maxint
     + align4TA_ACT_num
     + align4TA_STA_num


Note The keyword in the expression means as follows.

Keywords

Meaning

 MEM_AREA_num
The number of the definition of the Memory area information.

 CRE_TSK_num
The number of the definition of the Task information.

 CRE_SEM_num
The number of the definition of the Semaphore information.

 CRE_FLG_num
The number of the definition of the Eventflag information.

 CRE_DTQ_num
The number of the definition of the Data queue information.

 CRE_MBX_num
The number of the definition of the Mailbox information.

 CRE_MTX_num
The number of the definition of the Mutex information.

 CRE_MPF_num
The number of the definition of the Fixed-sized memory pool information.

 CRE_MPL_num
The number of the definition of the Variable-sized memory pool information.

 CRE_CYC_num
The number of the definition of the Cyclic handler information.

 DEF_INH_num
The number of the definition of the Interrupt handler information.

 DEF_SVC_num
The number of the definition of the Extended service call routine information.

 ATT_INI_num
The number of the definition of the Initialization routine information.

 VATT_IDL_num
The number of the definition of the Idle routine information.

 maxint
 TA_ACT_num
The number of the definition of "TA_ACT" to initial activation state of Attribute: tskatr.

 TA_STA_num
The number of the definition of "TA_STA" to initial activation state of Attribute: cycatr



B.1.3 .kernel_data

The size of ".kernel_data" section depends on the number of information items defined (such as Task information and Semaphore information) and the details of the definitions.

The following shows an expression required for estimation ".kernel_data" section size.

In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.

 KERNEL_DATA =
     68
     + 32 * CRE_TSK_num
     + 8 * CRE_SEM_num
     + 8 * CRE_FLG_num
     + 8 * CRE_DTQ_num
     + 12 * CRE_MBX_num
     + 8 * CRE_MTX_num
     + 8 * CRE_MPF_num
     + 8 * CRE_MPL_num
     + 8 * CRE_CYC_num
     + align4maxtpri


Note The keyword in the expression means as follows.

Keywords

Meaning

 CRE_TSK_num
The number of the definition of the Task information.

 CRE_SEM_num
The number of the definition of the Semaphore information.

 CRE_FLG_num
The number of the definition of the Eventflag information.

 CRE_DTQ_num
The number of the definition of the Data queue information.

 CRE_MBX_num
The number of the definition of the Mailbox information.

 CRE_MTX_num
The number of the definition of the Mutex information.

 CRE_MPF_num
The number of the definition of the Fixed-sized memory pool information.

 CRE_MPL_num
The number of the definition of the Variable-sized memory pool information.

 CRE_CYC_num
The number of the definition of the Cyclic handler information.

 maxtpri
The value of the definition in the Maximum priority: maxtpri.



B.1.4 .kernel_data_init

The size of ".kernel_data_init" section is 4 bytes.

B.1.5 .kernel_const_trace.const

The size of ".kernel_const_trace.const" section depends on the trace mode; that is, the mode selected in the Property panel -> [Task Analyzer] tab -> [Trace] category -> [Selection of trace mode].

In the following table, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.

Type of Trace Mode

Size of the Memory Area

Not tracing

align4 (5) Bytes

Taking in trace chart by hardware trace mode

align4 (61) Bytes

Taking in trace chart by software trace mode

align4 (74) Bytes

Taking in long-statistics by software trace mode

align4 (70) Bytes



B.1.6 .kernel_data_trace.bss

The size of ".kernel_data_trace.bss" section depends on the trace mode. The type of trace mode is selected in the "Property panel -> [Task Analyzer] tab -> [Trace] category -> [Selection of trace mode]".

1 ) Not tracing
The size of ".kernel_data_trace.bss" section is 0 bytes.


2 ) Taking in trace chart by hardware trace mode
The size of ".kernel_data_trace.bss" section is 4 bytes.


3 ) Taking in trace chart by software trace mode
The size of ".kernel_data_trace.bss" section depends on the definition in the Property panel -> [Task Analyzer] tab -> [Trace] category -> [Buffer size].
The following shows an expression required for estimating ".kernel_data_trace.bss" section size.
In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.



 KERNEL_DATA_TRACE.BSS =
     24
     + align4TRC_BUF_size


Note The keyword in the expression means as follows.

Keywords

Meaning

 TRC_BUF_size
The number of the definition of the Property panel -> [Task Analyzer] tab -> [Trace] category -> [Buffer size].



4 ) Taking in long-statistics by software trace mode
The size of ".kernel_data_trace.bss" section depends on the number of task information items defined and the details of the basic information definitions.
The following shows an expression required for estimation ".kernel_data_trace.bss" section size.
In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.



 KERNEL_DATA_TRACE.BSS =
     24
     + 8 * CRE_TSK_num
     + align410 * intlvl - maxintpri
     + 8 * maxint


Note The keyword in the expression means as follows.

Keywords

Meaning

CRE_TSK_num

The number of the definition of the Task information.

intlvl

The value of interrupt level provided in the target CPU.

maxintpri

The value of the definition in the Maximum interrupt priority: maxintpri

maxint



B.1.7 .kernel_work

The size of ".kernel_work" section depends on the information such as Basic information and Task information and so on.

The following shows an expression required for estimating ".kernel_work" section size.

In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.

 KERNEL_WORK =
     116
     + SYSSTK
     + TSKSTK_total
     + DTQ_total
     + MPF_total
     + MPL_total


Note The keyword in the expression means as follows.

Keywords

Meaning

SYSSTK

The value calculated by "System stack".

TSKSTK_total

Total amount of the stack size that specified in "Task stack" for each task.

DTQ_total

Total amount of the memory size that specified in "Data queue" for each data queue.

MPF_total

Total amount of the memory size that specified in "Fixed-sized memory pool" for each fixed-sized memory pool.

MPL_total

Total amount of the memory size that specified in "Variable-sized memory pool" for each variable-sized memory pool.



1 ) System stack

The size of the system stack depends on the details of the Task information and the process of task.

The following shows an expression required for estimation the system stack size required by the RI850V4.

In the following expression, "max(a, b, c)" means the result of selecting the largest value from "a", "b", and "c" (for example, max(1, 2, 3) is 3).

 SYSSTK =
     maxalign4INT + align4CYC, align4INI, align4IDL


Note The keyword in the expression means as follows.

Keywords

Meaning

INT

The stack size of the interrupt handler using. If the interrupt handler processes are nested, considers the nest counts. If the interrupt handler is undefined, the stack size of the interrupt handler is nothing.

CYC

The stack size of the cyclic handler using. If multiple cyclic handlers are existed, the maximum value among them. If the cyclic handler is undefined, the stack size of the cyclic handler is nothing.

INI

The stack size of the initialization routine using. If multiple initialization routines are existed, the maximum value among them. If the initialization routine is undefined, the stack size of the initialization routine is nothing.

IDL

The stack size of the idle routine using. If the idle routine is undefined, the stack size of the idle routine is nothing.



2 ) Task stack

The size of the task stack depends on the details of Task information definitions and processing to be done in the tasks.

The following shows an expression required for estimating the task stack size required by each task defined in the Task information.

 TSKSTK =
     ctxsz
     + stksz


Note The keyword in the expression means as follows.

Keywords

Meaning

ctxsz

This value is determined as shown in Table B-2 according to the target C compiler type and device type specified in the activation options for the CONFIGURATOR CF850V4 (see "18.2.1 Activating from command line" for details of activation options) and the preempt acceptance state specified in the Attribute: tskatr (such as coding language and initial activation state).

stksz

The value corresponding to task processing (defined the value of the Task stack size: stksz, memory area name: sec_nam).



Table B-2 Value of ctxsz

Section Name

FPU

Enable Preempt

Disable Preempt

CC-RH version

not supporting the FPU

132

88

supporting the FPU

136

92

CCV850 version

not supporting the FPU

128

84

supporting the FPU

132

88



3 ) Data queue

The size of the data queues depends on the details of Data queue information definitions.

The following shows an expression required for estimating the data queue size by each data queue defined in the Data queue information.

 DTQ =
     4 * dtqcnt


Note The keyword in the expression means as follows.

Keywords

Meaning

dtqcnt

The value of the definition in the Data count: dtqcnt, memory area name: sec_nam.



4 ) Fixed-sized memory pool

The size of the fixed-sized memory pools depends on the details of Fixed-sized memory pool information definitions.

The following shows an expression required for estimating the fixed-sized memory pool size required by each fixed-sized memory pool defined in the Fixed-sized memory pool information.

In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.

 MPF =
     align4blksz * blkcnt


Note The keyword in the expression means as follows.

Keywords

Meaning

blksz

The value of the definition in the Basic block size: blksz, memory area name: sec_nam.

blkcnt

The value of the definition in the Block count: blkcnt.



5 ) Variable-sized memory pool

The size of the variable-sized memory pools depends on the details of Variable-sized memory pool information definitions.

The following shows an expression required for estimating the variable-sized memory pool size required by each variable-sized memory pool defined in the Variable-sized memory pool information.

In the expression, "align4 (x)" means the result of aligning the value "x" to a 4-byte boundary.

 MPF =
     align4blksz * blkcnt


Note The keyword in the expression means as follows.

Keywords

Meaning

mplsz

The value of the definition in the Pool size: mplsz, memory area name: sec_nam.



B.1.8 .sec_nam(user-definied area)

The size of ".sec_nam (user-defined area)" depends on the details of information definitions (such as Task information and Data queue information).

Note This section is necessary when the task stack or data queue area is defined to be allocated outside ".kernel_work" section in the Task information or Data queue information.
Estimate the memory size for this section with reference to the descriptions in "B.1.7 .kernel_work".