|
Logical Area Attributes |
Top Previous Next |
|
The configurer must be told the dynamic data storage requirements for each task in an application. This is done using the STACK, HEAP and DATA attributes of the TASK statement. For example:
task first stack=10240 heap=20K task second data=50K task third data=? task fourth stack=10K ! no heap, not recommended task fifth heap=? ! no stack, unlikely to work
In the first example, the STACK and HEAP logical areas are allocated separately, and are given the sizes indicated. In the second example, the stack and heap are allocated to a single area, and are jointly given 50K, while in the third, they are jointly allocated to the largest contiguous area of unallocated memory.
In the fourth and fifth examples, because only one of the areas has been given a size, the other will have no space at all. A task may survive with no heap, but not having a stack will almost certainly cause the task to fail.
CODE and STATIC may not be used as TASK attributes, as the configurer finds the size of these areas by inspecting the task image file.
The argument to one of the memory size attributes is an integer expressing the amount of memory to be allocated to the area in question. Sizes smaller than 128 are not accepted, to prevent accidental entry of unreasonably small amounts (for example, by typing 1.6 instead of 1.6k). It is also possible to specify 'the rest of memory available on the processor' by entering a question mark instead of an integer. On the C6000, which has several distinct areas of memory, a question mark is interpreted as 'the largest remaining area of suitable memory'. Only one task may request this treatment on any particular processor.
Whether these memory sizes are expressed in octets (eight-bit bytes) or in 32-bit words depends on the processor type. On the C6000, these attributes always specify a number of octets.
|