Erika Enterprise can be configured as monostack or multistack. In a monostack configuration, only a single stack exists in the system. No blocking primitives are supported, and all the tasks and interrupts execute on the same stack. In this case, the one and only stack starts from the top of the application allocated memory, growing towards higher addresses. The monostack configuration can not be used if the application needs to call RTOS primitives such as WaitSem and WaitEvent. Moreover, it cannot be used when Erika Enterprise conformance classes ECC1 and ECC2 are used. To configure a monostack kernel in the OIL file, the user has to write the following lines:
...
CPU_DATA = PIC30 {
...
MULTI_STACK = FALSE;
};
...
In a multistack configuration, the kernel support the existence of different stacks in the same application. Having different stacks allow the application tasks to use blocking primitives like WaitSem and WaitEvent, which basically may block the execution of the running task. In that case, the calling task must have a private stack which is changedupon blocking. The stack will be selected again when the task will be rescheduled. There are different stacks available in a multistack configuration:
• A shared stack (used by all the tasks which have a shared stack);
• An IRQ stack (used by all the ISR Type 2 routines);
• A set of private stacks (one for each task which has selected a private stack).
In the dsPIC (R) DSC architecture, the shared stack works as in the monostack configuration, that is it is allocated at the end of the application data section, growing towards higher addresses. The IRQ stack and the private stacks, instead, are allocated in the application data space as arrays. The following example shows an OIL configuration which configures a multistack kernel without a separate IRQ stack (in this case, IRQ handlers execute on the stack of the interrupted task):
...
CPU_DATA = PIC30 {
...
MULTI_STACK = TRUE {
IRQ_STACK = FALSE;
};
};
...
The following example shows an OIL configuration which configures a multistack kernel with a separate IRQ stack (in this case, some registers are saved on the stack of the interrupted task, but the IRQ handler C function is executed on a separate IRQ stack).
...
CPU_DATA = PIC30 {
...
MULTI_STACK = TRUE {
IRQ_STACK = TRUE {
SYS_SIZE =64;
};
};
};
...
|