(gdb) symbol-file dump.bin.elf
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 0036a640 ff810000 ff810000 00000034 2**0
CONTENTS, CODE
Mh, I compared with my file. I got:
CONTENTS, ALLOC, LOAD, CODE
Try arm-objcopy --set-section-flags .data=load, ... mh, or let's correct the disassemble.pl script in line 48 !
whats does "No function contains program counter for selected frame." means?
Pain in the ase!
You are going to run the chdk boot in qemu?
The gotcha is, it copies himself. Look for *.elf/*.dump files in chdk build dir.
(gdb) restore ../chdk.trunk/bin/DISKBOOT.BIN binary 0x1900
Restoring binary file ../chdk.trunk/bin/DISKBOOT.BIN into memory (0x1900 to 0x2ec04)
(gdb) b *0x1900
Breakpoint 2 at 0x1900
(gdb) j *0x1900
Continuing at 0x1900.
No function contains program counter for selected frame.
(gdb) add-symbol-file ../chdk.trunk/loader/ixus80_sd1100/main.elf 0x1900
add symbol table from file "../chdk.trunk/loader/ixus80_sd1100/main.elf" at
.text_addr = 0x1900
(y or n)
Reading symbols from /home/turboB/Softw/ixus/chdk.trunk/loader/ixus80_sd1100/main.elf...(no debugging symbols found)...done.
(gdb) x/16i $pc
0x1900 <link_text_start>: ldr r3, [pc, #32] ; 0x1928 <link_text_start+40>
0x1904 <link_text_start+4>: mov r2, #68 ; 0x44
0x1908 <link_text_start+8>: str r2, [r3]
0x190c <link_text_start+12>: mov r3, #32768 ; 0x8000
0x1910 <link_text_start+16>: sub r3, r3, #1 ; 0x1
0x1914 <link_text_start+20>: cmp r3, #0 ; 0x0
0x1918 <link_text_start+24>: bne 0x1910 <link_text_start+16>
0x191c <link_text_start+28>: mov sp, #6400 ; 0x1900
0x1920 <link_text_start+32>: mov r11, #0 ; 0x0
0x1924 <link_text_start+36>: b 0x192c <my_restart>
0x1928 <link_text_start+40>: eorgt r0, r2, r8, asr #32
0x192c <my_restart>: mov r0, #0 ; 0x0
0x1930 <my_restart+4>: mov r1, r0
---Type <return> to continue, or q <return> to quit---
b *0x50000 <- RERESTART
c
Breakpoint 2, 0x00050000 in ?? ()
add-symbol-file ../chdk.trunk/loader/ixus80_sd1100/resetcode/main.elf 0x50000
add symbol table from file "../chdk.trunk/loader/ixus80_sd1100/resetcode/main.elf" at
.text_addr = 0x50000
(y or n)
Reading symbols from /home/turboB/Softw/ixus/chdk.trunk/loader/ixus80_sd1100/resetcode/main.elf...(no debugging symbols found)...done.
(gdb) x/16i 0x50000
0x50000 <link_text_start>: mov sp, #6400 ; 0x1900
0x50004 <link_text_start+4>: mov r11, #0 ; 0x0
0x50008 <link_text_start+8>: b 0x5000c <copy_and_restart>
0x5000c <copy_and_restart>: cmp r1, r0
0x50010 <copy_and_restart+4>: mov r12, r0
0x50014 <copy_and_restart+8>: bcs 0x50054 <copy_and_restart+72>
0x50018 <copy_and_restart+12>: add r3, r1, r2
0x5001c <copy_and_restart+16>: cmp r0, r3
0x50020 <copy_and_restart+20>: movcc r0, r3
0x50024 <copy_and_restart+24>: addcc r1, r12, r2
0x50028 <copy_and_restart+28>: bcc 0x50038 <copy_and_restart+44>
0x5002c <copy_and_restart+32>: b 0x50054 <copy_and_restart+72>
0x50030 <copy_and_restart+36>: ldrb r3, [r0, #-1]!
Yes, it works. However, finally it crashes just like my real cam.
(gdb) restore ../chdk.trunk/core/main.elf
Restoring section .text (0xbff60 to 0xeb8a4)
Restoring section .data (0xeb8a4 to 0xed0a8)
(gdb) add-symbol-file ../chdk.trunk/core/main.elf 0xbff60
(gdb) p boot
$5 = {<text variable, no debug info>} 0xd5974 <boot>
(gdb) j boot