Disassembling a flat SH-4 binary using objdump?

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Multimedia Mike
DC Developer
DC Developer
Posts: 35
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Mar 17, 2011 11:57 pm
Has thanked: 0
Been thanked: 0
Contact:

Disassembling a flat SH-4 binary using objdump?

Post by Multimedia Mike »

If I have an SH-4 binary in ELF format, disassembling is pretty straightforward:

Code: Select all

sh-elf-objdump -d file.elf
However, I have some old SH-4 binaries compiled for the Dreamcast that are flat binary files to be loaded at and executed from 0x8c010000. It seems like I should be able to disassemble such a file using objdump by passing parameters that specifies a starting address and indicating the fact that it's a flat binary file.

I actually figured out a more complicated method for disassembling these raw binaries. I just remained convinced that there must be a more straightforward method using objdump.
Ex-Cyber
DCEmu User with No Life
DCEmu User with No Life
Posts: 3641
Joined: Sat Feb 16, 2002 1:55 pm
Has thanked: 0
Been thanked: 0

Re: Disassembling a flat SH-4 binary using objdump?

Post by Ex-Cyber »

I don't have an actual SuperH toolchain built right now to check, but I think you want something like:

Code: Select all

sh-elf-objdump -b binary -m sh4 -EL --adjust-vma=0x8c010000 -D file.bin
"You know, I have a great, wonderful, really original method of teaching antitrust law, and it kept 80 percent of the students awake. They learned things. It was fabulous." -- Justice Stephen Breyer
Multimedia Mike
DC Developer
DC Developer
Posts: 35
Joined: Thu Mar 17, 2011 11:57 pm
Has thanked: 0
Been thanked: 0
Contact:

Re: Disassembling a flat SH-4 binary using objdump?

Post by Multimedia Mike »

Ex-Cyber wrote:I don't have an actual SuperH toolchain built right now to check, but I think you want something like:

Code: Select all

sh-elf-objdump -b binary -m sh4 -EL --adjust-vma=0x8c010000 -D file.bin
Thanks! That works. My overcomplicated solution was to convert the raw binary to a sequence of hex numbers printed in text, place them into a skeleton ASM file and use GNU as and ld to construct an ELF file, then disassemble that. That also worked but I like your solution better. :)
Post Reply