A530 Chdk port - 0.5 beta - General Discussion and Assistance - CHDK Forum

A530 Chdk port - 0.5 beta

  • 113 Replies
  • 51815 Views
*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
A530 Chdk port - 0.5 beta
« on: 19 / February / 2008, 15:00:07 »
Advertisements


CHDK 0.5 beta build+source: a530-trunk-334.zip - 0.23MB
CHDK 0.5 beta build+source with usb remote: a530-trunk-334-usbremote.zip - 0.23MB
thanks to image13

CHDK 0.4.1beta build: a530_chdk_0.4.1b.tar.gz - 0.20MB
dcraw.c patch: a530.patch - 0.00MB

CHDK 0.4beta build: a530_chdk_0.4b.tar.gz - 0.20MB
CHDK 0.3beta source: a530_chdk_0.3b_source.tar.gz - 0.40MB

Note: raw images taken with Chdk version 0.5b and 0.4b are compatible with most raw processor (since the images has same dimension of a610).
With version 0.4.1b raw images are a few wider (2620x1984 instead 2616x1960) but are *not* processable by all raw programs.
Dave Coffin (dcraw's author) provided me a patch to fix it.

If you are not a linux dcraw user, you should continue to use version 0.5b or 0.4b

Changelog:
- file numbering bug fixed
- osd seems to work fine now
- correct .crw are now saved - supported by dng4ps and dcraw (and maybe by others)
- possible issue with 'Make SD bootable'
- USB remote not implemented enabled for testing
- possible issues with parameter overrides

Known issues:
- no video fps override
- doesn't support simple chinese font

Important! At this stage it's very important that you leave me a feedback in this topic about bugs and/or not-working features you have found. This is helpful for me to fix it!





Old versions:
CHDK 0.3beta build: a530_chdk_0.3b.tar.gz - 0.20MB
CHDK 0.2beta build: a530_chdk_0.2b.tar.gz - 0.20MB
CHDK 0.1beta build  - only bin (no source): a530_chdk_0.1b.tar.gz - 0.20MB
CHDK alfa pre-release build WITHOUT RAW support - only bin (no source): a530chdk.tar.gz - 0.20MB
Old alfa build with source code: Old alfa build with source






Hi!
(first of all, I'm sorry for my english!)

I'm working on the A530 port of the CHDK - many thanks to stranger for the fw dump!

By now, I think I've almost done a 'big' part of whole process....... but still don't work.
The camera after selecting 'Update firmware' in menu, blinks for a while (blue led) and shutdown.

What I modified:

   boot.c
   makefile.inc
   lib.c
   capt_seq.c
   movie_rec.c

The code is very similiar to the a700, so I think that addresses and values are right (almost!) - I compared with a700 port.

Here you can download the work in progress 'platform' subtree for the a530 (is missing of primary.bin and the rest of chdk's source...):

http://www.zshare.net/download/7822674d52bd0b/
http://www.zshare.net/download/78757334d870a3/

I've tried to debug the boot.c with a 'blinking led function' but seems that the camera shutted down before executing boot function. It's possible?
Or maybe hardware is not yet accessible at this stage?
I read on some posts that the sudden shutdown is probably due to a different keymapping, so I'll try to fix this.
I didn't check yet if stubs_* files contains errors (excepted stubs_entry_2.s where added 2 refs founded with IDA).

Any helpful suggestion?

Many thanks!
« Last Edit: 20 / March / 2008, 14:36:19 by bondo »

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development
« Reply #1 on: 20 / February / 2008, 04:34:21 »
Some details about boot.c:

Code: [Select]
    long *canon_data_src = (void*)0xFFEDE3C0;
    long *canon_data_dst = (void*)0x1900;
    long canon_data_len = 0xB8D0;
    long *canon_bss_start = (void*)0xD1D0;
    long canon_bss_len = 0x91C70 - 0xD1D0;

and the modified h_usrKernelInit():

Code: [Select]
...
"MOV     R12, #0x800\n"
"LDR     R0, =h_usrRoot\n"
"MOV     R1, #0x4000\n"
        "LDR     R2, =0xC1C70\n" //0x91C70 + 0x30000
"STR     R12, [SP]\n"
...

makefile.inc

Code: [Select]
         MEMISOSTART=0x91C70

Actually, I need some help with keymapping.
I've found at 0xFFC17214 what I think is the keymap table (according to what has found mrblack51 here).
Even this is very similiar to the one found in a700 firmware, excepted some values.

Next job is to check this and verify if they are the cause of the firmware shutdown.

Byeee!

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development
« Reply #2 on: 20 / February / 2008, 05:22:43 »
Some progress!! The port now boots!   8)
It correctly starts, shows splash screen but none of the keys works (so, there will be work on finding the correct mapping).

What causes the firmware to shutdown was a mistake in loader/entry.S - wrong address for the turning off SD power.
Here's the right one:

Code: [Select]
        LDR     R3, =0xC022009c

So, here's lib.c code:

Code: [Select]
...
char *hook_raw_image_addr(){
    return (char*)0x10587d78;
}

long hook_raw_size(){
return 0x658560;
}

void *vid_get_viewport_live_fb(){
    return (void*)0x0;
}

void *vid_get_bitmap_fb(){
    return (void*)0x103c79a0; 
}

void *vid_get_viewport_fb(){
    return (void*)(0x10605748);
}

void *vid_get_viewport_fb_d(){
    return (void*)(*(int*)0x63a40);
}
...


As soon as the keys works I will test capt_seq.c and movie_rec.c...

Saluti!
(bye)
« Last Edit: 20 / February / 2008, 11:10:01 by bondo »

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development - some progress
« Reply #3 on: 20 / February / 2008, 14:15:22 »
Daily update: I tried some keymapping adjustment but none makes it run...  >:(

I also tried to override key wrapping and nothing changes... seems that there's some problem somewhere in the code just after showing splash screen. Maybe a wrong address in lib.c?

I will investigate  ;)



Last minute update:
the problem was in stubs_min.S - checked some values and now after upgrading firmware I'm able to switch in capture mode.
Keys are working - except Print buttons, so I can't navigate chdk menu - standard camera features works correctly, but when I take a picture the camera hangs.
Anyways, I think we are in the right direction and close to a very beta Chdk release. Stay tuned!!  8)
« Last Edit: 20 / February / 2008, 15:17:22 by bondo »

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development - some progress
« Reply #4 on: 21 / February / 2008, 04:13:45 »
Ok, finally Chdk starts correctly (with the correct keymapping).

Menu are browseable (games are working too :D) but camera crash taking picture - probably some capt_seq.c stupid error...
Battery status and clock (and other stuff, I suppose...) are not showed, so, we have to do a massive debug work  :o

In the first topic I append the download link for the latest source available... if you want to make some tests... you're welcome!

 8)
« Last Edit: 21 / February / 2008, 04:28:46 by bondo »

Re: A530 Porting development - alfa pre-release
« Reply #5 on: 21 / February / 2008, 05:41:23 »
Thank you very much for this, please keep up the good work, will be watching this thread.. 

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development - alfa pre-release
« Reply #6 on: 21 / February / 2008, 07:37:07 »
Analyzing the code with ida seems that there are some error in the dump at CaptSeqTask.
Here, for example:

Code: [Select]
ROM:FFD37A98 sub_FFD37A98
ROM:FFD37A98                 STMFD   SP!, {R4-R6,LR}
ROM:FFD37A9C                 LDR     R3, =0x64D4C
ROM:FFD37AA0                 LDR     R5, =0x6160
ROM:FFD37AA4                 SUB     SP, SP, #4
ROM:FFD37AA8                 MOVL    R1, 0xFFFFFFFF
ROM:FFD37AAC                 STR     R0, [R5]
ROM:FFD37AB0                 LDR     R0, [R3]
ROM:FFD37AB4                 BL      ClearEventFlag
ROM:FFD37AB8                 LDR     R3, =0x8F360
ROM:FFD37ABC                 LDR     R0, [R3,#0x74]
ROM:FFD37AC0                 BL      nullsub_25         <<<<<<<< see the note below
ROM:FFD37AC4                 BL      sub_FFD379EC
ROM:FFD37AC8                 LDR     R3, =0x6168
ROM:FFD37ACC                 LDR     R0, [R3]
ROM:FFD37AD0                 BL      sub_FFC8C4CC
ROM:FFD37AD4                 LDR     R3, =0x6164
ROM:FFD37AD8                 LDR     R3, [R3]
ROM:FFD37ADC                 CMP     R3, #1
ROM:FFD37AE0                 MOV     R4, #0
ROM:FFD37AE4                 BNE     loc_FFD37B10
ROM:FFD37AE8                 LDR     R3, [R5]
ROM:FFD37AEC                 LDR     R2, =0x8F2B8
ROM:FFD37AF0                 ADD     R3, R3, R3,LSL#1
ROM:FFD37AF4                 LDR     R0, [R2,R3,LSL#5]
ROM:FFD37AF8                 LDR     R1, =sub_FFD3781C
ROM:FFD37AFC                 MOV     R2, R4
ROM:FFD37B00                 LDR     R3, =sub_FFD378D4
ROM:FFD37B04                 STR     R4, [SP,#0x14+var_14]
ROM:FFD37B08                 BL      sub_FFCA30E8
ROM:FFD37B0C                 B       loc_FFD37BB0

nullsub_25: FFC8C01C
but this I think should be:
IsEmptyWriteCache_42: FFC8C010

this sub is in capt_seq.c:
Code: [Select]
void __attribute__((naked,noinline)) sub_FFD37A98_my(long p){
asm volatile (
"STMFD   SP!, {R4-R6,LR}\n"
"LDR     R3, =0x64D4C\n"
"LDR     R5, =0x6160\n"
"SUB     SP, SP, #4\n"
"LDR     R1, =0xFFFFFFFF\n"       //MOVL
"STR     R0, [R5]\n"
"LDR     R0, [R3]\n"
"BL      sub_FFC0FB44\n"        //ClearEventFlag
"LDR     R3, =0x8F360\n"
"LDR     R0, [R3,#0x74]\n"
//"BL      sub_FFC8C01C\n" //<<<<<<<<<<<<<<<
"BL      sub_FFC8C010\n"        //IsEmptyWriteCache
"BL      sub_FFD379EC\n"
"BL      capt_seq_hook_set_nr\n" // +

"B       sub_FFD37BB0\n"
);
}


At this point I will redump the fw directly on SD (now I think it's possible...) and re-check this before continue... be patience.


Thank you very much for this, please keep up the good work, will be watching this thread.. 

 ;)

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development - alfa pre-release
« Reply #7 on: 21 / February / 2008, 09:50:11 »
...a little fault of mine... in capt_seq.c, function sub_FFD37A98_my(), *correct* ending is:

Code: [Select]
...
"BL      capt_seq_hook_set_nr\n" // +
"B       sub_FFD37AC8\n"
);
}

...anyways, raw capturing still not work.
After changing with correct address (so function continue normally after capt_seq_hook_set_nr()), camera blink print led and shutdown (not hang but a proper shutdown).

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development - alfa pre-release
« Reply #8 on: 22 / February / 2008, 06:19:55 »
Firmware redumped directly to SD card but no difference between stranger's one (now just with the missing part at the end).
Rechecked capt_seq.c and no difference with dump.

Some doubt about lib.c raw values? Pseudo-code of 0xFFE8EA14 in the dump:

Code: [Select]
...
          if(SAVE_JPG) strcat(fn, ".jpg");
          if(SAVE_RAW) strcat(fn, ".crw");

          fd=open(fn);

          if(SAVE_JPG){
                 if(..) size=0x5a834;      // different sizes for different compression?
                 if(..) size=0x644c4;
                 if(..) size=0x10eb90;
                 write(fd, 0x10b85aa4, size);
          }
          if(SAVE_RAW){
                 write(fd, 0x10587d78, 0x658560);
          }
close(fd);
...

I think values in lib.c are just right for raw address and size...  ???

I notice that camera crash even when activating debug feature 'Show parameter data' - maybe some addressing error related also with this?

Any suggestion?   :blink:
« Last Edit: 22 / February / 2008, 07:38:16 by bondo »

*

Offline bondo

  • *
  • 42
  • Saluti from Italy!
Re: A530 Porting development - alfa pre-release
« Reply #9 on: 22 / February / 2008, 11:08:34 »
Ok, finally chdk works WITH RAW support!  :o

Problem was in shooting.c, changed PARAM_FILE_COUNTER from 0x37 to 0x34 and everything work just fine.

I've already wrote aperture_sizes_table[] and shutter_speeds_table[] with correct values. All remains to do is a great testing (I WANT YOU!  >:()

I released the 0.1beta version for testing (see in the first post of the topic the download link).

Enjoy boys!  8)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal