12.07.2015 Views

COFF to DSK Translator - Texas Instruments

COFF to DSK Translator - Texas Instruments

COFF to DSK Translator - Texas Instruments

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Application ReportSPRA549<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>rAaron K. Aboagye and Behrang MohitC5000 DSAGAbstractDevelopment platforms available for digital signal processor (DSP) designers <strong>to</strong>day are mainlythe evaluation module (EVM) and the DSP starter kit (<strong>DSK</strong>). Executable code generated on thesetwo platforms is not compatible and migration from one platform <strong>to</strong> the other is not straightforward.This application report presents a description of a utility designed <strong>to</strong> translate the executablesproduced by the <strong>to</strong>ols used by the two platforms (<strong>COFF</strong> for EVMs and the <strong>DSK</strong> for <strong>DSK</strong>s), <strong>to</strong> helpreduce the amount of work required for migration from one platform <strong>to</strong> the other. Theprogramming of this utility was done in Borland C++ and testing was done on the White MountainDSP TMS320F206 <strong>DSK</strong> and the Spectrum Digital EVM.ContentsIntroduction............................................................................................................................................... 2Definitions................................................................................................................................................. 2Common Object File Format (<strong>COFF</strong>) .............................................................................................. 2DSP Starter Kit (<strong>DSK</strong>) .................................................................................................................... 2Translation Algorithm ................................................................................................................................ 3Using the Transla<strong>to</strong>r.................................................................................................................................. 4<strong>COFF</strong>-<strong>to</strong>-<strong>DSK</strong> Transla<strong>to</strong>r................................................................................................................ 4<strong>DSK</strong>-<strong>to</strong>-<strong>COFF</strong> Transla<strong>to</strong>r................................................................................................................ 4Error Handling................................................................................................................................ 4Testing ..................................................................................................................................................... 5Conclusion................................................................................................................................................ 5Digital Signal Processing Solutions May 1999


Application ReportSPRA549IntroductionCurrently, there are two major development platforms for DSP designers using the <strong>Texas</strong><strong>Instruments</strong> (TI) TMS320 DSPs. In this application report, we will focus mainly on theC2000 family of DSPs and the two platforms available, the evaluation module (EVM),produced by Spectrum Digital, and the DSP starter kit (<strong>DSK</strong>), produced by WhiteMountain DSP. Inexperienced DSP designers and beginners generally prefer <strong>to</strong> use the<strong>DSK</strong> because of its low cost and simple programming. However, the <strong>DSK</strong> has a limitationin the available on-board memory, 4K of data memory, and this, eventually, causesdesigners <strong>to</strong> upgrade <strong>to</strong> the EVM that features a full 64K of data memory.Both platforms utilize the TI 2xx instruction set for programming but there is a differencein the debugging environment. Development on the EVM requires the programmer <strong>to</strong>build executables using the 2xx assembler, linker, or compiler available from TI <strong>to</strong>produce executables conforming <strong>to</strong> the industry <strong>COFF</strong> standard. Development on the<strong>DSK</strong>, on the other hand, requires the programmer <strong>to</strong> build executables using the <strong>to</strong>olsavailable with the <strong>DSK</strong> that produce executables conforming <strong>to</strong> the TI-tagged objectformat.This difference in executable formats inhibits a smooth transition back and forth betweenthe two platforms. This application report presents the 2XX <strong>COFF</strong>-<strong>DSK</strong> transla<strong>to</strong>r and themethodology used <strong>to</strong> translate executables from one platform <strong>to</strong> the other.DefinitionsCommon Object File Format (<strong>COFF</strong>)An implementation of an object file in a binary format that was developed by AT&T.<strong>COFF</strong> encourages modular programming and provides more powerful and flexiblemethods for managing code segments and target system memory. The <strong>COFF</strong> format isbased on multiple sections of both program and data memory.DSP Starter Kit (<strong>DSK</strong>)This kit includes the <strong>DSK</strong> board, the <strong>DSK</strong> development <strong>to</strong>ols, and the debugger (CodeExplorer). The <strong>DSK</strong> files are in ASCII format and, unlike <strong>COFF</strong>, have only two sections:data and program memory. Names of sections and labels are not available in this format.<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>r 2


Application ReportSPRA549Translation AlgorithmIn this section, the main parts of the translation algorithm will be presented. The sourcecode was written in Borland C++. Detailed descriptions of the <strong>COFF</strong> and TI-tagged objectformats may be obtained from the TMS320C2xx Assembly Language Tools Users Guide(SPRU018).There are two versions of the <strong>COFF</strong> format, <strong>COFF</strong>1 and <strong>COFF</strong>2, and a version flag atthe start of each file indicates this version. These flags, C1 and C2, are used by the<strong>COFF</strong>-<strong>to</strong>-<strong>DSK</strong> transla<strong>to</strong>r <strong>to</strong> determine the version and thus, the structure. A few caseswere observed where the <strong>to</strong>ols produced files with different version flags and those casesare handled as errors in this version of the utility.The <strong>COFF</strong>-<strong>to</strong>-<strong>DSK</strong> transla<strong>to</strong>r works in two stages: it first reads the address information ofsections and then it writes the data in<strong>to</strong> the <strong>DSK</strong> file. Each section in a <strong>COFF</strong> file has astart address and length and the <strong>COFF</strong>-<strong>to</strong>-<strong>DSK</strong> transla<strong>to</strong>r reads this information from thefile before the raw data is stripped off. The TI-tagged format only requires start addressesso once the transla<strong>to</strong>r has this information, it becomes a simple task of writing thehexadecimal data values in<strong>to</strong> an ASCII file. Another important piece of information is theentry point <strong>to</strong> the executable code. The <strong>COFF</strong> file contains this information and is readand written <strong>to</strong> the <strong>DSK</strong> file, since it is required in both formats.The <strong>DSK</strong>-<strong>to</strong>-<strong>COFF</strong> transla<strong>to</strong>r uses the same two steps as the <strong>COFF</strong>-<strong>to</strong>-<strong>DSK</strong> transla<strong>to</strong>r,but generating the binary <strong>COFF</strong> file is not as simple. This is because the <strong>COFF</strong> formatrequires sectional information, which is not readily available in a <strong>DSK</strong> file. The transla<strong>to</strong>rthus has <strong>to</strong> compute all the required information and build the <strong>COFF</strong> structured binaryfile. In writing the transla<strong>to</strong>r, it was assumed that any data in the <strong>DSK</strong> file locatedbetween 0x0000 and 0x0040 is an interrupt vec<strong>to</strong>r.The TI-tagged format has a checksum at the end of each line of data. The user’s guideprovides a method <strong>to</strong> compute this checksum and the transla<strong>to</strong>r adheres <strong>to</strong> this method.It was observed during testing, that the <strong>DSK</strong> files produced by the <strong>DSK</strong> <strong>to</strong>ols do not havecorrect checksums. However, the Code Explorer debugger does not seem <strong>to</strong> evaluatethe checksums and neither does the serial flash loader so it is not a very significant fac<strong>to</strong>rfor proper functionality.<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>r 3


Application ReportSPRA549Using the Transla<strong>to</strong>rCurrently, the translation utility comes with two independent transla<strong>to</strong>rs, <strong>COFF</strong> <strong>to</strong> <strong>DSK</strong>(coff-dsk.exe) and <strong>DSK</strong> <strong>to</strong> <strong>COFF</strong> (dsk-coff.exe). You need <strong>to</strong> run the appropriateapplication <strong>to</strong> perform either translation.<strong>COFF</strong>-<strong>to</strong>-<strong>DSK</strong> Transla<strong>to</strong>rOnce this application is executed, you will be prompted <strong>to</strong> do the following:ˆ Enter the Path and Name of the input <strong>COFF</strong> fileˆ Enter the Path and Name of the output <strong>DSK</strong> fileIf the utility is successful in opening the <strong>COFF</strong> file, the <strong>DSK</strong> file will be generated underthe specified path. In addition <strong>to</strong> the <strong>DSK</strong> file, a statistics text file will be generated whenyou run this program. This file has some information about the input <strong>COFF</strong> file such asnumber of words and physical address of each section in the <strong>COFF</strong> file. This statistics filehas the same name and path as your input <strong>COFF</strong> file with an extension of txt; forexample, if the file test.out is translated <strong>to</strong> test.dsk, the statistics file will be namedtest.txt. After the translation is successfully done, you may press any key <strong>to</strong> performanother translation or ‘q’ <strong>to</strong> quit the program.<strong>DSK</strong>-<strong>to</strong>-<strong>COFF</strong> Transla<strong>to</strong>rOnce this application is executed, you will be prompted <strong>to</strong> do the following:ˆ Enter the Path and Name of the input <strong>DSK</strong> fileˆ Enter the Path and Name of the output <strong>COFF</strong> fileIf the utility is successful in opening the <strong>DSK</strong> file, the <strong>COFF</strong> file will be generated underthe specified path. In addition <strong>to</strong> the <strong>COFF</strong> file, a statistics text file will be generated whenyou run this program. This file has some information about the input <strong>DSK</strong> file such asnumber of words and physical address of each section in the <strong>COFF</strong> file. This statistics filehas the same name and path as your input <strong>DSK</strong> file with an extension of txt; for example,if the file test.dsk is translated <strong>to</strong> test.out, the statistics file will be named test.txt. After thetranslation is successfully done, you may press any key <strong>to</strong> perform another translation or‘q’ <strong>to</strong> quit the program.Error HandlingIn case of an error in the path or name you enter, either program will prompt you <strong>to</strong> againenter the correct path or name. If you want <strong>to</strong> quit the program, you can press Ctrl+C anytime during execution.In case of an error in your input file, either program will prompt you about the section ofyour input file that has a problem and the program will then terminate.<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>r 4


Application ReportSPRA549TestingTesting of the transla<strong>to</strong>rs was done in two stages. The first stage involved translatingcode written on each of the platforms <strong>to</strong> the other and running the code on the targetplatform <strong>to</strong> verify functionality. The second stage involved translating a <strong>DSK</strong> file <strong>to</strong> <strong>COFF</strong>and then back <strong>to</strong> <strong>DSK</strong> <strong>to</strong> verify that no errors occur and no information is lost betweentranslations. As expected, when this was performed in the other direction, <strong>COFF</strong> <strong>to</strong> <strong>DSK</strong><strong>to</strong> <strong>COFF</strong>, the resulting <strong>COFF</strong> file had no labels in the code but execution was correct.ConclusionAs indicated in the testing section, the first release of the utility has definitely met theobjectives even though there is room for improvement. Improvement may includedynamic relocation of interrupt vec<strong>to</strong>rs and I/O configurations that will eliminate the needfor programmers <strong>to</strong> manually make these modifications before translation. Timepermitting, a better GUI will be provided.<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>r 5


Application ReportSPRA549TI Contact NumbersINTERNETTI Semiconduc<strong>to</strong>r Home Pagewww.ti.com/scTI Distribu<strong>to</strong>rswww.ti.com/sc/docs/distmenu.htmPRODUCT INFORMATION CENTERSAmericasPhone +1(972) 644-5580Fax +1(972) 480-7800Email sc-infomaster@ti.comEurope, Middle East, and AfricaPhoneDeutsch +49-(0) 8161 80 3311English +44-(0) 1604 66 3399Español +34-(0) 90 23 54 0 28Francais +33-(0) 1-30 70 11 64Italiano +33-(0) 1-30 70 11 67Fax +44-(0) 1604 66 33 34Email epic@ti.comJapanPhoneInternational +81-3-3344-5311Domestic 0120-81-0026FaxInternational +81-3-3344-5317Domestic 0120-81-0036Email pic-japan@ti.comAsiaPhoneInternational +886-2-23786800DomesticAustralia 1-800-881-011TI Number -800-800-1450China 10810TI Number -800-800-1450Hong Kong 800-96-1111TI Number -800-800-1450India 000-117TI Number -800-800-1450Indonesia 001-801-10TI Number -800-800-1450Korea 080-551-2804Malaysia 1-800-800-011TI Number -800-800-1450New Zealand 000-911TI Number -800-800-1450Philippines 105-11TI Number -800-800-1450Singapore 800-0111-111TI Number -800-800-1450Taiwan 080-006800Thailand 0019-991-1111TI Number -800-800-1450Fax 886-2-2378-6808Email tiasia@ti.comCode Explorer and TI are trademarks of <strong>Texas</strong> <strong>Instruments</strong> Incorporated.<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>r 6


IMPORTANT NOTICE<strong>Texas</strong> <strong>Instruments</strong> and its subsidiaries (TI) reserve the right <strong>to</strong> make changes <strong>to</strong> theirproducts or <strong>to</strong> discontinue any product or service without notice, and advise cus<strong>to</strong>mers <strong>to</strong>obtain the latest version of relevant information <strong>to</strong> verify, before placing orders, thatinformation being relied on is current and complete. All products are sold subject <strong>to</strong> theterms and conditions of sale supplied at the time of order acknowledgement, includingthose pertaining <strong>to</strong> warranty, patent infringement, and limitation of liability.TI warrants performance of its semiconduc<strong>to</strong>r products <strong>to</strong> the specifications applicable atthe time of sale in accordance with TI's standard warranty. Testing and other qualitycontrol techniques are utilized <strong>to</strong> the extent TI deems necessary <strong>to</strong> support this warranty.Specific testing of all parameters of each device is not necessarily performed, exceptthose mandated by government requirements.CERTAIN APPLICATIONS USING SEMICONDUCTOR PRODUCTS MAY INVOLVEPOTENTIAL RISKS OF DEATH, PERSONAL INJURY, OR SEVERE PROPERTY ORENVIRONMENTAL DAMAGE (“CRITICAL APPLICATIONS"). TI SEMICONDUCTORPRODUCTS ARE NOT DESIGNED, AUTHORIZED, OR WARRANTED TO BESUITABLE FOR USE IN LIFE-SUPPORT DEVICES OR SYSTEMS OR OTHERCRITICAL APPLICATIONS. INCLUSION OF TI PRODUCTS IN SUCH APPLICATIONSIS UNDERSTOOD TO BE FULLY AT THE CUSTOMER'S RISK.In order <strong>to</strong> minimize risks associated with the cus<strong>to</strong>mer's applications, adequate designand operating safeguards must be provided by the cus<strong>to</strong>mer <strong>to</strong> minimize inherent orprocedural hazards.TI assumes no liability for applications assistance or cus<strong>to</strong>mer product design. TI doesnot warrant or represent that any license, either express or implied, is granted under anypatent right, copyright, mask work right, or other intellectual property right of TI coveringor relating <strong>to</strong> any combination, machine, or process in which such semiconduc<strong>to</strong>rproducts or services might be or are used. TI's publication of information regarding anythird party's products or services does not constitute TI's approval, warranty, orendorsement thereof.Copyright © 1999 <strong>Texas</strong> <strong>Instruments</strong> Incorporated<strong>COFF</strong> <strong>to</strong> <strong>DSK</strong> Transla<strong>to</strong>r 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!