What could be a possible reason for camera to enter an infinite loop while booting? This is what I'm trying to do:
1) Implement reset code in main.c (my_restart), this is what seems reasonable to me, looking at 0xFC0B971A
asm volatile (
"LDR R1, =0xD4010008\n"
"MVN.W R0, #0xF0000000\n"
"SUBS R1, #8\n"
"STR R0, [R1,#0xC]\n"
"STR R0, [R1,#0x1C]\n"
"STR R0, [R1,#0x2C]\n"
"STR R0, [R1,#0x3C]\n"
"STR R0, [R1,#0x4C]\n"
"STR R0, [R1,#0x5C]\n"
"STR R0, [R1,#0x6C]\n"
"STR R0, [R1,#0x7C]\n"
"STR.W R0, [R1,#0x8C]\n"
"STR.W R0, [R1,#0x9C]\n"
"STR.W R0, [R1,#0xAC]\n"
"STR.W R0, [R1,#0xBC]\n"
"STR.W R0, [R1,#0xCC]\n"
"STR.W R0, [R1,#0xDC]\n"
"STR.W R0, [R1,#0xEC]\n"
"STR.W R0, [R1,#0xFC]\n"
"MOVW R1, #0x4FFC\n"
"LDR R0, =0x12345678\n"
"STR R0, [R1]\n"
"MOV.W R0, #7\n"
"MCR p15, 0, R0,c6,c2, 0\n"
"MOV.W R1, #0\n"
"MCR p15, 0, R1,c6,c1, 0\n"
"MOV.W R1, #9\n"
"MCR p15, 0, R1,c6,c1, 2\n"
"MOVW R1, #0x121\n"
"MCR p15, 0, R1,c6,c1, 4\n"
"MRC p15, 0, R0,c1,c0, 0\n"
"BIC.W R0, R0, #0x20000\n"
"ORR.W R0, R0, #1\n"
"DSB.W SY\n"
"MCR p15, 0, R0,c1,c0, 0\n"
"ISB.W SY\n"
//"LDR R0, =(loc_FC020000+1)"
"MOV R0, %0\n" //new jump-vector
"add R0, R0, #1\n"
//"POP.W {R4,LR}"
"BX R0\n"
: : "r"(MEMISOSTART), "r"((blob_chdk_core_size+3)>>2) : "memory","r0","r1","r2","r3","r4"
);
2) Implement a plain copy of firmware boot sequence starting at 0xfc02000c in boot(), with just the addition of code to turn on a LED
In this configuration, whenever I start the camera, the LED starts blinking indefinitely, indicating that the camera is entering an infinite loop of restarts.
3) If, alternatively, I implement a reset code similar to the one for the sx270 (below), the camera enters the boot() function successfully (LED turns on just once) however it shuts down immediately (LED automatically turns off)
asm volatile ( "mov r1, %1\n"
"mov r0, %0\n"
"ldr r2, =0xFC1361CF\n" // address for sx60 100B
"blx r2\n" // caching related routine called at fw startup
"mov r0, %0\n"
"add r0, r0, #1\n"
"bx r0\n"
: : "r"(MEMISOSTART), "r"((blob_chdk_core_size+3)>>2) : "memory","r0","r1","r2","r3","r4"
);
Any idea about what could go wrong here? Thanks in advance!