FileFile FormatsFormats AA

A.1 DATA FILES (.DAT) The .DAT is used for data buffer initialization. The .DAT extension is a DOS convention only and is not required by the assembler or simulator.

These files contain ASCII text only: the characters for hexadecimal or floating-point data. Any standard text editor can be used to create the files. A.1.1 Assembler Buffer Initialization Files The .VAR assembler directive has the option of naming a file from which to initialize a data buffer. You must create this file and specify it in source code with the .VAR directive. The file should be located in the directory from which the assembler is invoked (the current directory), or the path to the file’s directory must be given in the .VAR directive. The assembler reads this file and initializes the buffer in the *.EXE memory image file. The data file may be any length. A.1.1.1Floating-Point Data Buffer initialization files can contain floating-point numbers, one per line. A floating-point value consists of a decimal mantissa value, which must contain a decimal point and can be signed, followed optionally by an uppercase or lowercase E and a decimal integer exponent value, which can be signed as well. For example: 1.2345e12 567.8e–3 –7.1234

are all valid floating-point values.

A – 1 AA FileFile FormatsFormats

The assembler converts these decimal representations to floating-point format, either standard IEEE 32-bit single precision or 40-bit extended precision. The source code file in which a .VAR initialization occurs specifies the format (32-bit or 40-bit) for floating-point numbers using the .PRECISION directives. If a floating-point number in an initialization file cannot fit in the specified format, it will be rounded. The rounding mode is also specified in the source code file, using the .ROUND directives. See the Assembler chapter for a description of the .PRECISION and .ROUND directives. A.1.1.2Fixed-Point Data The standard fixed-point format for a buffer initialization file is a single integer value per line. Each value can be decimal, hexadecimal, octal or binary.

Decimal integers are designated by signed decimal values with no decimal points. The most significant digit cannot be a zero (otherwise, the number is interpreted as an octal value; see below). The assembler loads the equivalent 32-bit value into the most significant 32 bits into the 40-bit memory location and zero-fills the lower eight bits.

Hexadecimal numbers should have the “ 0x ” or “ H# ” prefix to indicate hexadecimal. A value can have any number of digits but will be stored in memory as a 32-bit number (MSBs are zero-filled or LSBs are truncated if necessary) that occupies the upper 32 bits of a 40-bit location, and the lower eight bits are zero-filled. The exception is that 10-digit values are stored as 40-bit numbers. Normally you will not use 10-digit numbers because the processor reads in only 32-bit fixed-point data. However, if you wanted to load memory with the exact value of an extended floating-point number, specifying each bit, you could accomplish this by initializing with a 10-digit hexadecimal number.

Here is an example. If your data file contains these lines: 0x1122334455 0xCCBBAA99 0x8000 0x8877665544332211 0xA5A5A5 0xFF

A – 2 FileFile FormatsFormats AA

the data loaded into 40-bit data memory would be: 1122334455 CCBBAA9900 0000800000 8877665500 00A5A5A500 000000FF00

or the data loaded into 48-bit program memory would be: 112233445500 CCBBAA990000 000080000000 887766550000 00A5A5A50000 000000FF0000

An octal value is designated by octal digits, the first of which must be 0. A value can have any number of digits but will be stored in memory as a 32-bit number (MSBs are zero-filled or LSBs are truncated if necessary) that occupies the upper 32 bits of a 40-bit location, and the lower eight bits are zero-filled.

A binary value is designated by binary digits (0s and 1s) preceded by an identifier B#. The digits and the identifier are case insensitive. A value can have any number of digits but will be stored in memory as a 32-bit number (MSBs are zero-filled or LSBs are truncated if necessary) that occupies the upper 32 bits of a 40-bit location, and the lower eight bits are zero-filled.

A.2 OBJECT (.OBJ) & MEMORY IMAGE (.EXE) FILES The *.OBJ is created by the assembler. It contains relocatable code in a binary COFF format. The COFF file format is a standard file exchange format and is not described here.

The *.EXE memory image file is created by the . This file contains the memory images of your system. The memory image file is used to load executable code into the simulator, emulator and PROM splitter. The memory image file is also in the binary COFF A – 3 AA FileFile FormatsFormats

format. A.2.1 COFF File Conversion Executable files created with tools have a different format from those created on a PC. A COFF utility program named CSWAP is provided to convert executable files from UNIX to PC format.

Use the following syntax to convert executable files:

cswap sun.exe [-o] dos.exe

A utility program named CDUMP accepts an executable file as input and dumps an ASCII representation of the COFF file. This utility displays the contents of a COFF object file or executable file.

Use the following syntax to display COFF files:

cdump file.exe > output.fil

A.3 PROM IMAGE FILES PROM image files are generated by the PROM splitter. The files are used with an industry-standard PROM programmer to program memory devices for your hardware system. One file is needed for each memory chip to be programmed. The files can be generated in either Intel Hex format or Motorola S format. The file format depends on which switch options you choose when invoking the PROM splitter. See the PROM Splitter chapter.

In all formats, the ASCII characters represent hexadecimal (not decimal) digits. A.3.1 Intel Hex-32 Format The examples below show the Intel Hex-32 format. This file format is obtained by invoking the PROM splitter with the –h switch. Assuming the file was created for an 8-bit wide PROM, it contains one byte of each 48-bit program memory word.

Each line in an Intel Hex-32 file contains either a data record, an extended linear address record or the end of file record: A – 4 :020000040010E9 extended linear address record FileFile FormatsFormats AA

:0A0004003C40343434261422260850 data record :00000401FB end of file record

The extended linear address record is used because a data record has only a 4-character (16-bit) address field. The ADSP-21xxxprocessors, however, require 32 bits to address data memory and 24 bits to address program memory. The extended linear address record specifies address bits 16-31 for the data records that follow it.

Data records are organized into the following fields:

:0A0004003C40343434261422260850

: ...... start character 0A ...... byte count of this record 0004 ...... address of first data byte 00 ...... record type 3C ...... first data byte 08 ...... last data byte 50 ..... checksum: twos complement negation of binary summation (least significant 8 bits) of preceding bytes, including byte count, address and data bytes

Extended linear address records have the following fields:

:02000000340850

: ...... start character 02 ...... byte count (always 02) 0000 ...... address (always 0000) 04 ...... record type 3408 ...... offset address F9 ...... checksum

The end of file record looks like this:

:00000001FF

: ...... start character 00 ...... byte count (zero for this record) 0000 ...... address of first byte 01 ...... record type A – 5 AA FileFile FormatsFormats

FF ...... checksum

A.3.2 Motorola S Format Motorola S Record format is similar to the Intel standard. The PROM splitter supports three file formats which differ only in the width of the address field: S1 (16 bits), S2 (24 bits) or S3 (32 bits).

Each S Record file starts with a header record and ends with a termination record. In between are data records, one per line. Here are some examples:

S00600004844521B header record S10D00043C4034343426142226084C data record (S1) S903000DEF termination record (S1)

A header record has the following fields:

S00600004844521B

S0 ...... start character (always S0) 06 ...... byte count of this record 0000 ...... address of the first data byte 484452 ...... arbitrary data field identifying records that follow 1B ...... checksum: ones complement of binary summation (least significant 8 bits) of preceding bytes, including byte count, address and data bytes

The S1 data record has the following format:

S10D00043C4034343426142226084C

S1 ...... start character 0D ...... byte count of this record 0004 ...... address of the first data byte 3C ...... first data byte 08 .... last data byte 4C .. checksum: ones complement of binary summation (least significant 8 bits) of preceding A – 6 FileFile FormatsFormats AA

bytes, including byte count, address and data bytes

The S2 data record has the same format, except that the start character is S2 and the address field is six characters wide. The S3 data record is the same as the S1 data record except that the start character is S3 and the address field is eight characters wide.

Termination records have an address field that is 16-bits, 24-bits or 32- bits wide, whichever matches the format of the preceding records. The S1 termination record has the following format:

S903000DEF

S9 ...... start character 03 ...... byte count of this record 000D ...... address EF ...... checksum

The S2 termination record has the same format, except that the start character is S8 and the address field is six characters wide. The S3 termination record is the same as the S1 format except that the start character is S7 and the address field is eight characters wide.

A.4 BYTE- STACKED FORMAT The byte-stacked format output by the ADSP-21000 family PROM splitter is intended not for PROMs, but for applications such as microcontroller transfer of data.

The byte-stacked format consists of a series of one-line headers, each followed by a block (one or more lines) of data. The last line in the file is a special header that signals the end of the file.

A – 7 AA FileFile FormatsFormats

Lines consist of ASCII text representing hexadecimal digits. Each two characters therefore represent one byte; for example F3 represents a byte whose decimal value is 243.

The header record format is shown below:

20008000000000080000001E

20 ...... Width (in bits) of address and length fields 00 ...... Reserved 80 ...... PROM splitter flags (80=PM, 00=DM) 00 ...... User-defined flags, loaded using –u switch 00000008 ...... Start address of data block 0000001E .... Number of bytes that follow (until next header record or termination record); must be nonzero.

In this example, the start address and block length fields are 32 bits wide. The file contains program memory data (the MSB is the only flag currently used in the PROM splitter flags field). No user flags are set. The address of the first location in the block is 0x08. The block contains 30 bytes, or 5 program memory code words.

A block of data records follows its header record, five bytes per line for data memory, six for program memory. For example:

Program Memory Segment (Code or Data): 3C4034343426 142226083C15

Data Memory Segment: 3C40343434 2614222608

The bytes are ordered left to right, most significant to least.

The termination record has the same format as the header record, except that the rightmost field (number of records) is all zeros.

A – 8