A1200
I have started the learn the process of porting CHDK to the firmware of a Canon camera. Since I already own the A1200 camera I will try to port the CHDK for this camera.
The reason I choose the Canon A1200 was the pricing and that it is powered by "AA" size batteries, which is a good feature on long hikes in the mountains where you have limited
possibilities to recharge batteries. That was the two main reasons, cheap and powered by "AA" batteries. After the first hike I became really aware of the limitations of exposure control
but luckily i found the CHDK community. SO now I am excited to get started with the porting process and share the port if it is successful. I have experience in C-programming but no experience in
assembler language so what a good opportunity to learn assembler!
This is what i done so far:
I have managed to try out some scripts on the A1200 camera:
1. Version request with ver.req, putting a message to the lcd screen and blinking the LEDS
2. Dump the firmware whit the use of uDumper, firmware was 1.00A
3. I dissassembled the firmware whit the GPL method with the disassemble.pl shell script
From this point I am planning to use the CHDK-shell to compile my efforts.
I have looked at the code of finished ports that can be found in the "Trunk 1631" of CHDK-shell. I looked at boot.c for the sx220hs, I understand that I need to adjust the address settings in the boot.c code (among other things).
This is a part of the boot.c code for the sx220hs:
void __attribute__((naked,noinline)) boot() {
asm volatile (
"loc_FF00000C:\n"
"LDR R1, =0xC0410000\n"
"MOV R0, #0\n"
"STR R0, [R1]\n"
"MOV R1, #0x78\n"
"MCR p15, 0, R1,c1,c0\n" // control reg
"MOV R1, #0\n"
"MCR p15, 0, R1,c7,c10, 4\n" // drain write buffer
"MCR p15, 0, R1,c7,c5\n" // flush instruction cache
"MCR p15, 0, R1,c7,c6\n" // flush data cache
"MOV R0, #0x3D\n" // size 2GB base 0x00000000
"MCR p15, 0, R0,c6,c0\n" // protection region 0
"MOV R0, #0xC000002F\n" // size 16M base 0xc0000000
"MCR p15, 0, R0,c6,c1\n"
"MOV R0, #0x35\n" // SX220 size 128M base 0x00000000 (s90 is 64M)
"MCR p15, 0, R0,c6,c2\n"
"MOV R0, #0x40000035\n" // SX220 size 128M base 0x40000000 (s90 is 64M)
"MCR p15, 0, R0,c6,c3\n"
"MOV R0, #0x80000017\n" // size 4k base 0x80000000
"MCR p15, 0, R0,c6,c4\n"
"LDR R0, =0xFF80002F\n" // SX220 size 8M base 0xff800000
"MCR p15, 0, R0,c6,c5\n"
This is the 21 first lines from the top of the disassembled firmware 1.00A of the A1200:
ff810000: ea000001 b loc_ff81000c
"gaonisoyP":
ff810004: 6e6f6167 powvsez f6, f7, f7
ff810008: 796f7369 stmvcdb pc!, {r0, r3, r5, r6, r8, r9, ip, sp, lr}^
loc_ff81000c:
ff81000c: e59f1150 ldr r1, [pc, #336] ; ff810164: (c0410000)
ff810010: e3a00000 mov r0, #0 ; 0x0
ff810014: e5810000 str r0, [r1]
ff810018: e3a01078 mov r1, #120 ; 0x78
ff81001c: ee011f10 mcr 15, 0, r1, cr1, cr0, {0}
ff810020: e3a01000 mov r1, #0 ; 0x0
ff810024: ee071f9a mcr 15, 0, r1, cr7, cr10, {4}
ff810028: ee071f15 mcr 15, 0, r1, cr7, cr5, {0}
ff81002c: ee071f16 mcr 15, 0, r1, cr7, cr6, {0}
ff810030: e3a0003d mov r0, #61 ; 0x3d
ff810034: ee060f10 mcr 15, 0, r0, cr6, cr0, {0}
ff810038: e3a001bf mov r0, #-1073741777 ; 0xc000002f
ff81003c: ee060f11 mcr 15, 0, r0, cr6, cr1, {0}
ff810040: e3a00033 mov r0, #51 ; 0x33
ff810044: ee060f12 mcr 15, 0, r0, cr6, cr2, {0}
ff810048: e3a001cd mov r0, #1073741875 ; 0x40000033
At this point I am kind of stuck. What should I do as the next step? How should the boot.c of sx220hs be adjusted?