0

I have an .out file compiled with arm-none-eabi-gcc -mtune=cortex-m3 --specs=nosys.specs.

If I run GDB with arm-none-eabi-gdb a.out and do disas main on the exec I get a reasonably looking disassembly, that closely resembles the C for such a simple test.

If I then do target remote localhost:XXXX to connect to the device over JLink, and load, the disas main is different, not just addresses; longer even.

The load "succeeds" however, in that there is no error on doing so, it reports 'load size' of reasonable amount.

The disassembly after load does change if I change the source, but never seems to resemble the source, and is radically different from disassembly of the executable directly, which closely resembles the source.


My best guess is that the load has not correctly succeeded, what could cause this?

Or if it seems from the above that it did correctly load, why is the disassembly so different?


Update:

I verified that what I'm seeing on disas main after load is actually what it loads (i.e. it's not merging with stuff 'left over' in memory) by manually clearing those addresses with set {long long}0xADDR = 0 repeatedly.

So for some reason load really does seem to be loading something not quite what is in the source elf.

Further, one of the branches that doesn't look correct to me, directs flow to the instruction ldr??.w r7, [r4, #4095]. What on earth does the ?? mean - is it malformed and an invalid type for ldr, so GDB prints ??, and therefore evidence that the load did not perform correctly?

Community
  • 1
  • 1
OJFord
  • 10,522
  • 8
  • 64
  • 98

0 Answers0