206/317
7 - Debugger and PROM Programmer Tutorial for ST72251
7.6.3 A simple multitasking kernel for the ST7
As mentioned in a previous chapter, to implement a multitasking kernel on the ST7, you must
sacrifice a lot of features. On the other hand, the ST7 is not expected to handle programs re-
quiring extensive computing power, and so the reduction in performance can be outweighed
by the advantages of simpler programming, and better coordination between tasks that a mul-
titasking approach brings to the programmer.
We first describe a very simple kernel and its mechanisms, that are used in the present appli-
cation. In a later chapter, we shall describe a more advanced one that is more complicated
and specially written to be used in a C-language program.
This kernel is of the cooperative type. It provides only two routines:
StartTasks
and
Yield,
described below.
7.6.3.1
StartTasks
routine
The main program defines the table
AddrTasks
that contains four constant words that are the
start addresses of the four tasks. Each task must be written as an infinite loop that receives no
argument and that never returns. When
CreateTask
is called in the initialization part of the ap-
plication, it builds the stack structure that will allow each task to have its own stack, by dividing
the whole stack (64 bytes in the ST72251) in four smaller stacks (16 bytes), as shown in the
diagram:
07-stack
Stack
64 bytes
17F
16F
15F
14F
Little kernel: stack organization
bottom stack
for each task
Содержание 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 ...