AN2311 Freescale Semiconductor / Motorola, AN2311 Datasheet - Page 8

no-image

AN2311

Manufacturer Part Number
AN2311
Description
Bootstrapping the MSC8101 Device Through the HDI16 Port
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Target Application Image
8
The slave application files are compiled, assembled, and linked to produce an ELF object (.eld file)
using the MetroWerks® Codewarrior® tools. This file is then converted to an S-record using the
elfsrec.exe application provided with the Codewarrior tools. The application is invoked with the
following DOS command:
The –w specifies that an S2 format S-record is generated, and the resulting output file name is
<filename.eld.s>, which should be renamed to <filename.s>. The next step is to run the
srec2arr.exe utility on this file with the following DOS command:
This command generates an output file named <slaveimg.c>. The srec2arr.exe program is a
small utility that takes the address, length, and data from each line of the S2 record and converts it to a C
array in the following format:
• 2 words length (4 bytes)
• 2 words address (4 bytes)
• Number of words described in length as data
• 2 words CRC (4 bytes)
• 2 words CRC (4 Bytes)
Table 5 illustrates one line of an example S-record (numbers in hexadecimal) and the converted
equivalent C array format.
The conversion process first strips the S-record type. The number of bytes in length within the S-record is
changed to a 32-bit value described in two 16-bit words, and the value is halved to describe 16-bit words
rather than bytes. The length described in the C array must leave a remainder of two when it is divided by
four to match the boot ROM program requirements. The length for the driver example is 0xA, which
meets this requirement. If necessary, additional dummy 16 bit words (0x0000) are added at the end of the
real data words, and the length value is incremented appropriately. The address field for an S2 record is
three bytes, which are converted to two 16-bit words. The srec2arr.exe utility does not support the
S1 and S3 record types, although the code can easily be modified to handle them.
The actual data words are then converted to 16-bit quantities. Finally, the CRC and CRC are added. These
are not calculated but are simply padded with 0x0000 because the CRC check in the boot ROM can
optionally be ignored. The source code (srec2arr.c) is provided in Appendix A to add CRC
generation, if required.
The last line of the array includes the end block (length 0 address 0), which ends the download process
and starts executing the downloaded program. If the start address is not zero, it must be modified to the
appropriate value, either in the srec2arr.c source code or in the generated C array. The
srec2arr.c listing is provided in Appendix A for reference and can be modified as needed.
S-Record
elfsrec.exe -w <filename.eld>
srec2arr.exe
Type
S2
Freescale Semiconductor, Inc.
0x0000,
0x000A,
Table 5.
Length
Length
For More Information On This Product,
14
<filename.s>
Go to: www.freescale.com
Address
Address
0x13C0,
0013C0
0x0000,
O
0x90C0,0x90C0,0xD803,0x0000,
L
90C090C0D8030000
3104203A800190C0
Data Words
Data
S R
,
C
0x0000,0x0000,
CRC
CRC
3D
A
0x0000,0x0000,
CRC

Related parts for AN2311