PowerShot SX210 IS - Porting Thread - page 13 - General Discussion and Assistance - CHDK Forum

PowerShot SX210 IS - Porting Thread

  • 589 Replies
  • 251206 Views
*

Offline reyalp

  • ******
  • 13456
Re: PowerShot SX210 IS - Porting Thread
« Reply #120 on: 20 / August / 2010, 15:54:57 »
Advertisements
yes, i've already applied that script. i'm not sure whether the order of applying signature/scripts would make any difference?
AFAIK sig should go first, I believe the scripts rely on some things already being identified.
Don't forget what the H stands for.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #121 on: 20 / August / 2010, 16:23:09 »
3) Convert the lib.c from platform\sx210is\sub\100c

almost finish with this file, its relativly easy to match sx200 with sx210 and get the new addresses,Just time consumming

Here you have the file http://www.zshare.net/download/795492156642b952/

I think everthing is allright, double check will be good if someone can,
The only thing I was not able to get yet is the void **fb=(void **)0x2180;   of this function:

Code: [Select]
// Live picture buffer (shoot not pressed) //ASM1989 08.20.2010
void *vid_get_viewport_live_fb()
{
    void **fb=(void **)0x2180;                               // 0x2150 or 0x2180 (old SX200) ???? What for SX210
    unsigned char buff = *((unsigned char*)0x2058);          // found at FF84FA18 (guess work)
    if (buff == 0) buff = 2;  else buff--;
    return fb[buff];
}

any clue from someone?
It is the size of a buffer maybe grater?


Also noticed that the size of the viewport is the same as in sx200, 960x270 ??

anyway here you have the list of correlations between SX200 addresses and the sx210 so far:

SX200   <..>   SX210
FFAC8D6C   <..>   FFB2FC6C
FFAC8A40   <..>   FFB2F7C0
FFAC8D10   <..>   FFB2FB2C
FFAC8D6C   <..>   FFB2FC6C
FF838090   <..>   FF84FA18
FF842AC4   <..>   FF85BE50
FFA2BED4   <..>   FFA7DC10
FFAC67F0   <..>   FFB2C7B4
FF858A84   <..>   FF8743DC
FF859398   <..>   FF8750CC
FF8594F0   <..>   FF875104
FF8E5F40   <..>   FF91CD90
FF8E5F44    <..>   FF91CD94
FF9C1F28   <..>   FFA0E708
« Last Edit: 20 / August / 2010, 16:28:08 by asm1989 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #122 on: 20 / August / 2010, 17:28:30 »
4) Now  platform\sx210is\sub\100c\stubs_min.S

So far this is what I have, http://www.zshare.net/download/79562645194f3624/

unable to find:
DEF(recreview_hold, 0x7434 + 0xD4)  
DEF(zoom_status, 0xb850)            
DEF(movie_status, 0x6588 + 0x38)  
-> The rest please someone confirm them

Code: [Select]
#include "stubs_asm.h"

DEF(physw_status, 0x336C4)                 // found at FF834360  -> ASM1989 08.20.2010
DEF(physw_run, 0x1C24 + 0x0C)             // found at FF8342C4  and FF8342E0 -> ASM1989 08.20.2010
DEF(FlashParamsTable,0xFFC095BC)          // found at FFAD195C -> ASM1989 08.20.2010
DEF(zoom_busy, 0x7124 + 0x1C)             // found at FF969464 -> ASM1989 08.20.2010     ?doubt? 0x14 or 0x1C
DEF(focus_busy, 0x6FC0 + 8)               // found at FF9639D4 -> ASM1989 08.20.2010     ?doubt? + 8
//DEF(canon_menu_active, 0x3688 + 4)        // found at FF891B4C  -> ASM1989 08.21.2010 ?guesswork
DEF(canon_menu_active, 0x3688 + 4)        // StarRecModeMenu @FF891C4C -> ASM1989 08.21.2010 ?guesswork

DEF(canon_shoot_menu_active, 0x8510 + 1)  // sub_FF9B57E4 -> ASM1989 08.21.2010 ?guesswork  why +1 ??

DEF(recreview_hold, 0x7434 + 0xD4)        // (Wrong data from SX200 = found at FF964C10 ) SX210 Pending ???
DEF(zoom_status, 0xb850)                  // (Wrong data from SX200 = found at FFA77128 ) SX210 Pending ???
DEF(movie_status, 0x6588 + 0x38)          // (Wrong data from SX200 = found at found at FFC4C12 (bad address)) SX210 Pending ???

DEF(enabled_refresh_physical_screen, 0x9D48+0x20) //found at FFA1EE18 and FFA1EFB4 -> ASM1989 08.21.2010 ?guesswork
DEF(playrec_mode, 0x33B8+0x4)              // found at FF884178 -> ASM1989 08.21.2010 ?guesswork  why +0x4 ???
DEF(some_flag_for_af_scan, 0x75D8)       //found at FF971750 -> ASM1989 08.21.2010 ?guesswork
  

DEF(led_table, 0x24A0 + 0x04)              // found at FF860EF0  -> ASM1989 08.21.2010 ?guesswork



DEF(levent_table,0xFFBC1084)               // found at FF99A820  -> ASM1989 08.21.2010 ?guesswork please confirm it

For reference:
SX200      SX210
FF821B30   <..>   FF834360
FF821A94   <..>   FF8342C4
FF821AB0   <..>   FF8342E0
FFA751F4   <..>   FFAD195C
FF9342B4   <..>   FF969464
FF92E980   <..>   FF874E38
FF874CFC     <..>   FF891B4C
FF874E3C   <..>   FF891C4C
FF9773AC   <..>   FF9B57E4
   <..>   
FF9D4918   <..>   FFA1EE18
FF9D4F38   <..>   FFA1EFB4
FF86833C   <..>   FF884178
FF93BCF0   <..>   FF971750
FF847378   <..>   FF860EF0
FF9603CC   <..>   FF99A820
« Last Edit: 21 / August / 2010, 02:33:12 by asm1989 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #123 on: 21 / August / 2010, 03:31:31 »
5) This is the platform\sx210is\sub\100c\stubs_entry_ida.S
http://www.zshare.net/download/79563682a15f1335/
(AutoGenerated)


*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: PowerShot SX210 IS - Porting Thread
« Reply #124 on: 21 / August / 2010, 03:32:00 »
The only thing I was not able to get yet is the void **fb=(void **)0x2180;   of this function:
...
any clue from someone?
Indeed, this must be completely opaque to an uninitiated scholar...

First, a quick suggestion: for a start, return 0 in *vid_get_viewport_live_fb(), and return the correct viewport base address in *vid_get_viewport_fb(), which is easy to find from the code that references the "VRAM Address: %p" string.

Now in more detail. Actually, Canon uses (or used to anyway) three buffers, one (first) of them located at the base address, and switches between them about 30 times a second, if I remember correctly. We only need to know which one of them is most recently updated, if we want to speed up motion detection by about 30ms. There is a table somewhere in RAM with the addresses of the buffers, and a variable with the index 0,1,2 into this table. It's these two locations that you may want to find, but I'm afraid there's no generic recipe... They are usually referenced in the code just before, or around "LiveView.c". Here're sample code snippets from the Ixus950 and A720 (sorry, don't have disasms of later cameras):
Code: [Select]
FF9C9E84                 LDR     R3, =0x8C74
FF9C9E88                 LDR     R2, =0x8C58
FF9C9E8C                 LDRB    R0, [R3]
FF9C9E90                 LDR     R1, [R2,R0,LSL#2]
Code: [Select]
FFC2936C                 LDR     R4, =0x2084
...
FFC293B8                 LDRB    R2, [R4]
FFC293BC                LDR     R0, =0x21D0
FFC293C0                 LDR     R2, [R0,R2,LSL#2]
You can verify them in memory browser: the index variable should circle through 0,1,2, and the table should contain three addresses, starting with the VRAM base address.

P.S. When you're finished, you may want to comment the code accordingly. Which few people do, unfortunately.

EDIT: Oops, corrected ixus code...
« Last Edit: 21 / August / 2010, 03:44:36 by whoever »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #125 on: 21 / August / 2010, 04:43:11 »
Thanks Whoever,

Confortable with asm and IDA, but my experience with chdk and ARM is limited yet, since i do some work on the sx200, i'm focusing my efforts on matching sx200 with sx210, and its looks like a successfull aproach at this time,
but someone with more experience in chdk must take the lead. probably Harpoma.

In a first review I was unable to find it, If anyone can take whoever coments and find it will be apreciated.

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #126 on: 21 / August / 2010, 06:06:49 »
5) OK partialy finished platform\sx210is\sub\100c\stubs_entry_2.S

As far as I can go with this one, someone could verify / finish the task.
http://www.zshare.net/download/79570994edd5cb11/

I also found nullsub_1 as labelled in IDA -> FF810B1C    (This address is for sx210)

for now OK at a probability of 90% or +:
Code: [Select]
NHSTUB(AllocateMemory, 0xFFAC3F54)  // -> ASM1989 08.21.2010
NHSTUB(GetSystemTime, 0xFFAC3FAC)   // -> ASM1989 08.21.2010
NHSTUB(EnterToCompensationEVF, 0xFF838598)  // -> ASM1989 08.21.2010
NHSTUB(ExitFromCompensationEVF, 0xFF8385DC) // -> ASM1989 08.21.2010
NHSTUB(TurnOffBackLight, 0xFF8A732C)   // -> ASM1989 08.21.2010
NHSTUB(strchr, 0xFF88FCAC)  // -> ASM1989 08.21.2010
NHSTUB(strrchr, 0xFF814008) // -> ASM1989 08.21.2010
NHSTUB(PostLogicalEventForNotPowerType, 0xFF89538C) // -> ASM1989 08.21.2010
NHSTUB(apex2us, 0xFFA2260C) // -> ASM1989 08.21.2010
NHSTUB(UnlockAF, 0xFF838480) // -> ASM1989 08.21.2010
NHSTUB(DoAFLock, 0xFF8383F0) // -> ASM1989 08.21.2010
NHSTUB(ExpCtrlTool_StartContiAE, 0xFF846458) // -> ASM1989 08.21.2010
NHSTUB(ExpCtrlTool_StopContiAE, 0xFF846530) // -> ASM1989 08.21.2010
NHSTUB(GiveSemaphore, 0xFF83A074) // -> ASM1989 08.21.2010
NHSTUB(eventproc_export_PostLogicalEventToUI, 0xFF8953D8) // -> ASM1989 08.21.2010
NHSTUB(eventproc_export_SleepTask, 0xFF83A2DC) // -> ASM1989 08.21.2010
NHSTUB(eventproc_export_ExitTask, 0xFF81EACC) // -> ASM1989 08.21.2010
NHSTUB(SetScriptMode, 0xFF897340)             // -> ASM1989 08.21.2010

// MAYBE OK, at a probability of 70% or - ( PLEASE SOMENE CHECK THEM TOO)
Code: [Select]
NHSTUB(GetDrive_ClusterSize, 0xFF873868)    // -> ASM1989 08.21.2010 ?? not sure
NHSTUB(GetDrive_FreeClusters, 0xFF8738C8)   // -> ASM1989 08.21.2010 ? Looks like but needs check
NHSTUB(GetDrive_TotalClusters, 0xFF87389C)  // -> ASM1989 08.21.2010 ? Looks like but needs check
NHSTUB(UpdateMBROnFlash, 0xFF8736E8)  // -> ASM1989 08.21.2010 looks the same as the one in the sx200
NHSTUB(qsort, 0xFFB17F74)  // -> ASM1989 08.21.2010 Not sure about this one, but looks like
NHSTUB(WriteSDCard, 0xFF953F88)  // -> ASM1989 08.21.2010 Looks like, but needs confimation
NHSTUB(MakeAFScan, 0xFF970F5C)    // -> ASM1989 08.21.2010 Looks like, but needs confimation
NHSTUB(PostLEDMessage, 0xFF860FF8 )               // -> ASM1989 08.21.2010 Not sure about this one, but looks like
NHSTUB(platformsub_kbd_fetch_data, 0xFF861D88) // -> ASM1989 08.21.2010 Looks like, but needs confimation
//UNABLE TO FIND PLEASE HELP

Code: [Select]
NHSTUB(RefreshPhysicalScreen, 0xFF9D4F7C)   // -> ASM1989 (unable to Find it, Any clue from someone)
NHSTUB(kbd_read_keys_r2, 0xFF847B04)  // -> ASM1989 (unable to Find it, Any clue from someone)
NHSTUB(GetFocusLensSubjectDistance, 0xFF92F7E4) // -> ASM1989 (unable to Find it, Any clue from someone)
NHSTUB(LEDDrive, 0xFF847614) // -> ASM1989 (unable to Find it, Any clue from someone), but func allready in IDA ???
NHSTUB(UnsetZoomForMovie, 0xFF969764)             // old SX200, may not exist because sx210 allready allows zoom in movie

For the record:
SX200      SX210
FFA6954C   <..>   FFAC3F54
FF8606AC   <..>   FFAC3FAC
FF857924   <..>   FF8736E8
FFAAF200   <..>   FFB17F74
FF825748   <..>   FF838598
FF8257F4   <..>   FF8385DC
FF857ACC   <..>   FF873868
FF857B24   <..>   FF8738C8
FF857AF8   <..>   FF87389C
FF889254   <..>   FF8A732C
FF88FCAC   <..>   FF88FCAC
FF9D7430   <..>   FF814008
FF879A08   <..>   FF89538C
FF9D8170   <..>   FFA2260C
FF920E8C   <..>   FF953F88
FF825644   <..>   FF838480
FF82560C   <..>   FF8383F0
FF8303C0   <..>   FF846458
FF830504   <..>   FF846530
FF827228   <..>   FF83A074
FF879A54   <..>   FF8953D8
FF827490   <..>   FF83A2DC
FF81B23C   <..>   FF81EACC
FF93B538   <..>   FF970F5C
FF847470   <..>   FF860FF8
FF87BA80   <..>   FF897340
FF848340   <..>   FF861D88
FF810950   <..>   FF810B1C
« Last Edit: 21 / August / 2010, 10:02:35 by asm1989 »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #127 on: 21 / August / 2010, 10:51:19 »
6) OK, I keep looking for addresses now in the file:platform\sx210is\sub\100c\boot.c

Someone with more experience in chdk and arm should verify and start the real porting, I just try to speed up things, but my knowledge / time is limited too.

I'm just finding the new address in the sx210

So far this is what I have

Code: [Select]
void taskCreateHook(int *p) {
 p-=17;
 if (p[0]==0xFF87EB90)  p[0]=(int)capt_seq_task;    // -> ASM1989 08.21.2010  need to be verified
 if (p[0]==0xFF8342C0)  p[0]=(int)mykbd_task;       // -> ASM1989 08.21.2010  need to be verified
 if (p[0]==0xFF89B134)  p[0]=(int)init_file_modules_task;   // -> ASM1989 08.21.2010  need to be verified
if (p[0]==0xFF862024)  p[0]=(int)JogDial_task_my; // -> ASM1989 08.21.2010  not sure at all, quite different than the sx200, need to verified
 // The JogDial_task_my address was found going back to sub_FF8623C0 , this one is equal in the sx200 to  sub_FF848668
//and it points to the real JogDial_task_my in the sx200-> FF84856C
 if (p[0]==0xFF8C475C)  p[0]=(int)exp_drv_task;   // -> ASM1989 08.21.2010 not sure, its simillar but need to be verified
 


About the movie_record_task (0xFF9382B8  in the sx200) IS WAS UNABLE TO FIND IT, So help appreciated.


SX200   <..>   SX210
FF86327C   <..>   FF87EB90
FF821A90   <..>   FF8342C0
FF87F81C   <..>   FF89B134
FF84856C   <..>   FF862024
FF8A2214   <..>   FF8C475C

PD: added SX200->sx210 ref table
« Last Edit: 21 / August / 2010, 12:33:34 by asm1989 »


*

Offline whoever

  • ****
  • 280
  • IXUS950
Re: PowerShot SX210 IS - Porting Thread
« Reply #128 on: 21 / August / 2010, 11:58:19 »
It is advisable to use new, much clearer style in task hooks, based on the research published here. The corresponding structures are defined in dryos31.h, for sample usage see platform/a480/sub/100b/boot.c.

Of course, one has to see if DryOS release #0043 uses the same structures and addresses (0x1934 and 0x1938) as the previous releases #0031 and #0039, but one has to do it anyway.
« Last Edit: 21 / August / 2010, 12:02:24 by whoever »

*

Offline asm1989

  • *****
  • 527
  • SX720, SX260, SX210 & SX200
Re: PowerShot SX210 IS - Porting Thread
« Reply #129 on: 21 / August / 2010, 12:12:06 »
Thanks for the tip whoever,

At this time only searching for the new addresses, the base code is copied from the current sx200

 

Related Topics