Bought this camera a few days ago, have started porting CHDK to it. Based off the A2300 & A3400 port. Using IDA and OS X. First time porting, long time since I've done any ASM.
Camera info:
DRYOS R50 (DRYOS version 2.3, release #0050)
Firmware Ver GM1.00D
Canon PowerShot A2400 IS
PLATFORMID=12873
MEMBASEADDR=0x1900
EXMEM_HEAP_SKIP=0x2DB400
MEMISOSTART=0x158080
Firmware dump:
http://www.sendspace.com/file/mzdvy3Loader: runs
boot(): runs
First jump after boot(): runs. Power button detection appears to be at 0x24B0 not 0x24B8 like its siblings (a810,a2300,etc)
Second jump after boot(): runs.
Third jump after boot(): function does not appear to run.
Adding some inline ASM to turn on the LED, I see that it bails out in this function:
void __attribute__((naked,noinline)) sub_FF8111D8_my( ) {
asm volatile (
"STR LR, [SP, #-4]! \n"
...
"STR R0, [SP, #4] \n"
#if defined(OPT_CHDK_IN_EXMEM)
"LDR R0, =0x158080 \n" // MEMISOSTART: Use original heap offset since CHDK is loaded in high memory
#else
"LDR R0, =new_sa\n" //otherwise use patched value
"LDR R0, [R0]\n"
#endif
....
"STR R0, [SP, #0x68] \n" // execution reaches here
//"LDR R1, =sub_FF814288 \n" //original
"LDR R1, =sub_FF814288_my \n" //patched
"MOV R2, #0 \n"
"MOV R0, SP \n" // this runs
"BL sub_003F2778 \n" //RAM
"ADD SP, SP, #0x74 \n" // this doesn't
"LDR PC, [SP], #4 \n"
);
}
If I'm reading my ASM right, at the end of
sub_FF8111D8_my it loads R1 with address of
sub_FF814288_my, sets up a couple of arguments, then jumps into RAM. Adding the LED ASM to the start of
sub_FF814288_my shows that it never gets there. What does the BL to RAM do?
I saw that stubs_auto.S didn't have an entry for FF814288, however I regenerated this file and compiled again and still no joy.
Does anyone have any pointers or suggestions of where I'm going wrong? a2300/100e and a2400/100d are pretty close matches and very few addresses have changed in the code executed up to this point, so I'm a bit stumped why it does execute.
Thanks for any assistance,
--Michael