At this point I encounter my first difficulty. I am using objdump to do the disassembly and it is treating the file as a series of 32 bit ARM opcodes. However this is encoded at Thumb instructions, so that is all wrong.
I routinely compile code for STM32 controllers and then use objdump to disassemble them using:
arm-none-eabi-objdump -d hydra.elf >hydra.dumpI might add the "-z" switch to this, but the point is that I won't solve my problem by finding "thumb" switches for objdump, I need to change the ELF header generated by my wrap program. I can look at hydra.elf to see what the header needs to look like.
--disassembler-options=force-thumb.I add this switch to the objdump line as per:
arm-none-eabi-objdump --disassembler-options=force-thumb -d -z demo.elf >demo.disI have to inject the 32 bit constants (such as the vector table) myself, as now it disassembles everything as thumb instructions. Also note that all jumps have odd addresses, this tells the processor to remain in (or to be in) thumb mode after the jump. The actual address has the low bit forced to zero. This is no surprise and not any flaw of the disassembly.
Tom's Computer Info / tom@mmto.org