supplierdeeply

Porting chdk to the G9

  • 245 Replies
  • 61814 Views
  • Publish
    Re: Porting chdk to the G9
    « Reply #100 on: 14 / May / 2008, 14:45:28 »
    Advertisements
    Quote
    i am a experineced c-programmer(and cpp) in the field of image processing and machine vision on different platforms.

    Very good!
    In this thread you can a lot of info on how to start the work.


    ...Being an experienced programmer is necessary, though.


    that's for sure!

    Jeff666, couldn't you take a new look to what I've done? Maybe your experience could find errors easily.
    « Last Edit: 14 / May / 2008, 15:12:11 by bongo_bingo »

    *

    Offline jeff666

    • ****
    • 181
    • A720IS
  • Publish
    Re: Porting chdk to the G9
    « Reply #101 on: 14 / May / 2008, 20:15:48 »
    Maybe your experience could find errors easily.

    You're right, but it won't help.

    The LED doesn't turn on because the code is never executed. This is not an error, since it is never meant to be executed.

    No offense, but it is 100% necessary to follow the execution path of a piece of code to port a camera. Unless you understand how program code works you won't just waste your own time, but also the time of people trying to explain what you have to do.

    Cheers.

  • Publish
    Re: Porting chdk to the G9
    « Reply #102 on: 15 / May / 2008, 02:51:53 »
    ...
    No offense, but it is 100% necessary to follow the execution path of a piece of code to port a camera. Unless you understand how program code works you won't just waste your own time, but also the time of people trying to explain what you have to do.

    Cheers.

    No offense, I know it.
    You are right, I'm wasting a lot of time trying to "learning by doing".
    I don't want to waste other people's time, but I'll continue to post hoping not to be too much boring.

    I've understood that there was an error in the way I was trying to turn on the blue led at the end of the reset code.
    Adding 
    dst_void = (void*) 0xFF810000;
    just after "<--------------this doesn't works" line, made the light turn on. I suppose that this means that the "reset code" is good for the g9. Am I right?

    At the moment I'm not able to do a "degug led" procedure in boot.c.

    bye


    *

    Offline jeff666

    • ****
    • 181
    • A720IS
  • Publish
    Re: Porting chdk to the G9
    « Reply #103 on: 15 / May / 2008, 05:58:03 »
    You are right, I'm wasting a lot of time trying to "learning by doing".

    Learning by doing is ok, but you'll have to do quite a lot of very basic stuff before you're able to do anything that's related to porting a cam.

    Quote
    I've understood that there was an error in the way I was trying to turn on the blue led at the end of the reset code.

    Not an error, but a misunderstanding. You assumed that the code after the reset-block would be executed but this is not the case.

            // DEBUG: jump to regular firmware-boot (causing a boot loop)
            //dst_void = (void*) 0xFF810000; //OCIO

       dst_void is the address which is used to continue program execution after the reset has been made. Note that reset just sets some hardware state and doesn't the cpu to start the firmware again. So we can decide what the cam does after we reset it. What it does is decided by the code which is referred by dst_void.

            // resetcode here:
            asm volatile (
                            "MRS     R0, CPSR\n"
                            "BIC     R0, R0, #0x3F\n"
                            "ORR     R0, R0, #0xD3\n"
                            "MSR     CPSR, R0\n"
                            "LDR     R1, =0xC0200000\n"
                            "MOV     R0, #0xFFFFFFFF\n"
                            "STR     R0, [R1,#0x10C]\n"
                            "STR     R0, [R1,#0xC]\n"
                            "STR     R0, [R1,#0x1C]\n"
                            "STR     R0, [R1,#0x2C]\n"
                            "STR     R0, [R1,#0x3C]\n"
                            "STR     R0, [R1,#0x4C]\n"
                            "STR     R0, [R1,#0x5C]\n"
                            "STR     R0, [R1,#0x6C]\n"
                            "STR     R0, [R1,#0x7C]\n"
                            "STR     R0, [R1,#0x8C]\n"
                            "STR     R0, [R1,#0x9C]\n"
                            "STR     R0, [R1,#0xAC]\n"
                            "STR     R0, [R1,#0xBC]\n"
                            "STR     R0, [R1,#0xCC]\n"
                            "STR     R0, [R1,#0xDC]\n"
                            "STR     R0, [R1,#0xEC]\n"
                            "CMP     R4, #7\n"
                            "STR     R0, [R1,#0xFC]\n"
                            "LDMEQFD SP!, {R4,PC}\n"
                            "MOV     R0, #0x78\n"
                            "MCR     p15, 0, R0,c1,c0\n"
                            "MOV     R0, #0\n"
                            "MCR     p15, 0, R0,c7,c10, 4\n"
                            "MCR     p15, 0, R0,c7,c5\n"
                            "MCR     p15, 0, R0,c7,c6\n"
                            "MOV     R0, #0x40000006\n"
                            "MCR     p15, 0, R0,c9,c1\n"
                            "MCR     p15, 0, R0,c9,c1, 1\n"
                            "MRC     p15, 0, R0,c1,c0\n"
                            "ORR     R0, R0, #0x50000\n"
                            "MCR     p15, 0, R0,c1,c0\n"
                            "LDR     R0, =0x12345678\n"
                            "MOV     R1, #0x40000000\n"
                            "STR     R0, [R1,#0xFFC]\n"

                            //"LDR     R0, =0xFF810000\n"   // original jump-vector 0xFF810000 is the official firmware start. The original reset-function in the firmware would jump there. We want to continue in our own code, thus this line is disabled.

                            "MOV     R0, %0\n"              // new jump-vector    %0 is the first argument of the asm-block. Here it is dst_void (see last line of asm-block)

                            "LDMFD   SP!, {R4,LR}\n"
                            "BX      R0\n"   Jump to the location in Register R0. This is either 0xFF810000 or (in our case) dst_void. Since execution leaves this function after this command, anything (i.e. LED blinking) would not be executed.
                            : : "r"(dst_void) : "memory","r0","r1","r2","r3","r4");
                      
            while(1);   This line should never be executed. If (for some strange reason) BX R0 does not work, we want to keep execution at some controlled point (instad of doing just anything random)

    The next LED action would take place in the function referred to in dst_void. It's your task to find out where this is (this is simple and even mentioned in this thread).

    Cheers.


  • Publish
    ?
    « Reply #104 on: 15 / May / 2008, 08:31:58 »
    Thanks a lot jeff666. :)


    Edit 1:


    With the code I have adapted the blue led turn on/off after (+/-) 5 seconds the play button is pressed, I don't know what this means.

    Anyway, I have partially understood how to make the iso led blink in boot.c for debugging purpose.
    But this works only for the first subs of boot.c, after a certain point I continue to have the blue led turning on/off.

    If someone want take a look, I'm posting my actual boot.c.

    Cheers!
    « Last Edit: 16 / May / 2008, 09:41:36 by bongo_bingo »

  • Publish
    Re: Porting chdk to the G9
    « Reply #105 on: 19 / May / 2008, 19:13:07 »
    Hi there.
    I'm not that familiar with what you're doing here but have knowledge in C++ and Java.

    Curious if I can help with anything?

    Also I have some questions.

    In two months I will be traveling and am hoping for CHDK to be ported to the G9.
    Is this likely?

    Will it be as simple as putting a file on my memory card and putting that into the camera?

    What I understand is that you have dumped the firmware off the G9 and reverse engineered this to code 100% and are now finding out what variables need to be changed in CDHK for the CDHK to be able to be modified for the G9? (which runs the dryos)

    Okay I've looked through this whole thread and through tens of others and trawled the wikia page etc.
    How are you compiling your Diskboot.bin's and can I get the source for the S5IS? Also what environment are you dev'ing in. Just Notepad++?
    « Last Edit: 20 / May / 2008, 08:56:38 by Supernovah »

    *

    Offline jeff666

    • ****
    • 181
    • A720IS
  • Publish
    Re: Porting chdk to the G9
    « Reply #106 on: 20 / May / 2008, 04:29:37 »
    I'm not that familiar with what you're doing here but have knowledge in C++ and java.
    Curious if I can help with anything?

    xBjo asked the same. This was my reply.

    Quote
    In two months I will be travveling and am hoping for CDHK to be ported to the G9.
    Is this likely?

    An experienced developer should be able to make a port in 8-12 hours work (if no major problems arise). I'd be happy to jump in, but I'll need a device. If anybody near Stuttgart can provide one, I will make the port.

    Quote
    Will it be as simple as putting a file on my memory card and putting that into the camera?

    Yes.
    You still should read the CHDK-manual, though.

    Quote
    What I understand is that you have dumped the firmware off the G9 and reverse engineered this to code 100% and are now finding out what variables need to be changed in CDHK for the CDHK to be able to be modified for the G9? (which runs the dryos)

    We have reverse-engineered about 10% of DryOS which is enough to get CHDK running on this OS.
    The hard- and software doesn't differ too much between different devices, so porting a camera is mainly fixing addresses in the device-dependent part of CHDK.

    Cheers.

  • Publish
    Re: Porting chdk to the G9
    « Reply #107 on: 20 / May / 2008, 04:59:55 »
    There are links to dumps in here, is that what you are after?

    If you want to try some dumps I can test them out for you as you go, tomorrow I'll have to buy a card reader as Canon have happily used a camera usb interface instead of USBMS

    Oh and I ended up reading about preparing the card for hosting etc :P

    It won't work with my 32 gig cards will it... :(
    « Last Edit: 20 / May / 2008, 05:02:06 by Supernovah »


  • Publish
    Re: Porting chdk to the G9
    « Reply #108 on: 20 / May / 2008, 07:59:03 »
    Can I just say if there are any laborious tasks that can be carried out I have hours upon hours of free time to do so.

    I realize that if there are any basic enough tasks you could probably easily automate them but then again who knows, maybe I can interpret a little further than a basic script?

    Please let me know what I can do to help your current progress :)

    Also I desperately want to know how you are compiling your C.

    Are you using custom libraries? please explain

    *

    Offline whim

    • ******
    • 2013
    • A495/590/620/630 ixus70/115/220/230/300/870 S95
  • Publish
    Re: Porting chdk to the G9
    « Reply #109 on: 20 / May / 2008, 10:52:41 »
    @Supernovah

    About  C compiling, look here: All pages - CHDK Wiki

    subjects "Compiling CHDK under Windows/Linux"

    have fun,

    wim

     

    Related Topics