SX50 HS porting thread - page 2 - DryOS Development - CHDK Forum

SX50 HS porting thread

  • 350 Replies
  • 146215 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #10 on: 16 / November / 2012, 16:31:19 »
Advertisements

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) ;)

The address you are using for MakeDirectory_Fut is actually the 'mkdir' address.

The main problem with using this is the return values are inverted - MakeDirectory_Fut returns 0 for success, while 'mkdir' returns 1. This affects the Lua script mkdir function which will return the wrong status.

Another potential problem is that CHDK passes -1 as the second parameter to MakeDirectory_Fut; but I don't think this is correct for 'mkdir'. Calls to mkdir in the firmware seem to use 0 or 1 as the 2nd parameter.

If Canon have removed MakeDirectory_Fut then the code for CHDK's mkdir in generic/wrappers.c will need an #ifdef to allow using the firmware mkdir instead and inverting the return value.

Also if you can tell me how you found LocalTime I can try automating it in the sig finder.

Phil.
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 nafraf

  • *****
  • 1308
Re: SX50 HS porting thread
« Reply #11 on: 16 / November / 2012, 19:13:42 »
The address you are using for MakeDirectory_Fut is actually the 'mkdir' address.

The main problem with using this is the return values are inverted - MakeDirectory_Fut returns 0 for success, while 'mkdir' returns 1. This affects the Lua script mkdir function which will return the wrong status.
Thanks philmoz, I have the same problem with a810/a1300, that explains the mkdir log error reported llibtst.lua

Quote
Another potential problem is that CHDK passes -1 as the second parameter to MakeDirectory_Fut; but I don't think this is correct for 'mkdir'. Calls to mkdir in the firmware seem to use 0 or 1 as the 2nd parameter.

If Canon have removed MakeDirectory_Fut then the code for CHDK's mkdir in generic/wrappers.c will need an #ifdef to allow using the firmware mkdir instead and inverting the return value.

I used #ifdef in wrappers.c, and I posted the patch here
Do you think that it is right? maybe the #ifdef should be renamed.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #12 on: 16 / November / 2012, 19:40:50 »
The address you are using for MakeDirectory_Fut is actually the 'mkdir' address.

The main problem with using this is the return values are inverted - MakeDirectory_Fut returns 0 for success, while 'mkdir' returns 1. This affects the Lua script mkdir function which will return the wrong status.
Thanks philmoz, I have the same problem with a810/a1300, that explains the mkdir log error reported llibtst.lua

Quote
Another potential problem is that CHDK passes -1 as the second parameter to MakeDirectory_Fut; but I don't think this is correct for 'mkdir'. Calls to mkdir in the firmware seem to use 0 or 1 as the 2nd parameter.

If Canon have removed MakeDirectory_Fut then the code for CHDK's mkdir in generic/wrappers.c will need an #ifdef to allow using the firmware mkdir instead and inverting the return value.

I used #ifdef in wrappers.c, and I posted the patch here
Do you think that it is right? maybe the #ifdef should be renamed.


That patch looks ok, I'll add it to the trunk and release-1.1 versions so other affected cameras can use it.

Phil.
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 ERR99

  • ****
  • 339
Re: SX50 HS porting thread
« Reply #13 on: 18 / November / 2012, 07:39:40 »
That patch looks ok, I'll add it to the trunk and release-1.1 versions so other affected cameras can use it.
Phil.
I tested also the patch on the SX50 and it works fine. With this patch, the liblua testscript executes without any errors. :)


*

Offline ERR99

  • ****
  • 339
Re: SX50 HS porting thread
« Reply #14 on: 18 / November / 2012, 07:46:48 »
Also if you can tell me how you found LocalTime I can try automating it in the sig finder.

I found localtime via search for this string:
FF0205E4 a04d02d02d02d02 DCB "%04d:%02d:%02d %02d:%02d:%02d",0

This string is only used from one function:

ROM:FF020574 sub_FF020574:
ROM:FF020574
ROM:FF020574 var_48          = -0x48
ROM:FF020574 var_34          = -0x34
ROM:FF020574 var_30          = -0x30
ROM:FF020574 var_2C          = -0x2C
ROM:FF020574 var_28          = -0x28
ROM:FF020574 var_24          = -0x24
ROM:FF020574 var_20          = -0x20
ROM:FF020574 var_C           = -0xC
ROM:FF020574
ROM:FF020574                 STMFD   SP!, {R4,LR}
ROM:FF020578                 SUB     SP, SP, #0x40
ROM:FF02057C                 MOV     R4, R0
ROM:FF020580                 ADD     R0, SP, #0x48+var_C
ROM:FF020584                 BL      sub_68C438
ROM:FF020588                 ADD     R1, SP, #0x48+var_34
ROM:FF02058C                 ADD     R0, SP, #0x48+var_C
ROM:FF020590                BL      j_localtime
ROM:FF020594                 LDR     R0, [SP,#0x48+var_2C]
ROM:FF020598                 LDR     R1, [SP,#0x48+var_28]
ROM:FF02059C                 LDR     R2, [SP,#0x48+var_30]
ROM:FF0205A0                 LDR     R3, [SP,#0x48+var_34]
ROM:FF0205A4                 STMFA   SP, {R0,R2,R3}
ROM:FF0205A8                 LDR     R0, [SP,#0x48+var_24]
ROM:FF0205AC                 STR     R1, [SP,#0x48+var_48]
ROM:FF0205B0                 ADD     R3, R0, #1
ROM:FF0205B4                 LDR     R0, [SP,#0x48+var_20]
ROM:FF0205B8                 ADR     R1, a04d02d02d02d02 ; "%04d:%02d:%02d %02d:%02d:%02d"
ROM:FF0205BC                 ADD     R2, R0, #0x400
ROM:FF0205C0                 ADD     R2, R2, #0x36C
ROM:FF0205C4                 MOV     R0, R4
ROM:FF0205C8                 BL      sprintf
ROM:FF0205CC                 ADD     SP, SP, #0x40
ROM:FF0205D0                 LDMFD   SP!, {R4,PC}
ROM:FF0205D0 ; End of function sub_FF020574

The second subroutine call here calls localtime:
ROM:FF020590                 BL      j_localtime

seg000:68F470 j_localtime:
seg000:68F470                 B       localtime

seg000:68F420 localtime: 

*

Offline ERR99

  • ****
  • 339
Re: SX50 HS porting thread
« Reply #15 on: 18 / November / 2012, 07:54:42 »
Okay, i think the port has now reached ALPHA status. All major CHDK stuff is ported (but not deeply tested).

So anybody with a SX50HS with FW 1.00b, please test the attached ALPHA V1 build and report if something is not working or crashing (if its crash, a romlog would be helpfull).

Update: Here is the link to the also needed CHDK folder for the testbuild: http://chdk.setepontos.com/index.php?topic=8932.msg93468#msg93468
« Last Edit: 19 / November / 2012, 16:44:46 by ERR99 »

Re: SX50 HS porting thread
« Reply #16 on: 18 / November / 2012, 10:11:36 »
Okay, i think the port has now reached ALPHA status. All major CHDK stuff is ported (but not deeply tested).
Would you mind submitting a patch file for the SVN & autobuild ?  Mark the camera as

sx50hs,100b,ALPHA,,SKIP_AUTOBUILD

in the platform_camera.h file ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: SX50 HS porting thread
« Reply #17 on: 19 / November / 2012, 16:15:15 »
I am a new user so please forgive me if I am being a bit dim.

I got my SX50 a few weeks ago, and afterwards found out about CHDK and have been eagerly waiting for a port to started on for it; I am the kind of person that likes taking things apart to make them better! I did some programming at college but that was 14 years ago so I grasp a little bit about how it works after reading the FAQ and some of the manual.

I have been playing with the port on my camera this evening and I have found some issues.

Trying to enable Zebra: "Fail to load zebra.flt: file not found"

Trying to force RAW pictures and therefore trying to create badpixel.bin using the built in function: "Fail to load: _dng.flt: file not found"

Would really like to get the RAW setting working. I know I get do this in Manual mode on the camera, but would like to get it working in Auto mode.

Regards.



Re: SX50 HS porting thread
« Reply #18 on: 19 / November / 2012, 16:19:57 »
Trying to enable Zebra: "Fail to load zebra.flt: file not found"
Trying to force RAW pictures and therefore trying to create badpixel.bin using the built in function: "Fail to load: _dng.flt: file not found"
This usually means that you did not extract the entire CHDK installation file fully to your SD card - including recreating all the directories from the installation file.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: SX50 HS porting thread
« Reply #19 on: 19 / November / 2012, 16:26:00 »
Trying to enable Zebra: "Fail to load zebra.flt: file not found"
Trying to force RAW pictures and therefore trying to create badpixel.bin using the built in function: "Fail to load: _dng.flt: file not found"
This usually means that you did not extract the entire CHDK installation file fully to your SD card - including recreating all the directories from the installation file.


ERR99 only included the diskboot.bin and ps.fi2 files in the earlier post, not the complete build.
So it will be tricky for anyone to install and get working.

Phil.
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)

 

Related Topics