supplierdeeply

A2200 IS porting thread

  • 514 Replies
  • 64645 Views
*

Offline whim

  • ******
  • 2013
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
  • Publish
    Re: A2200 IS porting thread
    « Reply #90 on: 06 / December / 2011, 08:23:47 »
    Advertisements
    ..... Not camera specific, but could the "-Wl" option be added to the line 100 in chdk/core/Makefile?
    Change from
    Code: [Select]
    $(CC) $(CFLAGS) -o $@ --start-group $^  $(LDLIBS) --end-group $(LDFLAGS) $(LDOPTS)to
    Code: [Select]
    $(CC) $(CFLAGS) -o $@ -Wl,--start-group $^  $(LDLIBS) -Wl,--end-group $(LDFLAGS) $(LDOPTS)Newer versions of gcc are a bit more anal about passing arguments to the linker, at least in my experience here.
    Thanks ! Tested this mod on a vanilla r1457 (Windows 7 / CHDK-Shell)
    It's compatible with all cross compilers currently supplied with CHDK-Shell: GCC 3.4.6 / 4.4.0 / 4.5.1
    (note that these all use - and are compiled with - GCC 3.4.5 as native compiler, on Windows MinGW/MSYS)

    What's even better: with this mod an experimental kit with GCC 3.4.5 / 4.6.2 (native/cross)
    now also appears to work (read: compiles cleanly + survives quick function test on ixus220_elph300hs)
    Haven't checked sig/stubs regeneration yet, but maybe updating to 4.6.2 fixes your problems too ?

    wim

    PS Switching from 4.5.1 to 4.6.2  reduced binary size by ~3.2 kB for me
    « Last Edit: 06 / December / 2011, 08:37:54 by whim »

  • Publish
    Re: A2200 IS porting thread
    « Reply #91 on: 06 / December / 2011, 12:24:01 »
    ...
    Thanks ! Tested this mod on a vanilla r1457 (Windows 7 / CHDK-Shell)
    It's compatible with all cross compilers currently supplied with CHDK-Shell: GCC 3.4.6 / 4.4.0 / 4.5.1
    (note that these all use - and are compiled with - GCC 3.4.5 as native compiler, on Windows MinGW/MSYS)
    ...

    I'm glad if the info helped!

    I haven't tried with a different version of gcc yet, but I have traced the problem to revision 1448 (my build setup works to revision 1447). Specifically to this addition in finsig_dryos.c (line 3666):
    Code: [Select]
        for (k = 0; func_list2[k].name; k++){

            count = 0;
            curr_name = func_list2[k].name;

    k = find_matches2(&fw, k);

            //if ((fw.dryos_ver >= find_min_ver(curr_name)) && (fw.dryos_ver <= find_max_ver(curr_name)))
    // print_results(curr_name);
        }

    The loop itself wants to run 4 times in my case, but crashes in the third iteration of calling find_matches2(&fw, k). Specifically, right after entering in this loop inside the find_matches2 function (line 2321:)
    Code: [Select]
    for (i = 0; string_sigs[i].ev_name != 0 && !found_ev; i++)
    {
    if (strcmp(curr_name, string_sigs[i].name) == 0)
    {
    tried_ev = 1;
    if (find_strsig(fw, &string_sigs[i], k))
    {
    found_ev = 1;
    break;
    }
    }
    }

    The third time does not pass the the first if statement, which suggest comparing outside the scope of the string_sigs array. Either the functions gets called to many times or for loop parameters aren't sane.

    But I don't know how signature searching works, so I can't say.

    *

    Offline whim

    • ******
    • 2013
    • A495/590/620/630 ixus70/115/220/230/300/870 S95
  • Publish
    Re: A2200 IS porting thread
    « Reply #92 on: 06 / December / 2011, 12:57:47 »
    .......
    But I don't know how signature searching works, so I can't say

    Neither do I (never managed to port a cam) but I'm pretty sure everything in /tools
    gets compiled with the native, not the cross compiler.
    So, are both your GCC's 4.6.0 ? On Linux ?

    cheers,

    wim


    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: A2200 IS porting thread
    « Reply #93 on: 06 / December / 2011, 14:27:01 »
    .......
    But I don't know how signature searching works, so I can't say

    Neither do I (never managed to port a cam) but I'm pretty sure everything in /tools
    gets compiled with the native, not the cross compiler.
    So, are both your GCC's 4.6.0 ? On Linux ?

    cheers,

    wim



    Do you know where I can download a pre-compiled version of GCC 4.6.2 for Windows that will work with CHDK, so I can test this?

    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)


    *

    Offline whim

    • ******
    • 2013
    • A495/590/620/630 ixus70/115/220/230/300/870 S95
  • Publish
    Re: A2200 IS porting thread
    « Reply #94 on: 06 / December / 2011, 14:48:14 »
    Do you know where I can download a pre-compiled version of GCC 4.6.2 for Windows that will work with CHDK, so I can test this?

    Phil.
    Not yet, but working on uploading right now - [edit] Ok, done + scanned OK @ Jotti :

    kit with GCC 3.4.5 / 4.6.2 (native/cross): [Edit3: link removed]
                        CRC-32: 33BFBCAF 
                        MD5:      1875D833FA966E9B6C09A05C8C5383CF   
                        SHA1:     4AF97AAFC6C7BEC3F06111721C3574F9E0BDD3AD

    [edit2: in case others want to test this: don't forget that a mini-patch to the CHDK source code is
               needed for this to work, see Nilinhim's post or if you prefer a patch file see attachment]

    cheers,

    wim

    PS Only tested with included gmake.exe (which is Gnu make 3.77 compiled for msys)

    [edit3: link and attachment removed: resulting CHDK binaries produced crashes] 
    « Last Edit: 09 / December / 2011, 08:00:48 by whim »

  • Publish
    Re: A2200 IS porting thread
    « Reply #95 on: 06 / December / 2011, 16:15:16 »
    ...
    Neither do I (never managed to port a cam) but I'm pretty sure everything in /tools
    gets compiled with the native, not the cross compiler.
    So, are both your GCC's 4.6.0 ? On Linux ?
    ...

    Ah, that makes more sense that /tools is compiled with native compiler (*derp* moment here :P).

    Some more information that might help:

    Linux, yes; 64 bit; native gcc 4.5.2; cross gcc 4.6.0. So the newer version of cross compiler shouldn't effect signature finding.

    I tested by commenting out the call to find_matches2(&fw, k) and the firmware compiles and runs ok on the camera fine.

    Also, browsing trough finsig_dryos.c I found that func_list2 is declared with only two elements:
    Code: [Select]
    FuncsList   func_list2[] =
    {
        { "ResetZoomLens", 0, 0 },
        { "ResetFocusLens", 0, 0 },
    };

    So, shouldn't that only have to make run the loop only twice? And disabling this part of signature finding would only ignore these two functions?

    As for reference ports compiling, I realised I don't have their firmware dumps in the build, so the signature finding gets skipped (another *herp* moment).

    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: A2200 IS porting thread
    « Reply #96 on: 06 / December / 2011, 16:52:07 »

    Also, browsing trough finsig_dryos.c I found that func_list2 is declared with only two elements:
    Code: [Select]
    FuncsList   func_list2[] =
    {
        { "ResetZoomLens", 0, 0 },
        { "ResetFocusLens", 0, 0 },
    };


    A huge 'doh!' moment for me then :-[

    Just add another line to func_list2 with { 0, 0, 0 } as the entry.
    This will terminate the list for the loop.

    Will update SVN tonight.

    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)

  • Publish
    Re: A2200 IS porting thread
    « Reply #97 on: 06 / December / 2011, 17:16:15 »
    Just add another line to func_list2 with { 0, 0, 0 } as the entry.
    This will terminate the list for the loop.

    Works like a charm, thanks!

    Now just  a cosmetic bug or two to figure out (like how to make the menus in rec and play mode the same color) and the A2200 100b firmware should be BETA quality!


    *

    Offline philmoz

    • *****
    • 2936
      • Photos
  • Publish
    Re: A2200 IS porting thread
    « Reply #98 on: 06 / December / 2011, 17:37:51 »

    Now just  a cosmetic bug or two to figure out (like how to make the menus in rec and play mode the same color) and the A2200 100b firmware should be BETA quality!


    Colors in CHDK are a pain - with recent cameras having less useful colors in the palette, as well as different palettes in each mode (some cameras having up to 16 different palettes).

    I implemented a solution for the G12/SX30/SX40/IXUS310 that updates unused entries in the palette with CHDK specific colors. Given the A2200 is from the same era it may be possible to implement this. You need to find some memory addresses for the palette buffer and active palette index though.

    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)

  • Publish
    Re: A2200 IS porting thread
    « Reply #99 on: 06 / December / 2011, 18:01:31 »
    ...
    Colors in CHDK are a pain - with recent cameras having less useful colors in the palette, as well as different palettes in each mode (some cameras having up to 16 different palettes).

    I implemented a solution for the G12/SX30/SX40/IXUS310 that updates unused entries in the palette with CHDK specific colors. Given the A2200 is from the same era it may be possible to implement this. You need to find some memory addresses for the palette buffer and active palette index though.
    ...

    I'll give it a shot. Somehow I managed to figure it out this far. Big thanks of course to everybody for all the help on the forums!

     

    Related Topics