SX50 HS porting thread - DryOS Development - CHDK Forum  

SX50 HS porting thread

  • 350 Replies
  • 158605 Views
*

Offline ERR99

  • ****
  • 339
SX50 HS porting thread
« on: 13 / November / 2012, 19:03:57 »
Advertisements
UPDATE 18.11.2012: First ALPHA V1 Testbuild available: http://chdk.setepontos.com/index.php?topic=8932.msg93395#msg93395

Hello together,

i just received my SX50 HS this weekend and so i can't resist to start porting CHDK... ;)

The current port is booting on the SX50, splash screen shows up and Keyboard/Jogdial is working.
Boot via diskboot.bin and PS.FI2 is functional.

For a working PS.FI2 boot there is a small patch in fi2enc.c necessary:

static int fi2rec_size(uint32_t dryos_ver)
{
    // return the correct size to use for the block record
    switch (dryos_ver)
    {
    case 50:
    case 51: /* SX50 HS (DryOS 51) also needs the extra value */
       return sizeof (fi2_rec_s);
    default:
       return sizeof (fi2_rec_s) - 4; // exclude the new R50 extra value
    }
}


« Last Edit: 18 / November / 2012, 07:58:34 by ERR99 »

Re: SX50 HS porting thread
« Reply #1 on: 14 / November / 2012, 11:22:22 »
Sounds great, i am standby for testing, i have the same FW100B   ::)

What is the "Base" version you starting from (SX40)? Can you share your sources because i cannot find anything in the repository?

Cheers


 

« Last Edit: 14 / November / 2012, 11:51:20 by mp1405 »

*

Offline bojofbas

  • *
  • 22
  • SX50 100b
Re: SX50 HS porting thread
« Reply #2 on: 14 / November / 2012, 14:27:26 »
great new you are looking into this.  About to part exchange an sx30 for an sx50. What stage are you at.

Re: SX50 HS porting thread
« Reply #3 on: 14 / November / 2012, 14:42:56 »
What is the "Base" version you starting from (SX40)? Can you share your sources because i cannot find anything in the repository?
Its usually best to work from a port for a camera released about the same time as yours rather than one with a similiar model number.   In this case,  the sx240hs & sx260hs from earlier this year might be a good choice.
However,  having a look at the sx40 as well would not be a bad idea.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline ERR99

  • ****
  • 339
Re: SX50 HS porting thread
« Reply #4 on: 14 / November / 2012, 18:06:14 »
I found an little suprise regarding DryOS 51. Looks like canon changed Task hook handling with this version. The "usual" method to install the taskHook function via 0x1938 and 0x193C is not working anymore.
If i compare the current firmware with e.g. sx260 it seems that now 0x1970 could be the "new" vector for this. But i am not sure. Using this vector as new hook adress is not working as wanted (no tasks are hooked in, but my test shows that, if a write a function pointer to 0x1970, this function is called from dryos). Maybe also the function parameter and/or the structure of context_t/ task_t has changed? I think this point needs more investigation.

Currently i worked around this problem by using the old "hardcore" version by porting all the firmware asm-code to the point where the task functions for task_CaptSeq(), task_InitFileModules(), task_ExpDrv(), etc. are created/started by the original firmware. Of course this leads to a lot more porting work....

In the current version of the port, basic photo overrides (like ISO, Exposure, Apertureoverride) seems to work now. All the other stuff has to be ported&checked.

If someone want to help, e.g. the correct values for this in stubs_min.S are still missing:
DEF(movie_status )
DEF(focus_len_table)
DEF(rear_dial_position)
DEF(_SetZoomActuatorSpeedPercent)

Maybe someone here has more luck to find the correct values in the firmware dump.


Re: SX50 HS porting thread
« Reply #5 on: 14 / November / 2012, 18:54:08 »
Looks like canon changed Task hook handling with this version. The "usual" method to install the taskHook function via 0x1938 and 0x193C is not working anymore.
FWIW, a quick grep of the svn source tree shows that  0x1930 and 0x1934 have also been used on some cameras.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #6 on: 15 / November / 2012, 02:39:10 »
I found an little suprise regarding DryOS 51. Looks like canon changed Task hook handling with this version. The "usual" method to install the taskHook function via 0x1938 and 0x193C is not working anymore.
If i compare the current firmware with e.g. sx260 it seems that now 0x1970 could be the "new" vector for this. But i am not sure. Using this vector as new hook adress is not working as wanted (no tasks are hooked in, but my test shows that, if a write a function pointer to 0x1970, this function is called from dryos). Maybe also the function parameter and/or the structure of context_t/ task_t has changed? I think this point needs more investigation.

Currently i worked around this problem by using the old "hardcore" version by porting all the firmware asm-code to the point where the task functions for task_CaptSeq(), task_InitFileModules(), task_ExpDrv(), etc. are created/started by the original firmware. Of course this leads to a lot more porting work....

I had this problem with the G1 X initially as well; but once I got more of the code ported properly the taskhook stuff started working. Unfortunately I don't know at what point this happened or what changed it. The G1 X and SX260HS ports are still using the 0x1938 and 0x193c values.

Edit: You could be right. It appears the firmware code that calls the 0x1938/0x193c functions (in earlier DryOS versions) is completely missing from R51.

Quote
If someone want to help, e.g. the correct values for this in stubs_min.S are still missing:
DEF(movie_status )
DEF(focus_len_table)
DEF(rear_dial_position)
DEF(_SetZoomActuatorSpeedPercent)

Maybe someone here has more luck to find the correct values in the firmware dump.



Once you define the correct values for CAM_DNG_LENS_INFO in platform_camera.h then the sig finder should find focus_len_table for you.

The others might need more adjustments to the sig finder (I notice it has some other missing stuff and things that look a bit wrong as well).

If you find any of the missing stuff let me know where and how you found it and I'll see if it can be automated.

Phil.
« Last Edit: 15 / November / 2012, 03:37:41 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline srsa_4c

  • ******
  • 4451
Re: SX50 HS porting thread
« Reply #7 on: 15 / November / 2012, 10:01:46 »
I found an little suprise regarding DryOS 51. Looks like canon changed Task hook handling with this version. The "usual" method to install the taskHook function via 0x1938 and 0x193C is not working anymore.
It appears the firmware code that calls the 0x1938/0x193c functions (in earlier DryOS versions) is completely missing from R51.
Since CreateTask is now located in RAM, I think it should be relatively easy to patch it. Unless the DryOS kernel code in RAM is protected somehow (checksum or some other method).


*

Offline ERR99

  • ****
  • 339
Re: SX50 HS porting thread
« Reply #8 on: 15 / November / 2012, 14:40:34 »

The others might need more adjustments to the sig finder (I notice it has some other missing stuff and things that look a bit wrong as well).

If you find any of the missing stuff let me know where and how you found it and I'll see if it can be automated.

sigfinder was not sure about this function:

NSTUB(GetImageFolder                          ,0xff1b8484) //  6 93%
// ERROR: LocalTime is not found.                          //--- ---    *** != 0x0068f420
// ERROR: MakeDirectory_Fut is not found.                  //--- ---    *** != 0xff01cf78
NSTUB(reboot_fw_update                        ,0xff38f4dc) //  6 64%


If i am right, this here are the correct function adresses for stub_entry2.s:
NHSTUB(GetImageFolder,        0xFF1B8488)
NHSTUB(LocalTime,               0x68F420)
NHSTUB(MakeDirectory_Fut,    0xFF01CF78)
NHSTUB(reboot_fw_update,    0xFF38F4D8)

In general the sigfinder hits was not "to far away" from the correct adresses. (Asumming that the adresses i found are correct) ;)

*

Offline ERR99

  • ****
  • 339
Re: SX50 HS porting thread
« Reply #9 on: 15 / November / 2012, 14:46:46 »
Since CreateTask is now located in RAM, I think it should be relatively easy to patch it. Unless the DryOS kernel code in RAM is protected somehow (checksum or some other method).

Good idea!
I did some test with "hooking" into those RAM located functions and i can say it is working!
I was able to hook into the RAM create task function and to replace the original fw task functions for task_CaptSeq and  task_ExpDrv via this method.  :D

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal