annotate doc/scripts.txt @ 297:c52ad3135bd3

implement reading files
author lost
date Sun, 18 Jan 2009 04:53:57 +0000
parents 7a3d66e72a4c
children 9c6462b3a288
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
295
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
1 LWLINK linker scripts
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
2
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
3 A linker script is used to instruct the linker about how to assemble the
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
4 various sections into a completed binary. It consists of a series of
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
5 directives which are considered in the order they are encountered. Any
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
6 section not referenced by a directive is assumed to be loaded after the
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
7 final section explicitly referenced.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
8
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
9 A section may only be referenced once. Any subsequent references will have
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
10 no effect.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
11
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
12 section <name> load at <addr>
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
13
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
14 This causes the section <name> to load at <addr>. For raw target, only one
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
15 "load at" entry is allowed for non-bss sections and it must be the first
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
16 one. For raw targets, it affects the addresses the linker assigns to symbols
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
17 but has no other affect on the output. bss sections may all have separate
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
18 load addresses but since they will not appear in the binary anyway, this is
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
19 okay.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
20
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
21 For the DECB target, each "load at" entry will cause a new "block" to be
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
22 output to the binary which will contain the load address. It is legal for
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
23 sections to overlap in this manner - the linker assumes the loader will sort
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
24 everything out.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
25
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
26 section <name> load after <name2>
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
27
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
28 This will cause the section <name> to load after <name2>. This has the
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
29 effect of essentially gluing <name> onto the end of <name2>. If multiple
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
30 sections are specified to load after a particular section, they will load in
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
31 the order specified.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
32
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
33 pad to <size>
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
34
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
35 This will cause the output file to be padded with NUL bytes to be exactly
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
36 <size> bytes in length. This only makes sense for a raw target.
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
37
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
38
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
39 If <name> is "*", then any section not already matched by the script will be
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
40 matched. For format *,<flags> can be used to select sections which have
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
41 particular flags set (or not set). For instance:
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
42
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
43 *,!bss This would match all sections that do not have the bss flag set
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
44 *,bss this would match all sections that do have the bss flag set
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
45
7a3d66e72a4c Added some basic documentation of the linker
lost
parents:
diff changeset
46