how to extend to load COFF executable image file
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · casmac
Hello,
Thanks for the detailed explaination and insightful advise!!
I firstly give a try to use objcopy from GNU binutils, but it seems the COFF file I am work on (which is generated by TI's CCS IDE) cannot be recognized. The COFF format used by TI sllightly differs from GNU's definition. So I guess I have to parse and load the COFF file myself.
Ha. Over a decade ago I had to deal with TI's weirdo COFF file variant. I took the approach of getting binutils to handle it at least sufficiently to do COFF-to-ELF conversion:
http://www.chiark.greenend.org.uk/~pmaydell/misc/binutils.notes.txt
http://www.chiark.greenend.org.uk/~pmaydell/misc/binutils.patch.txt
though I imagine that getting that to work with a modern binutils might be a bit of a pain.
Quoted 6 lines
As far as I understand how a COFF executable file is organized, there are generally 3 section 'chuncks' to load. A section chunck may contain mutilple sections. For example, a program may contain 3 section chucks:
Section chucks: target address on DSP processor
Chunk 1 = txt + bss0x1000
Chunck 2= cio+const+data+stack0x800000
Chunck3 = vector0x809fc1
Now, I am trying to make use of "ROM blobs" androm_add_blob()call. I am confused about how to map the sections to blobs, one ROM for one section(for example .txt) , or one ROM for a section chunk?
You want one ROM blob for each contiguous lump of guest memory for which you have data to provide. Guest memory which is all-zeroes you can either do by passing a block of zeroes to rom_add_blob(), or for the special case where the zeroes directly follow a lump of other data, you can use rom_add_elf_program() to avoid having to allocate the zeroes.
Quoted 1 line
Meanwhile, how to use the fileds from the Rom struct:
You don't need to look at the rom struct fields. Just call either rom_add_blob() or rom_add_elf_program() and those functions will handle the rom struct for you.
thanks
-- PMM