Re: how to generate the assembly code from a .h file generated by COFF2C

Started by Jeff Brower November 18, 2008

> Thanks for your reply. But what I want is not make .h file from coff file, I
> want to make a .h file back coff file. So I want to know how COFF2C extract
> the coff file to a .h file. Is there any detail document about that?

The first thing is to look in TI's Assembly Language Tools User's Guide doc for
whatever chip is being used. In your case (C54x), look in this doc:


under Appendix A, Common Object File Format.

Second, I suggest to Google for "COFF reader" or "COFF parser" similar source code or
program. I'm not sure of any reliable, "standardized" open source for parsing COFF
files, but I haven't looked for a while so who knows what's out there.

But be careful, my experience has been that each chip vendor has a somewhat different
"interpretations" of the COFF format. For example, TI follows the COFF format "Ok"
but there are several deviations. Of course this makes sense because different
processors/CPUs have different native architecture and requirements -- things like
alignment, load-time initialization (i.e. your friendly .cinit section!), unusual
ways of handling stacks or stack alternatives (think "data pointer" register),
artifacts resulting from optimization, etc. So, if you find some open source, and
write your own program, then you gotta test, test, test with many different CCS
outputs with many different combinations of Project Build and Linker options before
you can say your program is working.


> On 11/18/08, Jeff Brower wrote:
> >
> > John-
> >
> > > I have some .h files that contain the dsp binary code. These .h files are
> > > generated by COFF2C. And I want to get the assembly code from these .h
> > file
> > > what should I do? Or anyone knows how COFF2C generated .h file with coff
> > > file so I can write a tool to make .h back coff.
> >
> > coff2c does not generate source code from a COFF file and is not a step in
> > that
> > direction. It extracts COFF sections -- executable code (.text section),
> > .const,
> > .cinit, and any other other initialized sections -- and stores in a
> > standard .h
> > file. There is some C code that goes along with it that you can use to
> > load the
> > sections into a TI DSP at run-time; i.e. before releasing Reset.
> >
> > It's basically a free version of TI's hex6x.exe and hex500.exe programs --
> > they
> > functionally accomplish the same thing.
> >
> > Here is a page with an example of using coff2c:
> >
> > http://www.cadenux.com/bsp/CadenuxArmDriverGuide.html
> >
> > The above page describes how to load a DSP executable from an ARM core for
> > dual-core
> > TI devices, for example C5471, various DM2x, DM2x, and DM6x, devices and
> > OMAP 1510,
> > 5910 and other OMAP devices.
> >
> > -Jeff