PDA

View Full Version : sh-elf-objcopy problem - file gets truncated



showka
February 5th, 2006, 03:40
Hey guys, I'm brand new to all of this stuff and decided to get started by downloading that Dev Iso linked to by DcEmu.Co.Uk awhile back.

I went through the quite well done set up instructions, and installed CygWin as well as KOS.

Anyway, I don't have a coder's cable yet (though I'll be getting one soon). So far I've been able to run make in all of the included examples and the expected files are produced, ie running make from /usr/local/dc/kos/kos/examples/dreamcast/hello produces the files hello.elf as well as romdisk.img and romdisk.o.

Before this, all I've ever done is burnt apps using Boot Dream or stuff like that, so I know I'm missing the all important 1st_read.bin.

I *think* I've found the command which should be turning the hello.elf file into 1st_read.bin, which is as follows:
sh-elf-objcopy -O binary hello.elf 1st_read.bin

The problem is that I keep getting this output:
sh-elf-objcopy: 1st_read.bin: File truncated

1st_read is created but is 0 kb in explorer. It of course doesn't work.
I've also tried a utility called "elf2bin". It acts like it works, but the same thing happens, 1ST_READ.bin is 0 kb, which makes me think maybe something in my config is screwed up.

I've Googled +sh-elf-objcopy +file truncated and found two forum posts, the first were a guy had a similar problem to mine and another one and no one answered :p and another one where someone did respond and made it seem like it was a problem with sh-elf-objcopy (??).

http://www.dcemu.co.uk/vbulletin/archive/index.php/t-4952.html
http://www.dcemu.co.uk/vbulletin/archive/index.php/t-48.html

If anyone knows what the cause of this problem is or what I can do about it, I'd be very greatful. Even a link or something would be nice.

quzar
February 5th, 2006, 05:45
sh-elf-objcopy -O binary -R .stack hello.elf 1st_read.bin

showka
February 5th, 2006, 06:31
Hey, thanks a lot quzar! Those switches fixed everything!

This is pretty exciting. :)

I just ordered the coder's cable. I don't think I'll be able to stop myself from wasting a lot of CDs before it gets here, though.

rrgomes
June 19th, 2006, 06:25
I have a problem a little bit different.
sh-elf-objcopy gives me "No space left on device."
What it could be?



sh-elf-objcopy -O binary -R .stack test.elf test.bin
c:\Dev-Cpp\sh-elf\bin\sh-elf-objcopy.exe: test.bin: No space left on device


File sizes:
main.o : 17kB
test.elf: 721kB

I'm not sure what flags use in the compiler/linker also...
I used these one:
Compiler:
-Wall -g -ml -m4-single-only -O2 -fno-builtin -fno-strict-aliasing -fomit-frame-pointer -fno-optimize-sibling-calls -D_arch_dreamcast
Linker:
-ml -m4-single-only -nostartfiles -nostdlib -Wl,-Ttext=0x8c010000
"C:\Dev-Cpp\sh-elf\startup.o" -lpng -lz -lm -lkallisti -lgcc
Is anything wrong?
Thanks in advance,
Rodolfo

i forgot to say: My version of sh-elf-objcopy is 2.11.2