changelog of trunk including comments / devtalk - page 17 - General Discussion and Assistance - CHDK Forum  

changelog of trunk including comments / devtalk

  • 299 Replies
  • 227170 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: changelog of trunk including comments / devtalk
« Reply #160 on: 12 / January / 2014, 17:44:35 »
Advertisements
You should remove or comment out the NHSTUB entry (if you comment it out you can add comments to help others).
There are cases when a function in stubs_entry.S needs replacement (s80, a410). I can't comment out that entry.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: changelog of trunk including comments / devtalk
« Reply #161 on: 12 / January / 2014, 18:19:31 »
You should remove or comment out the NHSTUB entry (if you comment it out you can add comments to help others).
There are cases when a function in stubs_entry.S needs replacement (s80, a410). I can't comment out that entry.

You're _SomeFunction() code will override the NHSTUB in stubs_entry.S (NHSTUB generates 'weak' references').

I meant you should remove/comment anything in stubs_entry2.S to avoid confusion.

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 srsa_4c

  • ******
  • 4451
Re: changelog of trunk including comments / devtalk
« Reply #162 on: 13 / January / 2014, 16:40:48 »
You're _SomeFunction() code will override the NHSTUB in stubs_entry.S (NHSTUB generates 'weak' references').
Looks like it's not, or I'm still missing something.

Example is a410, using the below diff:

without OPT_FIRMWARE_PC24_CALL

...
   9fc44:   eb000674    bl   a161c <_MoveFocusLensToDistance>
...
000a161c <_MoveFocusLensToDistance>:
   a161c:   e59ff230    ldr   pc, [pc, #560]   ; a1854 <_EngDrvRead+0xc8>
...
   a1854:   ffe2e2f4    .word   0xffe2e2f4
...


with OPT_FIRMWARE_PC24_CALL

   9fc44:   ebf639aa    bl   ffe2e2f4 <_MoveFocusLensToDistance>


Code: [Select]
Index: platform/a410/sub/100f/focushack.c
===================================================================
--- platform/a410/sub/100f/focushack.c (revision 3312)
+++ platform/a410/sub/100f/focushack.c (working copy)
@@ -6,7 +6,7 @@
 #include "asmsafe.h"
 */
 
-void __attribute__((naked,noinline)) MoveFocusLensToDistanceA410(short* a) //sub_FFD2A438
+void __attribute__((naked,noinline)) _MoveFocusLensToDistance(short* a)
 {
  asm volatile (
 "                STMFD   SP!, {R4,R5,LR}\n"
Index: platform/a410/sub/100f/funcs_by_address.csv
===================================================================
--- platform/a410/sub/100f/funcs_by_address.csv (revision 3312)
+++ platform/a410/sub/100f/funcs_by_address.csv (working copy)
@@ -1006,6 +1006,7 @@
 0xffe2e0d0,MoveFocusLensToTerminatePosition_FW
 0xffe2e160,MoveFocusLensToPositionWithMaxSpeed_FW
 0xffe2e1d8,MoveFocusLensToPosition_FW
+0xffe2e2f4,MoveFocusLensToDistance
 0xffe2e2f4,MoveFocusLensToDistance_FW
 0xffe2e404,ResetFocus_FW
 0xffe2e784,PrintScanTable_FW
Index: platform/a410/sub/100f/funcs_by_name.csv
===================================================================
--- platform/a410/sub/100f/funcs_by_name.csv (revision 3312)
+++ platform/a410/sub/100f/funcs_by_name.csv (working copy)
@@ -508,6 +508,7 @@
 0xffd23dd0,MoveDigitalZoomToTele_FW
 0xffd23e04,MoveDigitalZoomToWide_FW
 0xffe22e04,MoveFocusActuator_FW
+0xffe2e2f4,MoveFocusLensToDistance
 0xffe2e2f4,MoveFocusLensToDistance_FW
 0xffe2e1d8,MoveFocusLensToPosition_FW
 0xffe2e160,MoveFocusLensToPositionWithMaxSpeed_FW
Index: platform/a410/sub/100f/stubs_entry.S
===================================================================
--- platform/a410/sub/100f/stubs_entry.S (revision 3312)
+++ platform/a410/sub/100f/stubs_entry.S (working copy)
@@ -18,7 +18,6 @@
 NHSTUB(GetFocusLensSubjectDistance            ,0xffe217a0) //  1 90%
 NHSTUB(GetFocusLensSubjectDistanceFromLens    ,0xffe21d40) //  3 52%
 NHSTUB(GetSystemTime                          ,0xffc04b4c) //  1 96%
-//NHSTUB(MoveFocusLensToDistance              ,0xffe2e2f4) //102        *** != 0x00000000
 NHSTUB(PutInNdFilter                          ,0xffe2c0dc) //  1 92%
 // ALT: NHSTUB(PutInNdFilter, 0xffe2dc68) // 1 25/2
 // ALT: NHSTUB(PutInNdFilter, 0xffe2dcb0) // 1 25/2
@@ -112,6 +111,7 @@
 NHSTUB(LocalTime                              ,0xffc04228) //115
 NHSTUB(LockMainPower                          ,0xffd39888) //120
 NHSTUB(MakeDirectory_Fut                      ,0xffc53588) //  1
+NHSTUB(MoveFocusLensToDistance                ,0xffe2e2f4) //102
 NHSTUB(MoveZoomLensWithPoint                  ,0xffe12434) //120
 NHSTUB(Open                                   ,0xffc5a5f0) //120
 NHSTUB(PT_PlaySound                           ,0xffd31254) //  1
Index: platform/a410/sub/100f/stubs_entry_2.S
===================================================================
--- platform/a410/sub/100f/stubs_entry_2.S (revision 3312)
+++ platform/a410/sub/100f/stubs_entry_2.S (working copy)
@@ -7,7 +7,7 @@
 NHSTUB(EnterToCompensationEVF,      0xFFD24234)
 NHSTUB(ExitFromCompensationEVF,     0xFFD24244)
 NHSTUB(FreeMemory,                  0xffc0b280)
-NHSTUB(MoveFocusLensToDistance,     MoveFocusLensToDistanceA410) //hack to make this work
+//NHSTUB(MoveFocusLensToDistance,     MoveFocusLensToDistanceA410) //hack to make this work
 NHSTUB(WriteSDCard,                 0xFFC69824)
 NHSTUB(free,                        0xFFE75B50)
 NHSTUB(kbd_pwr_off,                 NULL_SUB)

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: changelog of trunk including comments / devtalk
« Reply #163 on: 13 / January / 2014, 17:11:03 »
You're _SomeFunction() code will override the NHSTUB in stubs_entry.S (NHSTUB generates 'weak' references').
Looks like it's not, or I'm still missing something.

Example is a410, using the below diff:

without OPT_FIRMWARE_PC24_CALL

...
   9fc44:   eb000674    bl   a161c <_MoveFocusLensToDistance>
...
000a161c <_MoveFocusLensToDistance>:
   a161c:   e59ff230    ldr   pc, [pc, #560]   ; a1854 <_EngDrvRead+0xc8>
...
   a1854:   ffe2e2f4    .word   0xffe2e2f4
...


with OPT_FIRMWARE_PC24_CALL

   9fc44:   ebf639aa    bl   ffe2e2f4 <_MoveFocusLensToDistance>


Code: [Select]
Index: platform/a410/sub/100f/focushack.c
===================================================================
--- platform/a410/sub/100f/focushack.c (revision 3312)
+++ platform/a410/sub/100f/focushack.c (working copy)
@@ -6,7 +6,7 @@
 #include "asmsafe.h"
 */
 
-void __attribute__((naked,noinline)) MoveFocusLensToDistanceA410(short* a) //sub_FFD2A438
+void __attribute__((naked,noinline)) _MoveFocusLensToDistance(short* a)
 {
  asm volatile (
 "                STMFD   SP!, {R4,R5,LR}\n"
Index: platform/a410/sub/100f/funcs_by_address.csv
===================================================================
--- platform/a410/sub/100f/funcs_by_address.csv (revision 3312)
+++ platform/a410/sub/100f/funcs_by_address.csv (working copy)
@@ -1006,6 +1006,7 @@
 0xffe2e0d0,MoveFocusLensToTerminatePosition_FW
 0xffe2e160,MoveFocusLensToPositionWithMaxSpeed_FW
 0xffe2e1d8,MoveFocusLensToPosition_FW
+0xffe2e2f4,MoveFocusLensToDistance
 0xffe2e2f4,MoveFocusLensToDistance_FW
 0xffe2e404,ResetFocus_FW
 0xffe2e784,PrintScanTable_FW
Index: platform/a410/sub/100f/funcs_by_name.csv
===================================================================
--- platform/a410/sub/100f/funcs_by_name.csv (revision 3312)
+++ platform/a410/sub/100f/funcs_by_name.csv (working copy)
@@ -508,6 +508,7 @@
 0xffd23dd0,MoveDigitalZoomToTele_FW
 0xffd23e04,MoveDigitalZoomToWide_FW
 0xffe22e04,MoveFocusActuator_FW
+0xffe2e2f4,MoveFocusLensToDistance
 0xffe2e2f4,MoveFocusLensToDistance_FW
 0xffe2e1d8,MoveFocusLensToPosition_FW
 0xffe2e160,MoveFocusLensToPositionWithMaxSpeed_FW
Index: platform/a410/sub/100f/stubs_entry.S
===================================================================
--- platform/a410/sub/100f/stubs_entry.S (revision 3312)
+++ platform/a410/sub/100f/stubs_entry.S (working copy)
@@ -18,7 +18,6 @@
 NHSTUB(GetFocusLensSubjectDistance            ,0xffe217a0) //  1 90%
 NHSTUB(GetFocusLensSubjectDistanceFromLens    ,0xffe21d40) //  3 52%
 NHSTUB(GetSystemTime                          ,0xffc04b4c) //  1 96%
-//NHSTUB(MoveFocusLensToDistance              ,0xffe2e2f4) //102        *** != 0x00000000
 NHSTUB(PutInNdFilter                          ,0xffe2c0dc) //  1 92%
 // ALT: NHSTUB(PutInNdFilter, 0xffe2dc68) // 1 25/2
 // ALT: NHSTUB(PutInNdFilter, 0xffe2dcb0) // 1 25/2
@@ -112,6 +111,7 @@
 NHSTUB(LocalTime                              ,0xffc04228) //115
 NHSTUB(LockMainPower                          ,0xffd39888) //120
 NHSTUB(MakeDirectory_Fut                      ,0xffc53588) //  1
+NHSTUB(MoveFocusLensToDistance                ,0xffe2e2f4) //102
 NHSTUB(MoveZoomLensWithPoint                  ,0xffe12434) //120
 NHSTUB(Open                                   ,0xffc5a5f0) //120
 NHSTUB(PT_PlaySound                           ,0xffd31254) //  1
Index: platform/a410/sub/100f/stubs_entry_2.S
===================================================================
--- platform/a410/sub/100f/stubs_entry_2.S (revision 3312)
+++ platform/a410/sub/100f/stubs_entry_2.S (working copy)
@@ -7,7 +7,7 @@
 NHSTUB(EnterToCompensationEVF,      0xFFD24234)
 NHSTUB(ExitFromCompensationEVF,     0xFFD24244)
 NHSTUB(FreeMemory,                  0xffc0b280)
-NHSTUB(MoveFocusLensToDistance,     MoveFocusLensToDistanceA410) //hack to make this work
+//NHSTUB(MoveFocusLensToDistance,     MoveFocusLensToDistanceA410) //hack to make this work
 NHSTUB(WriteSDCard,                 0xFFC69824)
 NHSTUB(free,                        0xFFE75B50)
 NHSTUB(kbd_pwr_off,                 NULL_SUB)

I tried your patch (without OPT_FIRMWARE_PC24_CALL) using arm-elf-gcc 4.6.1 (64 bit) and it produces the correct code - the stubs_entry.S version of _MoveFocusLensToDistance is replaced by the one in focushack.c.

Are you still using the new version of GCC? If so try an older version.

I don't have a 32 bit environment with me so I can't test with OPT_FIRMWARE_PC24_CALL enabled.

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 srsa_4c

  • ******
  • 4451
Re: changelog of trunk including comments / devtalk
« Reply #164 on: 13 / January / 2014, 18:31:11 »
I tried your patch (without OPT_FIRMWARE_PC24_CALL) using arm-elf-gcc 4.6.1 (64 bit) and it produces the correct code - the stubs_entry.S version of _MoveFocusLensToDistance is replaced by the one in focushack.c.
That's odd. What could be causing this difference?

I'm on a 32bit OS (Linux), I can't test with 64bit toolchains. I have tried rebuilding with gcc 4.6.4, 4.6.0, 4.5.1, 4.4.3 based toolchains (some of them are my compilation, others are from elsewhere), their binutils versions are 2.18, 2.20.1, 2.21...
The replacement _MoveFocusLensToDistance never shows up in core/main.bin.dump, no matter OPT_FIRMWARE_PC24_CALL is used or not.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: changelog of trunk including comments / devtalk
« Reply #165 on: 14 / January / 2014, 03:53:21 »
I tried your patch (without OPT_FIRMWARE_PC24_CALL) using arm-elf-gcc 4.6.1 (64 bit) and it produces the correct code - the stubs_entry.S version of _MoveFocusLensToDistance is replaced by the one in focushack.c.
That's odd. What could be causing this difference?

I'm on a 32bit OS (Linux), I can't test with 64bit toolchains. I have tried rebuilding with gcc 4.6.4, 4.6.0, 4.5.1, 4.4.3 based toolchains (some of them are my compilation, others are from elsewhere), their binutils versions are 2.18, 2.20.1, 2.21...
The replacement _MoveFocusLensToDistance never shows up in core/main.bin.dump, no matter OPT_FIRMWARE_PC24_CALL is used or not.

You're right, it doesn't work with 32 bit versions of GCC.

Try the attached patch.

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 srsa_4c

  • ******
  • 4451
Re: changelog of trunk including comments / devtalk
« Reply #166 on: 14 / January / 2014, 13:53:54 »
Try the attached patch.
The generated code looks good and works as it should (yes, I've noticed that the "new" NSTUB macro is actually the same as NHSTUB without OPT_FIRMWARE_PC24_CALL).

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: changelog of trunk including comments / devtalk
« Reply #167 on: 17 / January / 2014, 19:05:49 »
Try the attached patch.
The generated code looks good and works as it should (yes, I've noticed that the "new" NSTUB macro is actually the same as NHSTUB without OPT_FIRMWARE_PC24_CALL).

Here's an alternative method for achieving the same result, that I think is better.

This adds an 'IGNORE' macro for stubs_entry_2.S that will force finsig to skip the function (it is still written as a comment to stubs_entry.S).
The assumption is that you provide a replacement for the function in other code (in your case focushack.c).

This avoids generating an unnecessary stub wrapper.

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 srsa_4c

  • ******
  • 4451
Re: changelog of trunk including comments / devtalk
« Reply #168 on: 18 / January / 2014, 17:15:21 »
Here's an alternative method for achieving the same result, that I think is better.

This adds an 'IGNORE' macro for stubs_entry_2.S that will force finsig to skip the function (it is still written as a comment to stubs_entry.S).
The assumption is that you provide a replacement for the function in other code (in your case focushack.c).

This avoids generating an unnecessary stub wrapper.
This one is working as well. Do you plan to check this in as it is (autobuild is not affected currently anyway)? The problematic ports can then be fixed one by one or all at once...

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: changelog of trunk including comments / devtalk
« Reply #169 on: 18 / January / 2014, 17:24:00 »
Here's an alternative method for achieving the same result, that I think is better.

This adds an 'IGNORE' macro for stubs_entry_2.S that will force finsig to skip the function (it is still written as a comment to stubs_entry.S).
The assumption is that you provide a replacement for the function in other code (in your case focushack.c).

This avoids generating an unnecessary stub wrapper.
This one is working as well. Do you plan to check this in as it is (autobuild is not affected currently anyway)? The problematic ports can then be fixed one by one or all at once...

Yes, if it's working ok for you then I will add it to 1.3.
Edit: added in revision 3319.

I'll see how may ports use custom override functions - if it's only a small number I'll update them.
Edit2: The only other cameras with this sort of custom override are the ixus115, ixus30, ixus40 and s80. Do you have any of these you can test a patch on?

Phil.
« Last Edit: 18 / January / 2014, 20:21:02 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)

 

Related Topics