43/317
2 - How does a typical microcontroller work?
not simpler to perform the processing right in the interrupt service routine, instead of this ap-
parent complexity. Actually, the processing of the keystroke can take a long time, too long to
allow it to freeze the remainder of the application as happens when an interrupt is being serv-
iced.
Other services may be supplied by the multitasking kernel, coping with priorities, intertask
communication, etc.
2.6.3.4 Multitasking kernel overhead
The purpose of a multitasking kernel is to share the power of a single processor or core be-
tween several tasks. Obviously this sharing means less power for each task, except perhaps
if all tasks but one are asleep. However, even in that case, the task does not benefit from the
whole computing power, since some of the core power is drawn off by the kernel itself. In ad-
dition, it is equally obvious that the kernel is a piece of code that occupies a certain amount of
program memory as well as data memory. But overall, the main concern with memory require-
ments relates to the stack.
The stack is the place where the state of a program is continuously stored. This amount of
data is often referred to as the “context”. Each task has its own context, which consists of all
the return addresses of all nested procedures and functions; most compilers also store the
function arguments and local data in the stack. This can add up to a large amount of memory,
not to mention that some free space must remain in the stack to handle interrupts that may
themselves consume a certain amount of stack, in the same way as the main program.
This implies generally that the stack space must be very large, since the amount of data men-
tioned above must be multiplied by the number of tasks alive at the same time.
The ST7, being a small 8-bit core, provides for at most 256 bytes of stack. This allows for a
multitasking kernel with a limited number of tasks and services.
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...