ReadSDCard function - General Discussion and Assistance - CHDK Forum supplierdeeply

ReadSDCard function

  • 3 Replies
ReadSDCard function
« on: 07 / January / 2009, 10:05:04 »
Hello, I see that there is a WriteSDCard function that exists in CHDK. I've used this and it works fine. Is there any aim in CHDK development to implement the ReadSDCard function? i.e. if you want to read raw sectors off the SD card. I assume that the memory address will have to be found for this. Is there any specific assembler code I should be looking for in the Canon firmware dump for my camera in order that I can put an entry in my stubs_entry_2.S?



Offline ewavr

  • ****
  • 1057
  • A710IS
Re: ReadSDCard function
« Reply #1 on: 08 / January / 2009, 11:50:43 »
This is typical code for search ReadSDCard function (called from Mount_FileSystem, example for a710):
Code: [Select]
ROM:FFC5FCD4 sub_FFC5FCD4                            ; CODE XREF: Mount_FileSystem+10p
ROM:FFC5FCD4                                         ; sub_FFC603F8+2Cp
ROM:FFC5FCD4                 LDR     R3, =0x2748     ; Load from Memory
ROM:FFC5FCD8                 LDR     R2, [R3]        ; Load from Memory
ROM:FFC5FCDC                 CMP     R2, #0          ; Set cond. codes on Op1 - Op2
ROM:FFC5FCE0                 MOVNE   PC, LR          ; Rd = Op2
ROM:FFC5FCE4                 CMP     R0, #0          ; Set cond. codes on Op1 - Op2
ROM:FFC5FCE8                 LDR     R1, =0x2C4A8    ; Load from Memory
ROM:FFC5FCEC                 MOVNE   PC, LR          ; Rd = Op2
ROM:FFC5FCF0                 LDR     R3, =WriteSDCard ; Load from Memory
ROM:FFC5FCF4                 LDR     R2, =ReadSDCard ; Load from Memory
ROM:FFC5FCF8                 STR     R3, [R1,#0x50]  ; Store to Memory
ROM:FFC5FCFC                 MOV     R3, #3          ; Rd = Op2
ROM:FFC5FD00                 STR     R0, [R1,#0x38]  ; Store to Memory
ROM:FFC5FD04                 STR     R3, [R1,#0x3C]  ; Store to Memory
ROM:FFC5FD08                 STR     R2, [R1,#0x4C]  ; Store to Memory
ROM:FFC5FD0C                 STR     R0, [R1,#0x34]  ; Store to Memory
ROM:FFC5FD10                 MOV     PC, LR          ; Rd = Op2

Re: ReadSDCard function
« Reply #2 on: 09 / January / 2009, 06:06:22 »
Many thanks. I'll start looking through my disassembled code now.

Re: ReadSDCard function
« Reply #3 on: 13 / January / 2009, 10:21:56 »
Sorted, I've found it.

I looked in stubs_entry_2.S for the address for WriteSDCard. I searched for references to it in the disassembly. Lo and behold it brought me to a function very similar to the one that you listed. I tried using the address that was in the line after the line with the WriteSDCard address in (as it is in your code listing) and some testing showed that this was indeed the ReadSDCard function.


The address for ReadSDCard in case anyone is interested is 0xFFAAC178 for IXUS 70 1.01C.
« Last Edit: 03 / June / 2009, 04:23:06 by chdkess »


Related Topics