Author Topic: S5IS - Ported!  (Read 41467 times)

Offline DataGhost

  • Developers
  • Sr. Member
  • ****
  • Posts: 314
  • EOS 40D, S5IS
    • DataGhost.com
S5IS - Ported!
« on: 07 / April / 2008, 22:54:05 »
Good news, people... I completed the S5IS (1.01b) port :)
I know it's been a while since I started and I admit I didn't spend all time on only porting (I found it more interesting to experiment with some features I discovered) but at least it's done now. Today I just had to clean up the rest of my nonsense-debugging stuff, clean up ASM and get all this to work in the current trunk... which went a lot smoother and faster than I expected. It think these last bits took me a little over 7 hours including lunch.

Anyway, before you all fire up your cameras, I'd like to thank jeff666, ewavr and GrAnd for giving me some pointers (heh) I needed to complete this port.
I found it quite hard to start porting from scratch, so I don't think I could have done this without their help in this timespan. This is also why I have documented some things and I'm planning to make some real documentation on porting new cameras, although I'm not sure in what form yet. Also, during porting I found a lot of (hidden) features in the camera, some of which surprised me that they weren't in CHDK yet. I think you can expect at least some of them in the near future. I also still have a couple of ideas left and I think I found at least one flaw in CHDK, so I guess I'll have enough stuff to work on :)

Thank you for your patience, I hope you like it.


The source code should now be in SVN, for the impatient people I put a binary version online. I have tested as much as I can, please let me know when you find any problems.
Download: binary version only, 1.01b.
Known issues:
- ISO overrides do not really seem to work beyond ISO 800 (as the camera sees it). Possibly the sensor doesn't go higher than ISO800 and ISO1600 is done artificially or something else is wrong, I don't know yet. I have the strong tendency to ignore this problem (low priority at least) because noise isn't acceptable at ISO400 or higher anyway.
- Overriding the subject distance only works when MF is enabled. This is a limitation of the camera, it will crash when MF is not enabled, so the override isn't activated in that case. There is still ONE method that I know of to crash the camera with the subject distance override, that's when you have subject distance override enabled, click the shoot-button halfway to get focus, enable MF without releasing the shutter button (SD override enabled) and then fully shooting. You shouldn't notice this behaviour, though, this method is quite useless when overriding SD anyway, so it seems silly to use it. However, one may forget setting MF and remember it at the last moment, so I'm going to try to find out what is causing it.

Edit: sand did the necessary changes to make this work on the S5IS 1.01a as well. His code is in the trunk and a binary build should be available soon (I think it's also referenced somewhere in this topic).
« Last Edit: 11 / April / 2008, 02:40:07 by DataGhost »

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
S5IS 1.01b - Ported!
« Reply #1 on: 07 / April / 2008, 23:03:36 »
Well, under Windows I get compile error:

>> Entering to platform/s5is/sub/101b
../../../../tools/finsig.o: file not recognized: File format not recognized
collect2: ld returned 1 exit status

due to:
trunk/platform/s5is/sub/101b/Makefile:
...
stubs_entry.S: $(TARGET_PRIMARY) $(topdir)tools/finsig
...

and for any other cam we have:
stubs_entry.S: $(TARGET_PRIMARY) $(topdir)tools/signatures_$(PLATFORMOS).h

Any suggestions?

Offline DataGhost

  • Developers
  • Sr. Member
  • ****
  • Posts: 314
  • EOS 40D, S5IS
    • DataGhost.com
S5IS 1.01b - Ported!
« Reply #2 on: 07 / April / 2008, 23:08:45 »
Ah, I missed that. It works fine in Linux :p or are you really trying to find signatures? I haven't really tested that. Anyway, I falsely assumed the Makefiles didn't change, I'll look into it right away. If that's not the only thing, maybe you can do it, though, if it's not too big a hassle. I don't have a Windows toolchain so I don't know if I can easily reproduce your error.

Edit: I think I have it, I just copied the stuff from the A720 makefile, looks like that should do it.
« Last Edit: 07 / April / 2008, 23:19:21 by DataGhost »

Offline tommi2water

  • Full Member
  • ***
  • Posts: 157
  • IXUS 220 HS Firmware: 1.00c
S5IS 1.01b - Ported!
« Reply #3 on: 07 / April / 2008, 23:23:28 »
DataGhost,
Congratulations to you for your great job you did / are doing!

Hopefully your exams notes are also as great as the job you did for this community!  :)

Many thanks for completing the port!

Everyone should now be satisfied (except 1.01A Firmware users ;))! But for 1.01A it should be not such a big step like starting from the scratch.

Best regards,
tommi

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
S5IS 1.01b - Ported!
« Reply #4 on: 07 / April / 2008, 23:24:45 »
Well, now we don't need extra STUB's in stubs_entry_2.S because script find all of them (and place to stubs_auto.S), except:

../platform/s5is/sub/101b/libplatformsub.a(capt_seq.o): In function `loc_FF961184':
capt_seq.c:(.text+0x950): undefined reference to `sub_FF960D20'
capt_seq.c:(.text+0x954): undefined reference to `sub_FF960CA0'
../platform/s5is/sub/101b/libplatformsub.a(capt_seq.o): In function `loc_FF96130C':
capt_seq.c:(.text+0xa90): undefined reference to `sub_FF960D20'
capt_seq.c:(.text+0xa94): undefined reference to `sub_FF960CA0'

due to "LDR     R3, =sub_FF960D20\n" and other
But why not "LDR     R3, =0xFF960D20\n" ?

edit: And other thing: after signature search, not found: UIFS_WriteFirmInfoToFile, kbd_pwr_off, kbd_pwr_on.
Maybe stubs_entry_2.S can be updated:
NSTUB(UIFS_WriteFirmInfoToFile, 0xFF81096C)
NSTUB(kbd_pwr_off, 0xFF81096C)
NSTUB(kbd_pwr_on, 0xFF81096C)
« Last Edit: 07 / April / 2008, 23:28:14 by ewavr »

Offline DataGhost

  • Developers
  • Sr. Member
  • ****
  • Posts: 314
  • EOS 40D, S5IS
    • DataGhost.com
S5IS 1.01b - Ported!
« Reply #5 on: 07 / April / 2008, 23:37:45 »
Hm, heh. I must have missed those because they worked after I made those stubs. I just saw the message while compiling and added those stubs. During the final cleanup, I didn't notice them because they were still 'in use', I also didn't see that they were in fact LDR ops instead of BL-conditional ops. I guess that's a trivial fix. I'll also add those three nullstubs, thanks for noticing. Anyway, please let me know if you don't find anything anymore, so I can make one final commit instead of (possibly) several small ones.

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
S5IS 1.01b - Ported!
« Reply #6 on: 07 / April / 2008, 23:48:42 »
No compilation errors more. :)

and one theoretical :) question: if we change some "illegal" for this assembler instructions like BLX R12 to their opcodes (.long 0xE12FFF3C), this can work? (of course, instruction must do not contain relative to PC offsets (like LDR))
« Last Edit: 08 / April / 2008, 00:13:47 by ewavr »

Offline PhyrePhoX

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 2254
  • make RAW not WAR
    • PhyreWorX
S5IS 1.01b - Ported!
« Reply #7 on: 07 / April / 2008, 23:52:04 »
congratz! nice job. just today amazon wrote me i can buy a new s5is at special discount :D
well, i think i'm gonna stick to my s3is for now :p

Quote
Also, during porting I found a lot of (hidden) features in the camera, some of which surprised me that they weren't in CHDK yet. I think you can expect at least some of them in the near future. I also still have a couple of ideas left and I think I found at least one flaw in CHDK, so I guess I'll have enough stuff to work on Smiley
hm, i'm patiently awaiting your good and bad news. i wonder what these might be... keep up the good work, thanks :)

Offline wontolla

  • Sr. Member
  • ****
  • Posts: 413
  • S3 & G9 & A720
S5IS 1.01b - Ported!
« Reply #8 on: 08 / April / 2008, 00:35:40 »
Congratulations DataGhost, you must be very satisfied with your achievement. This community will grow even more with all the S5 users that will join. You are not just adding CHDK capabilities to another camera model, but you are throwing light upon the future of this project.

CHDK Forum

S5IS 1.01b - Ported!
« Reply #8 on: 08 / April / 2008, 00:35:40 »

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
S5IS 1.01b - Ported!
« Reply #9 on: 08 / April / 2008, 02:29:42 »
@DataGhost

makefile.inc:
#MEMISOSTART=0x9B610 // Does not work (if I recall correctly). Offset by 0x10000. Comment kept for future reference.

boot.c:
long canon_bss_len = 0x9d024 - (0xfc04 - 0x1900); // 0x9d024 - (0xfc04 - 0x1900) (a710: 0x9F9B0 - 0xD680)


Bold numbers should be the same. 0x9B610, I suspect.
CHDK Developer.

Offline GrAnd

  • Developers
  • Hero Member
  • ****
  • Posts: 916
  • [A610, S3IS]
    • CHDK
S5IS 1.01b - Ported!
« Reply #10 on: 08 / April / 2008, 02:36:54 »
Hmm... It seems you did not edit constatnts in boot.c:boot() ater copying from A720:

A720:
Code: [Select]
    long *canon_data_src = (void*)0xFFE9C5D0;
    long *canon_data_dst = (void*)0x1900;
    long canon_data_len = 0xfc04 - 0x1900; // data_end - data_start
    long *canon_bss_start = (void*)0xfc04; // just after data
    long canon_bss_len = 0x9d024 - 0xfc04;

S5IS:
Code: [Select]
    long *canon_data_src = (void*)0xFFE9C5D0;
    long *canon_data_dst = (void*)0x1900;
    long canon_data_len = 0xfc04 - 0x1900; // data_end - data_start
    long *canon_bss_start = (void*)0xfc04; // just after data (A710: 0xD680)
    long canon_bss_len = 0x9d024 - (0xfc04 - 0x1900); // 0x9d024 - (0xfc04 - 0x1900) (a710: 0x9F9B0 - 0xD680)


But the constants:
A720:
Code: [Select]
ROM:FFC00188 off_FFC00188    DCD unk_FFE9C5D0                  ; DATA XREF: RestartDevice-1B774r
ROM:FFC0018C dword_FFC0018C  DCD 0x1900                        ; DATA XREF: RestartDevice-1B770r
ROM:FFC00190 dword_FFC00190  DCD 0xF0C4                        ; DATA XREF: RestartDevice-1B76Cr
ROM:FFC00194 dword_FFC00194  DCD 0x9D024                       ; DATA XREF: RestartDevice-1B758r

S5IS:
Code: [Select]
ROM:FF81019C off_FF81019C    DCD unk_FFB07EB8        ; DATA XREF: RestartDevice-1CBDCr
ROM:FF8101A0 dword_FF8101A0  DCD 0x1900              ; DATA XREF: RestartDevice-1CBD8r
ROM:FF8101A4 dword_FF8101A4  DCD 0x1056C             ; DATA XREF: RestartDevice-1CBD4r
ROM:FF8101A8 dword_FF8101A8  DCD 0x9B610             ; DATA XREF: RestartDevice-1CBC0r
CHDK Developer.

Offline DataGhost

  • Developers
  • Sr. Member
  • ****
  • Posts: 314
  • EOS 40D, S5IS
    • DataGhost.com
S5IS 1.01b - Ported!
« Reply #11 on: 08 / April / 2008, 02:40:09 »
Hm, I guess. I didn't know what they did and it worked, so I ignored them. Maybe this is why 0x9B610 didn't work... I'll test it in my debug-build and fix it ASAP.

Anyway, I found another issue since I-don't-know-when. The ubasic shoot command used to work fine, though now it doesn't anymore. I *THINK* I have found the source of this cause... the shoot command does not release shoot_half, therefore the camera stays in some in-progress mode, therefore shooting_in_progress never returns false until that button is released and therefore the script does not continue. Raising/closing the flash seem to shortly set PROPCASE_SHOOTING to 0, so that will continue the script. I still have to figure out a way to fix this and I need to find out why it worked before. This is probably something camera-specific which needs to be worked around.

Oh wait, I just figured it out partially. I only tested the shoot command with my external flash (580EX II) on. This unit causes the camera to shortly set PROPCASE_SHOOTING to 0. Therefore it will continue shooting.

Offline ewavr

  • Developers
  • Hero Member
  • ****
  • Posts: 1057
  • A710IS
S5IS 1.01b - Ported!
« Reply #12 on: 08 / April / 2008, 02:47:13 »
Hmm... It seems you did not edit constatnts in boot.c:boot() ater copying from A720:
S5IS:
Code: [Select]
    long canon_bss_len = 0x9d024 - (0xfc04 - 0x1900); // 0x9d024 - (0xfc04 - 0x1900) (a710: 0x9F9B0 - 0xD680)

And from very old version of A720, because 0x1900 subtraction is error here (I searched  for this error two days  :().
« Last Edit: 08 / April / 2008, 03:07:55 by ewavr »

Offline DataGhost

  • Developers
  • Sr. Member
  • ****
  • Posts: 314
  • EOS 40D, S5IS
    • DataGhost.com
S5IS 1.01b - Ported!
« Reply #13 on: 08 / April / 2008, 02:50:56 »
By the way, I think I found the keyboard problem... it just came to me and then I looked into the A720 keymap. KEY_SHOOT_HALF = 0x40000000, key_shoot_full = 0xC0000000 (== 0x80000000 | 0x40000000). I have those separately in my keymap. I guess fixing that should fix the shoot problem. First I need to have some more food, though :)

Offline critical1

  • Rookie
  • *
  • Posts: 7
  • Powershot S5is - 1.01a
S5IS 1.01b - Ported!
« Reply #14 on: 08 / April / 2008, 03:05:42 »
Congratulations on your new S5 CHDK, all that need doing now is ironing out the bugs :) which looks like its already happening... Super fast and Super COOL.

Critical1
Critical1
Powershot S5is - 1.01a

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal