HomeForumsWhat's newResources 
 
 
converting SGL from COFF to ELF
RockinB - May 9, 2005
 RockinB May 9, 2005
It appears that files got different architectures(flags, HAS_*) after conversion(sh->sh4, 0x30->0x10, HAS_LOCALS->).

objcopy sets architecture from input file only, so no chance to do that manually.

Code:
  
sh-elf-objdump -f sglA00.o

sglA00.o: file format coff-sh

architecture: sh, flags 0x00000030:

HAS_SYMS, HAS_LOCALS

...

sh-elf-objcopy -Icoff-sh -Oelf32-sh sglA00.o

sh-elf-objdump -f sglA00.o

sglA00.o: file format elf32-sh

architecture: sh4, flags 0x00000010:

HAS_SYMS

...

I decided to take format elf32-sh because a file compiled with sh-elf-gcc -m2 got that format.

Is there any problem with that? I tried to link to the ELF version of SGL, but the linker reports unknown references...

 RockinB May 10, 2005
I got the linking done with ELF.

The MAP file got a new section called .rodata.

Anyone knows what this is? It's only 8 Bytes long and starts at 0x54.

That's why my sl.bin is about 100 MB when I use objcopy.

I removed that section, but the binary didn't work in Satourne. So I gues I need to edit the link script to move the section elsewhere....

 RockinB May 10, 2005
The elf binary produces an error when running in Saturnin and Satourne emulators.

I have no clue yet why the elf binary doesn't work, but the coff binary does.

Here is a file with binary, map and disassembly of the elf and coff version of SGL's DEMO_A:

[attachmentid=1259]

If anyone can give me a hint. I don't know much about the differences in a elf and coff toolchain.

 RockinB May 11, 2005
I guess it's the ELF version of SGL which makes the DEMO_A binary crash. But I won't verify that by compiling a SBL example now.

(vbt, did you use SGL startup code in your SBL apps?)

Aother conversion option:

Anyone thought of re-assembling the SGL? If as can optimize, we could possibly speed it up. Problem is just to generate asm from object files with objdump, which would need some AWK preprocessing...

(well, I've tried that on a simple file by hand)

Anyways, I'll focus on COFF for now.

Now I'm looking for some good tutorials.

Any suggestions?

Question:

How to do DOS commands like copy, move in a makefile

(unix mode)?

 vbt May 12, 2005

  
	
	
Originally posted by Rockin'-B@Thu, 2005-05-12 @ 12:10 PM

I guess it's the ELF version of SGL which makes the DEMO_A binary crash. But I won't verify that by compiling a SBL example now.

(vbt, did you use SGL startup code in your SBL apps?)



Not at all, I rebuilt and corrected everything needed to boot a SBL sample. I thought you had already manage to do this task. I found that not so easy, I could give you the objects needed to start a SBL app (strt_g.o or something like that)

 antime May 12, 2005
I don't know offhand what the problem is, but converting unlinked objects is even less guaranteed to work than fully linked ones. I wouldn't worry about the different flags, AFAIK the HAS_LOCALS flag is COFF-specific. There is no problem with the files being marked as "sh4", . The main use is to differentiate the files from the 64-bit sh5.

The ".rodata" section is defined in the ELF specification, and is intended for read-only data. As you noticed, sections not assigned a location in your link script will be placed starting at location zero. What script did you use?

Copying files etc. in your makefiles is done just like compiling. Make doesn't care about what commands it's generating.

 RockinB May 12, 2005

  
	
	
Originally posted by vbt+Thu, 2005-05-12 @ 07:40 PM-->
QUOTE(vbt @ Thu, 2005-05-12 @ 07:40 PM)
Not at all, I rebuilt and corrected everything needed to boot a SBL sample. I thought you had already manage to do this task. I found that not so easy, I could give you the objects needed to start a SBL app (strt_g.o or something like that)

[post=133953]Quoted post[/post]

[/b]



It's the first time I really tried to deal with SBL.

Do you know the difference between:

strt1_g.src, strt1_h.src

strt2_g.c strt2_h.c