SX110IS - howto start porting - page 6 - DryOS Development - CHDK Forum

SX110IS - howto start porting

  • 573 Replies
  • 197611 Views
Re: SX110IS - howto start porting
« Reply #50 on: 30 / March / 2009, 22:26:26 »
Advertisements
I'm like a crack addict, checking this thread daily!  :-D

*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #51 on: 01 / April / 2009, 15:13:41 »
Just an update: still working on porting sx110, no progress so far (but most work is done)
Problem: camera doesn't boot properly.

Something goes terribly wrong in the boot sequence. Still have no clue what it is.
I put some blink code (light a led) in between and that works. Means, boot() is starting up.

deleted: some wrong code

That's my stubs_min.S:

#include "stubs_asm.h"

DEF(physw_status, 0xFB38)   //found at ROM:FFC11100
DEF(physw_run, 0x1BD8 + 0xC)  //found at  ROM:FFC11064 and ROM:FFC11080
DEF(FlashParamsTable,0xFFEDD7C4)   //found at ROM:FFE14238
DEF(zoom_busy, 0x86B8+0x14)   //found at ROM:FFD121B4 and ROM:FFD1206C
DEF(focus_busy, 0x85B4+0x8)   //found at ROM:FFD0CD90 and ROM:FFD0CDA8
DEF(canon_menu_active, 0x93D0+0x4)   //found at ROM:FFD2CAA0 AND ROM:FFD2C87C , not 100% sure
DEF(canon_shoot_menu_active, 0x9B0C+0x1)   //found at ROM:FFD49AD4 and ROM:FFD498BC
DEF(recreview_hold, 0x9770+0xD0)   //found at ROM:FFD3AE34 and ROM:FFD3AA58
DEF(zoom_status, 0xC79C)   //found at ROM:FFE1575C 
DEF(movie_status, 0x5240+0x38)      //ROM:FFC4C120 and ROM:FFC4C788 (compare ROM:FF8634E8 in SX10!!!!)
DEF(enabled_refresh_physical_screen, 0xAA2C+0x30 )   //found at ROM:FFD8F750 and ROM:FFD8FBAC
DEF(playrec_mode, 0x5408+0x4)   //found at ROM:FFC545B4 and ROM:FFC542A4 (?????)

Maybe someone is able and willing to check those variables again from scratch on.

So far, so good.
Regards.
« Last Edit: 02 / April / 2009, 15:24:10 by chdkj »
sx110

*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #52 on: 01 / April / 2009, 16:20:59 »
I've attached all my files with code for sx110. Keep in mind that this is alpha code and the camera will not boot with it!. Feel free to test it, adapt it or make better code!
--> the zip-archive doesn't include PRIMARY.BIN!

Hope, that someone will participate and move it forward.
Have fun!

edit: deleted old code archive.
« Last Edit: 02 / April / 2009, 16:22:03 by chdkj »
sx110

*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #53 on: 02 / April / 2009, 16:21:28 »
What a mess!
First: All my branch instructions were wrong. All! Didn't realize that branch to something means branch to label (and not to hex address) --> fixed
Second: stubs_min.S was wrong --> fixed

All former problems are gone but result is still the same: camera doesn't boot. What is going on here?

Instruction "BL    sub_FFC02D3C\n" in boot.c -sub_FFC00F98_my()- is the last reached. I could take more and more time to chase the bug but I'm afraid that is useless --> someone has to check my code and all stuff around, please. I believe that I missed some point...

The whole code is attached (without PRIMARY.BIN which can be downloaded separately from http://chdk.wikia.com/wiki/SX110IS).

Btw, is there anybody out there, who wants to participate at porting sx110?
Where is nomi_68k?

Regards.

edit: attachment deleted
« Last Edit: 07 / April / 2009, 15:27:45 by chdkj »
sx110


Re: SX110IS - howto start porting
« Reply #54 on: 02 / April / 2009, 18:37:58 »
I have an SX110 but am not worth much coding-wise.  If there is anything I can do though, please don't hesitate to hit me up. 

*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #55 on: 06 / April / 2009, 17:03:05 »
Hi folks, need some help finally.

Porting of sx110 stucks. I'm running out of ideas.
I think I have ported almost all camera dependent parts. But I can't test that it works because the camera doesn't boot. I'm struckling around for days/weeks now and can't identify the reason.

I'm appreciate for any help.

What I've done so far:
core/gui.c
core/kbd.c
include/camera.h
loader/<cam>/main.c
loader/<cam>/resetcode/main.c
platform/<cam>/kbd.c
platform/<cam>/lib.c
platform/<cam>/main.c
platform/<cam>/shooting.c
platform/<cam>/wrappers.c
platform/<cam>/sub/<fw>/boot.c
platform/<cam>/sub/<fw>/capt_seq.c
platform/<cam>/sub/<fw>/lib.c
platform/<cam>/sub/<fw>/makefile.inc
platform/<cam>/sub/<fw>/movie_rec.c
platform/<cam>/sub/<fw>/stubs_entry.S
platform/<cam>/sub/<fw>/stubs_entry_2.S
platform/<cam>/sub/<fw>/stubs_min.S

All files are checked and/or modified. I think I've understand the depencies of all those files, the boot process and how CHDK works.
Environment: Windows CHDK Shell 2.12, Trunk 725 (I had problems with setting up a working cross-compile-environment under Linux, so I decided to do the job under Windows)


What's wrong?
Boot process stops (presumably not really, it behaves as not as expected :-)).
The call trace is as following, observated by blinking LEDs.
--> startup () --> boot() --> loc_FFC001A4_my() --> sub_FFC00F98_my()

Let's concentrate to sub_FFC00F98_my: there are 2 interesting things..
1.) we have to change the preparation of a function call (""LDR    R1, =sub_FFC04D90_my\n")
2.) divert to another function nearly at the end ("BL    sub_FFC02D3C\n")

The latter statement is called but doesn't come back to sub_FFC00F98_my (I implemented those functions as inline asm in boot.c ).
As a remainder: sub_FFC02D3C contains 3 of those DryosPanic-calls.  sub_FFC02D3C jumps to sub_FFC01998 at the end. sub_FFC01998 jumps again to loc_FFC00528.
loc_FFC00528 does some useful things and the last statement of it is ""LDMFD   SP!, {R0-R12,LR,PC}^\n". In my understanding, loc_FFC00528 should return to sub_FFC00F98_my. But not at all: its return to somewhere and we are lost...

Memory Mapping? Stack Smashing? Dullness?

BTW, if I'm change the boot procedure to use the original loc_FFC001A4 instead of our loc_FFC001A4_my (that means leave CHDK at a very early stage and resume with Canon-code) so nothing will happen --> camera doesn't bot. But I can't exclude a fundamental misunderstandig of CHDK of mine.

So, what happens? As said before, I believe that something goes wrong in advance (possibly before startup()). That means either I did a fatal mistake (most likely) or SX110 is more tricky than expected.

@the more experienced developers: I know for sure that dealing with camera ports is a time consuming task and that it is not in your primary interest to go in with every camera on the market (there are even other things around us :-)). But, it is possible, that someone might check my code and take a look at the fw dump?

Are there any ideas?

Cheers.
 

Again, I've put all my code into an archive and attached it to this post (but you have to use a forum account to download the attachment)

edit: attachment deleted
« Last Edit: 07 / April / 2009, 15:28:08 by chdkj »
sx110

*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #56 on: 07 / April / 2009, 14:52:01 »
A breakthrough at last!
SX110 boots further than before. Camera moves the lens out and reacts in some kind to keys pressed. But it doesn't show a logo/menu/screen. Zoom wheel doesn't work.
The reason for the problems before was a typo in boot.c. The wrong statement was syntactically right but leads to trouble.
I was starting to loose my hope for a successful port but now it looks much better than before. But I need assistance!

Here is the current status:
The lens will be moved out to its maximum zoom position. I think that is not so good...
As far as I understand CHDK offers two starting modes: playback and record mode. Playback mode will be reached by a short pressed power button, record mode by a longer pressed power button. Record mode will extend the lens. Camera doesn't show the boot logo in both modes. Actually, gui_redraw and others will be reached...

Some blinking LEDs appear after pressing keys -even shoot button-, no reaction to jogdial or zoom wheel.


There are some things left:
- files finished and checked but still some uncertainty exists:
   core/
      kbd.c   ZSTEP_TABLE_SIZE, nTxtbl
   platform/
      kbd.c   (KEY_MASKS ?)   --> http://chdk.setepontos.com/index.php/topic,2900.75.html
      shooting.c (dof_tbl ?)
   platform/sub/
      lib.c (hook_raw_image_addr ?, vid_get_viewport_live_fb ?)
- files finished but still need corrections
   include/
      camera.h (cam_CFAPattern, CAM_COLORMATRIX1, cam_CalibrationIlluminant1, CAM_ACTIVE_AREA_*)   --> Correct settings can be copied from DGN4PS2 settings
- firmware update method --> http://chdk.setepontos.com/index.php/topic,2995.0.html
- Testing, testing, testing

Everyone is invited to assist!

Again: my code is attached without PRIMARY.BIN and you have to be a forum member for download

Attention: be advised that this is experimental code. It might be damage your camera. If you could not accept this, do not use this code!

There is some debug code (blinking LEDs) in it, look for debug_my_blink or debug_my_blink2 or debug_led. Don't think that assembler routines will running as expected after we put some C-based debug code amongst.

EDIT: Attachment deleted (final version released on Autobuild already)
« Last Edit: 04 / November / 2009, 14:06:56 by chdkj »
sx110

*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #57 on: 07 / April / 2009, 15:25:38 »
update: gui_draw_splash will be reached but the lcd keeps blank.

Cheers.
sx110


*

Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #58 on: 07 / April / 2009, 16:49:16 »
Another update:
You can shoot pictures! The lcd still keeps blank, but the camera is able to shoot (JPG) and store pics to card. You have to press the playback button and then the shutter button. It's amazing...

There a still open questions about modemap and mode_get() in platform/<cam>/main.c. I think modemap could be as following (inspired by sx100 and sx10)

Code: [Select]
modemap[] = {
{ MODE_VIDEO_STD,          2597   }, // video standby, sx10
{ MODE_VIDEO_STD,          3622   }, // video in progress, sx10
    { MODE_VIDEO_COMPACT,      2599  },
    { MODE_SCN_AQUARIUM,       16407 },  //16408 in sx10
    { MODE_SCN_SNOW,           16403 },  //16404 in sx10
{ MODE_SCN_FOLIAGE,        16403  }, //sx10
{ MODE_SCN_SUNSET,         16402  }, //sx10
    { MODE_SCN_NIGHT,          16398 }, 
{ MODE_SCN_ISO_3200,       16413  }, //sx10
    { MODE_SCN_FIREWORK,       16405 },  //16406 in sx10
    { MODE_SCN_BEACH,          16404 },  //16405 in sx10
    { MODE_INDOOR,             32785 },
    { MODE_KIDS_PETS,          32784 },
    { MODE_NIGHT_SNAPSHOT,     32779 },
    { MODE_LANDSCAPE,          32780 },
    { MODE_PORTRAIT,           32781 },
{ MODE_AUTO,               32768  },
{ MODE_P,                  32772  },
{ MODE_TV,                 32771  },
{ MODE_AV,                 32770  },
{ MODE_M,                  32769  }
}

Where can we get a working modemap from?

Cheers.
sx110

Re: SX110IS - howto start porting
« Reply #59 on: 07 / April / 2009, 16:53:52 »
Great!

I am watchting this thread now for some time.
I think i cannot be of any help. I even tried to read some docs about arm assembling but it is hopeless. I don`t have any knowledge of coding/programming.
For me it would be easier to learn, how to fly.
So all I can do is thank You and hope that You won`t loose Your motivation.

Really great work!


 

Related Topics