15.8. Assigning Output Filenames

When the hex conversion utility translates your object file into a data format, it partitions the data into one or more output files. When multiple files are formed by splitting memory words into ROM words, filenames are always assigned in order from least to most significant, where bits in the memory words are numbered from right to left. This is true, regardless of target or endian ordering.

The hex conversion utility follows this sequence when assigning output filenames:

  1. It looks for the ROMS directive. If a file is associated with a range in the ROMS directive and you have included a list of files (files = {…}) on that range, the utility takes the filename from the list. For example, assume that the target data is 32-bit words being converted to four files, each eight bits wide. To name the output files using the ROMS directive, you could specify the following. The utility will create the output files by writing the least significant bits to xyz.b0 and the most significant bits to xyz.b3:

    ROMS
    {
         RANGE1: romwidth=8, files={ xyz.b0 xyz.b1 xyz.b2 xyz.b3 }
    }
    
  2. It looks for the --outfile options. You can specify names for the output files by using the --outfile option. If no filenames are listed in the ROMS directive and you use --outfile options, the utility takes the filename from the list of --outfile options. The following line has the same effect as the example ROMS directive above:

    --outfile=xyz.b0 --outfile=xyz.b1 --outfile=xyz.b2 --outfile=xyz.b3
    
  3. It assigns a default filename. If you specify no filenames or fewer names than output files, the utility assigns a default filename. A default filename consists of the base name from the input file plus a 2- to 3-character extension. The extension has three parts:

    1. A format character, based on the output format (see Description of the Object Formats):

      • a for ASCII-Hex

      • i for Intel

      • m for Motorola-S

      • t for TI-Tagged

      • x for Tektronix

    2. The range number in the ROMS directive. Ranges are numbered starting with 0. If there is no ROMS directive, or only one range, the utility omits this character.

    3. The file number in the set of files for the range, starting with 0 for the least significant file.

    For example, assume a.out is for a 32-bit target processor and you are creating Intel format output. With no output filenames specified, the utility produces four output files named a.i0, a.i1, a.i2, a.i3.

    If you include the following ROMS directive when you invoke the hex conversion utility, you would have eight output files:

    ROMS
    {
        range1: o = 0x00001000 l = 0x1000
        range2: o = 0x00002000 l = 0x1000
    }
    

These output files …

Contain data in these locations …

a.i00, a.i01, a.i02, a.i03

0x00001000 through 0x00001FFF

a.i10, a.i11, a.i12, a.i13

0x00002000 through 0x00002FFF

If both the ROMS directive and --outfile options are used together, the ROMS directive overrides the --outfile options.