APPENDIX D STACK SIZE ESTIMATION
If a stack overflows, the behavior of the system becomes irregular. Therefore, a stack must not overflow referring to this chapter.
There are two types of stacks: the user stack and system stack. The method for calculating stack sizes differs between the user stack and system stack.
- User stack
The stack used by tasks is called "User stack".
When a task is created by Task Information (task[]) in the system configuration file, the size and the name of the section where the stack is allocated are specified.
When a task is created by cre_tsk or acre_tsk, the size and the start address of the user stack area are specified.
The stack used by tasks is called "User stack".
When a task is created by Task Information (task[]) in the system configuration file, the size and the name of the section where the stack is allocated are specified.
When a task is created by cre_tsk or acre_tsk, the size and the start address of the user stack area are specified.
- System stack
The system stack is used by handlers and the kernel. The system has only one system stack. The size is specified by System stack size (stack_size) in System Information (system). The section name of the system stack is "SI".
The system stack is used by handlers and the kernel. The system has only one system stack. The size is specified by System stack size (stack_size) in System Information (system). The section name of the system stack is "SI".
The quantity consumed of user stack for each task is a value in which the value calculated by the following expressions was rounded up to the multiple of 16.
- treesz_task
Size consumed by function tree that makes the task entry function starting point. (the size displayed by Call Walker).
Size consumed by function tree that makes the task entry function starting point. (the size displayed by Call Walker).
- treesz_tex
Size consumed by function tree that makes the task exception handling routine entry function starting point. (the size displayed by Call Walker).
Size consumed by function tree that makes the task exception handling routine entry function starting point. (the size displayed by Call Walker).
- ctxsz _task, ctxsz _tex
Size for task context registers. The ctxsz _task is for task, and ctxsz _tex is for task exception handling routine.
The size for task context registers is different according to the setting of Task context register (context) in System Information (system). Refer to Table D-1.
Size for task context registers. The ctxsz _task is for task, and ctxsz _tex is for task exception handling routine.
The size for task context registers is different according to the setting of Task context register (context) in System Information (system). Refer to Table D-1.
The system stack is most consumed when an interrupt occurs during service call processing followed by the occurrence of multiple interrupts. The quantity consumed of system stack is calculated by the following expressions.
Quantity consumed of system stack = | svcsz | ||
15 | |||
+ | ∑ | inthdrsz k | |
k = 1 | |||
+ sysdwnsz |
- svcsz
The maximum size among the service calls to be used in the all processing program. The value svcsz depends on the RI600PX version. For details, refer to release notes.
The maximum size among the service calls to be used in the all processing program. The value svcsz depends on the RI600PX version. For details, refer to release notes.
- inthdrsz
Size consumed by function tree that makes the interrupt handler entry function starting point. (the size displayed by Call Walker).
The "k" means interrupt priority level. If there are multiple interrupts in the same priority level, the inthdrsz k should select the maximum size among the handlers.
The size used by the base clock interrupt handler (the interrupt priority level is specified by Base clock interrupt priority level (IPL) in Base Clock Interrupt Information (clock)) is the maximum value in the following Please refer to the release notes for clocksz1, clocksz2 and clocksz3.
Don't have to add the size used by the base clock interrupt handler when base clock timer is not used (clock.timer = NOTIMER).
Size consumed by function tree that makes the interrupt handler entry function starting point. (the size displayed by Call Walker).
The "k" means interrupt priority level. If there are multiple interrupts in the same priority level, the inthdrsz k should select the maximum size among the handlers.
The size used by the base clock interrupt handler (the interrupt priority level is specified by Base clock interrupt priority level (IPL) in Base Clock Interrupt Information (clock)) is the maximum value in the following Please refer to the release notes for clocksz1, clocksz2 and clocksz3.
Don't have to add the size used by the base clock interrupt handler when base clock timer is not used (clock.timer = NOTIMER).
- cycsz
Size consumed by function tree that makes the cyclic handler entry function starting point. (the size displayed by Call Walker).
If there are multiple cyclic handlers, the cycsz should select the maximum size among the handlers.
Size consumed by function tree that makes the cyclic handler entry function starting point. (the size displayed by Call Walker).
If there are multiple cyclic handlers, the cycsz should select the maximum size among the handlers.