qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to extend to load COFF executable image file


From: Peter Maydell
Subject: Re: how to extend to load COFF executable image file
Date: Thu, 14 May 2020 09:51:25 +0100

On Thu, 14 May 2020 at 09:44, casmac <address@hidden> wrote:
>
> 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.

>    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 + bss                                  0x1000
> Chunck 2= cio+const+data+stack             0x800000
> Chunck3 = vector                                    0x809fc1
>     Now, I am trying to make use of "ROM blobs" and rom_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.

> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]