port for A3300IS / what reference port to use? - page 7 - General Discussion and Assistance - CHDK Forum  

port for A3300IS / what reference port to use?

  • 289 Replies
  • 104628 Views
Re: Re: port for A3300IS / what reference port to use?
« Reply #60 on: 31 / December / 2011, 12:50:16 »
Advertisements
It booted, I saw the chdk logo, then it went to my no image screen and froze  8]
Excellent ! You are on your way!
Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #61 on: 31 / December / 2011, 12:55:16 »
I noticed there are many commented lines in the section I was having issues with, should they be uncommentd to match the firmware exactly?

Re: port for A3300IS / what reference port to use?
« Reply #62 on: 31 / December / 2011, 13:06:03 »
Also, what du reccomend I do, is there something that needs to be fixed in the taskcreatePhySw_my section to enable the line I just disabled?

Or do I leave it disabled and go on to another file?

Re: port for A3300IS / what reference port to use?
« Reply #63 on: 31 / December / 2011, 13:22:49 »
Also, what du reccomend I do, is there something that needs to be fixed in the taskcreatePhySw_my section to enable the line I just disabled?  Or do I leave it disabled and go on to another file?
You probably want to get  taskcreatePhySw_my working so that you can use the camera keys to interact with CHDK.

This may not be your problem (at least not your only problem) but there is a bit of assembly code buried in platform/a3300is/kbd.c that can bite you here if its wrong.

Code: [Select]
long __attribute__((naked,noinline)) wrap_kbd_p1_f()
{
asm volatile(
"STMFD   SP!, {R1-R5,LR}\n"
"MOV     R4, #0\n"
//"BL      _kbd_read_keys \n"
"BL my_kbd_read_keys\n"
"B       _kbd_p1_f_cont\n"
);
return 0; // shut up the compiler
}
You need to find the equivalent in the ROM dump and make sure the registers used in STMFD are right.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: port for A3300IS / what reference port to use?
« Reply #64 on: 31 / December / 2011, 13:38:51 »
I noticed there are many commented lines in the section I was having issues with, should they be uncommentd to match the firmware exactly?
Everything after line 393 can be deleted (or left commented out).  The code returns to running in ROM at that point. Make sure you have the address right of coarse.

Code: [Select]
"B sub_FF83426C \n" // added, continue in firmware
Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #65 on: 31 / December / 2011, 14:58:20 »
By the way, all the registers in kbd.c match.

Cant seem to figure out what is causing the problem, I tried commenting out everything in taskcreatePhySw_my to see what makes the debug light go on with line 361 uncommented in the task_Startup_my, the only one that seems to make the light come on is if I comment out the first line       "STMFD   SP!, {R3-R5,  LR} \n" No boot when doing that though, just debug light.

Update, uncommenting the line 360  "BL   sub_FF834190 \n" allows boot up and debug flash to stay on and also it doesnt freeze, I get a garbled screen on and off and pressing keys does something, I can power on and off now.
« Last Edit: 31 / December / 2011, 15:22:45 by mk11174 »

Re: port for A3300IS / what reference port to use?
« Reply #66 on: 31 / December / 2011, 15:28:54 »
Cant seem to figure out what is causing the problem, I tried commenting out everything in taskcreatePhySw_my to see what makes the debug light go on with line 361 uncommented in the task_Startup_my, the only one that seems to make the light come on is if I comment out the first line       "STMFD   SP!, {R3-R5,  LR} \n" No boot when doing that though, just debug light.
Commenting out the STMFD is 100% guaranteed to cause your camera to crash when the routine its in trys to return.

Quote
Update, uncommenting the line 360  "BL   sub_FF834190 \n" allows boot up and debug flash to stay on and also it doesnt freeze, I get a garbled screen on and off and pressing keys does something, I can power on and off now.
The LED blink code I gave you was just to flash the LED at the start of boot.c.   Putting it other places can cause problems with overwriting registers.

Try this instead :

Code: [Select]
" STMFD SP!, {R0,R1} \n"   
" LDR     R0, =0xC02200D4 \n"
" MOV     R1, #0x46 \n"
" STR     R1, [R0] \n"
" LDMFD SP!, {R0,R1} \n"

with the address of which ever LED you want to use in the second line.  Should be safer to use in various parts of the code.


Ported :   A1200    SD940   G10    Powershot N    G16

Re: port for A3300IS / what reference port to use?
« Reply #67 on: 31 / December / 2011, 15:33:32 »
Update, uncommenting the line 360  "BL   sub_FF834190 \n" allows boot up and debug flash to stay on and also it doesnt freeze, I get a garbled screen on and off and pressing keys does something, I can power on and off now.
That makes sense as what you are doing by uncommenting that is allowing the camera's normal keyboard task to run rather than the mykbd_task() you are trying to put in it place.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: port for A3300IS / what reference port to use?
« Reply #68 on: 31 / December / 2011, 15:41:08 »
This is how the code looks now, and led works at where it is too. I also uncommented all hooks i think u cal them, except cap_seq and exp_drv, cam works in lock mode and can take pictures and use like normal.
Code: [Select]
void __attribute__((naked,noinline)) task_Startup_my() {

// sub_FF81FBF4
asm volatile (
"STMFD SP!, {R4, LR} \n"
"BL sub_FF816588 \n"
"BL sub_FF83543C \n"
"BL sub_FF83364C \n"
"BL sub_FF83C018 \n"
"BL sub_FF83C204 \n"
//"BL sub_FF83C0AC \n" // skip starting diskboot.bin again
"BL sub_FF83C3A4 \n"
"BL sub_FF832208 \n"
"BL sub_FF83C234 \n"
"BL sub_FF839944 \n"
"BL sub_FF83C3A8 \n"
"BL CreateTask_spytask \n" // added
"BL sub_FF834190 \n"
"BL taskcreatePhySw_my \n" // patched
"BL sub_FF837B48 \n"
"BL sub_FF83C3C0 \n"
"BL sub_FF831600 \n"
"BL sub_FF832FB0 \n"
"BL sub_FF83BD8C \n"
"BL sub_FF8335EC \n"
"BL sub_FF832F4C \n"
"BL sub_FF83223C \n"
"BL sub_FF83CE60 \n"
"BL sub_FF832F10 \n"
"LDMFD SP!, {R4, LR} \n"
//"B loc_FF8166A8 \n"
"B sub_FF8166A8 \n" // continue in firmware
);

}

void __attribute__((naked,noinline)) taskcreatePhySw_my() {

// sub_FF834248
asm volatile (
"STMFD SP!,{R3-R5,LR} \n"
"LDR R4, =0x1C30 \n"
"LDR R0, [R4, #4] \n"
"CMP R0, #0 \n"
"BNE sub_FF8341C4 \n" // so we can jump right back in to firmware later
"MOV R3, #0 \n"
"STR R3, [SP] \n"
"LDR R3, =task_PhySw \n" // FF83415C
"MOV R2, #0x2000 \n" // stack size for new task_PhySw so we don't have to do stack switch
"B sub_FF83426C \n" // added, continue in firmware
);

}
void spytask(long ua, long ub, long uc, long ud, long ue, long uf) {

core_spytask();
}

void CreateTask_spytask() {
       
        _CreateTask("SpyTask", 0x19, 0x2000, core_spytask, 0);
}

void __attribute__((naked,noinline)) init_file_modules_task() {
*((volatile int *) LED_AF) = 0x46;
// sub_FF8933BC
asm volatile (
"STMFD SP!, {R4-R6,LR} \n"
"BL sub_FF88D7E8 \n"
"LDR R5, =0x5006 \n"
"MOVS R4, R0 \n"
"MOVNE R1, #0 \n"
"MOVNE R0, R5 \n"
"BLNE sub_FF89167C \n"
"BL sub_FF88D814 \n"
"BL core_spytask_can_start \n"      // added, CHDK: Set "it's-safe-to-start"-Flag for spytask
"B sub_FF895864 \n" // added, continue in firmware
);

}

Re: port for A3300IS / what reference port to use?
« Reply #69 on: 31 / December / 2011, 15:46:30 »
So what u mentioned about the mykbd_task() , is that something I need to make work then?

Does that mean I have to re-comment line 360 and try to get it to work?

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal