SLAU131Y October 2004 – June 2021
You can convert specific sections of the object file by name with the hex conversion utility SECTIONS directive. You can also specify those sections that you want to locate in ROM at a different address than the load address specified in the linker command file. If you:
Uninitialized sections are never converted, whether or not you specify them in a SECTIONS directive.
Use the SECTIONS directive in a command file. (See Section 13.3.2.) The general syntax is:
SECTIONS { | |
oname(sname)[:] [paddr=value][,] oname(sname)[:] [paddr= value][,] ... } |
SECTIONS | begins the directive definition. |
oname | identifies the object filename the section is located within. The filename is optional when only a single input file is given, but required otherwise. |
sname | identifies a section in the input file. If you specify a section that does not exist, the utility issues a warning and ignores the name. |
paddr=value | specifies the physical ROM address at which this section should be located. This value overrides the section load address given by the linker. This value must be a decimal, octal, or hexadecimal constant. If your file contains multiple sections, and if one section uses a paddr parameter, then all sections must use a paddr parameter. |
For more similarity with the linker's SECTIONS directive, you can use colons after the section names. For example, the data in your application (section partB) must be loaded on the EPROM at address 0x0. Use the paddr option with the SECTIONS directive to specify this:
SECTIONS
{
partB: paddr = 0x0
}
The commas separating section names are optional. For example, suppose the file contains six initialized sections: .text, .data, .const, .vectors, .coeff, and .tables. Suppose you want only .text and .data to be converted. Use a SECTIONS directive to specify this:
SECTIONS { .text, .data }