Download TR0105 TSK51x/TSK52x Embedded Tools Reference

Transcript
TSK51x/TSK52x Embedded Tools Reference
• With the priority keyword you can change the order in which sections are located. This is useful when some sections
are considered important for good performance of the application and a small amount of fast memory is available. The
value is a number for which the default is 1, so higher priorities start at 2. Sections with a higher priority are located
before sections with a lower priority, unless their relative locate priority is already determined by other restrictions like
run_addr and page.
group (priority=2)
{
select "importantcode1";
select "importantcode2";
}
7.9.3
Creating or Modifying Special Sections
Instead of selecting sections, you can also create a reserved section or an output section or modify special sections like a stack
or a heap. Because you cannot define these sections in the input files, you must use the linker to create them.
Stack
• The keyword stack tells the linker to reserve memory for the stack. The name for the stack section refers to the stack as
defined in the architecture definition. If no name was specified in the architecture definition, the default name is stack.
With the keyword size you can specify the size for the stack. If the size is not specified, the linker uses the size given by
the min_size argument as defined for the stack in the architecture definition. Normally the linker automatically tries to
maximize the size, unless you specified the keyword fixed.
group ( ... )
{
stack "mystack" ( size = 2k );
}
The linker creates two labels to mark the begin and end of the stack, __lc_ub_stack_name for the begin of the stack and
__lc_ue_stack_name for the end of the stack. The linker allocates space for the stack when there is a reference to either
of the labels.
See also the stack keyword in section 7.5.3, Defining Address Spaces.
Heap
• The keyword heap tells the linker to reserve a dynamic memory range for the malloc() function. Optionally you can assign
a name to the heap section. With the keyword size you can change the size for the heap. If the size is not specified, the
linker uses the size given by the min_size argument as defined for the heap in the architecture definition. Normally the
linker automatically tries to maximize the size, unless you specified the keyword fixed.
group ( ... )
{
heap "myheap" ( size = 2k );
}
The linker creates two labels to mark the begin and end of the heap, __lc_ub_heap_name for the begin of the heap and
__lc_ue_heap_name for the end of the heap. The linker allocates space for the heap when a reference to either of the
section labels exists in one of the input object files.
Reserved section
• The keyword reserved tells the linker to create an area or section of a given size. The linker will not locate any other
sections in the memory occupied by a reserved section, with some exceptions. Optionally you can assign a name to a
reserved section. With the keyword size you can specify a size for a given reserved area or section.
group ( ... )
{
reserved "myreserved" ( size = 2k );
}
7−30