Renesas M3T-MR100 Network Card User Manual


 
266
10.1.1 User Stack Calculation Method
User stacks must be calculated for each task. The following shows an example for calculating user stacks in cases when an
application is written in the C language and when an application is written in the assembly language.
z When an application is written in the C language
Using the stack size calculation utility of NC100, calculate the stack size of each task. The necessary stack size
of a task is the sum of the stack size output by the stack size calculation utility plus a context storage area of 48
bytes
54
z When an application is written in the assembly language
Sections used in user program
The necessary stack size of a task is the sum of the stack size used by the task in subroutine call plus the size
used to save registers to a stack in that task.
Sections used in MR100
The sections used in MR100 refer to a stack size that is used for the service calls issued.
MR100 requires that if you issue only the service calls that can be issued from tasks, 8bytes of area be allocated
for storing the PC and FLG registers. Also, if you issue the service calls that can be issued from both tasks and
handlers, see the stack sizes listed in Table 10.2 Stack Sizes Used by Service Calls Issued from Handlers (in
bytes) to ensure that the
necessary stack area is allocated.
Furthermore, when issuing multiple service calls, include the maximum value of the stack sizes used by those
service calls as the sections used by MR100 as you calculate the necessary stack size.
Therefore,
User stack size =
Sections used in user program
+ registers used + Sections used in MR100
(registers used is total size of used registers.)
Figure 2.3:Example of Use Stack Size Calculation shows an example for
calculating a user stack. In the example below, the
registers used by the task are R2R0, R3R1, and A0.
54
If written in the C language, this size is fixed.