objdump doesn't seem to support armv7m architecture

Asked by Todd Thompson

When I run objdump help and look at the supported architectures, I don't see armv7m. In fact, nothing later than armv5 shows up. I'm trying to disassemble a Cortex M3 binary file that I don't have the elf/axf file (or any other source/out files other than the final binary) and I think I would need armv7m support in objdump to do that. Is there another way to do it? Or is this really missing from objdump at the moment? This is using the latest release 4.8 on windows. Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
Todd Thompson
Solved:
Last query:
Last reply:
Revision history for this message
Terry Guo (terry.guo) said :
#1

Hi Todd,

Agree that the help message may be outdated. The objdump in 4.8 major release does support armv7m. It can read target information from head of ELF file. If you have only binary file, I guess you need following options to tell the target information to objdump:

  -b, --target=BFDNAME Specify the target object format as BFDNAME
  -m, --architecture=MACHINE Specify the target architecture as MACHINE

BR,
Terry

Revision history for this message
Terry Guo (terry.guo) said :
#2

Command like below works for me:

arm-none-eabi-objdump -b binary -marm -D x.bin -Mforce-thumb

Revision history for this message
Todd Thompson (toddt) said :
#3

Thanks Terry. I was expecting/hoping (and had tried) to use:
arm-none-eabi-objdump -b binary -marmv7m -D filename.bin

This, of course, didn't work. The error was "unsupported architecture". When I look at the architectures supported by objdump I don't see armv7m. I didn't think to just try arm. Are you saying that the option -marm will correctly/completely disassemble the Cortex M3 binary so an armv7m option isn't necessary? I was expecting to be able to use the same architecture options as on the other tools.

I think I had also tried just:
arm-none-eabi-objdump -b binary -D filename.bin
(with no architecture specified) and that didn't work. I forget what the error message said...

I'm not sure if this solves the problem. If you tell me that just using the -marm option with the -Mforce-thumb will completely and correctly disassemble a Cortex M3 binary, then I'll close out my question. I'd suggest maybe adding armv7m to the architectures supported just so this tool matches the others and maybe have the default be -marm if -b binary is specified and no architecture is selected. But it could just me not being clear the difference in the instruction set between a generic arm/thumb and armv7m. If I felt sure they were the same, I might not have worried about it. I need a reliable disassembly of this binary file.

Best,

Todd

Revision history for this message
Terry Guo (terry.guo) said :
#4

Hi Todd,

I got your point. The support of -marmv7m can make things more precise and clear. IMHO, I think the -marm and -Mforce-thumb are good enough to correctly disassemble the bin file. And I think it is deterministic when we disassemble a bit stream. If there are two possible interpretations for a bit stream, then the processor itself also could be misguided, considering what the process takes are just bin. My conclusion is based on my understanding and experience, I might be wrong. If so, please correct me. Thanks.

BR,
Terry

Revision history for this message
Todd Thompson (toddt) said :
#5

Seems to work good enough. Thanks!