Author Topic: S90 Porting Thread  (Read 46268 times)

Offline battika

  • Newbie
  • *
  • Posts: 3
Re: S90 Porting Thread
« Reply #45 on: 03 / February / 2010, 20:55:06 »
Thanks ERR99 for your suggestions, I will have a look into the boot code shortly. I'm very new to this porting process and your efforts with the G11 port has helped me a lot. You made a terrific job there.

Offline Microfunguy

  • Developers
  • Guru Member
  • ****
  • Posts: 3027
    • StereoData Maker
Re: S90 Porting Thread
« Reply #46 on: 03 / February / 2010, 21:50:11 »
I think ERR99 could be of very great help to you after his very recent good G11 work.

No-one has ever spelled-out every single step of the porting process.

Maybe you could as you go along ?



David

Offline rachelkitty

  • Rookie
  • *
  • Posts: 19
Re: S90 Porting Thread
« Reply #47 on: 06 / February / 2010, 21:38:20 »
Unfortunately, the porting process has stalled, waiting for someone to come along who wants to and is able to actually disassemble the firmware, find the entry points to functions, figure out what they do, and write C code to call them from CHDK.   

Yes, due to the fact that there are other pressures on my time atm. I'll be getting back to it soon. i have most of the stubs and so on sorted from previously anyway. So I'll have another crack at things this week.

Offline rachelkitty

  • Rookie
  • *
  • Posts: 19
Re: S90 Porting Thread
« Reply #48 on: 07 / February / 2010, 00:18:21 »
stubs_entry.S
Code: [Select]
// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
#include "stubs_asm.h"

NSTUB(AllocateMemory, 0xffaa3438)
NSTUB(AllocateUncacheableMemory, 0xff8393ec)
NSTUB(Close, 0xff835980)
NSTUB(CreateTask, 0xff81e5b4)
NSTUB(DeleteFile_Fut, 0xff83530c)
// ERROR: EnterToCompensationEVF is not found!
NSTUB(ExecuteEventProcedure, 0xff8898ac)
// ERROR: ExitFromCompensationEVF is not found!
// Best match: 57%
NSTUB(ExitTask, 0xff81e844)
NSTUB(Fclose_Fut, 0xff835488)
NSTUB(Feof_Fut, 0xff835674)
NSTUB(Fflush_Fut, 0xff8356b0)
NSTUB(Fgets_Fut, 0xff8355dc)
NSTUB(Fopen_Fut, 0xff835448)
NSTUB(Fread_Fut, 0xff835534)
NSTUB(FreeMemory, 0xffaa3430)
// Best match: 91%
NSTUB(FreeUncacheableMemory, 0xff83942c)
NSTUB(Fseek_Fut, 0xff835628)
NSTUB(Fwrite_Fut, 0xff835588)
// Best match: 52%
NSTUB(GetBatteryTemperature, 0xff863588)
// Best match: 52%
NSTUB(GetCCDTemperature, 0xff863514)
// Best match: 85%
NSTUB(GetCurrentAvValue, 0xff95c14c)
NSTUB(GetDrive_ClusterSize, 0xff86fc30)
NSTUB(GetDrive_FreeClusters, 0xff86fc90)
NSTUB(GetDrive_TotalClusters, 0xff86fc64)
// Best match: 64%
NSTUB(GetFocusLensSubjectDistance, 0xff95a720)
NSTUB(GetFocusLensSubjectDistanceFromLens, 0xff95ab68)
// Best match: 96%
NSTUB(GetOpticalTemperature, 0xff8635fc)
// Best match: 66%
NSTUB(GetParameterData, 0xff996808)
// Best match: 72%
NSTUB(GetPropertyCase, 0xff88d5e0)
// Best match: 96%
NSTUB(GetSystemTime, 0xffaa3490)
// Best match: 74%
NSTUB(GetZoomLensCurrentPoint, 0xff95ed28)
NSTUB(GetZoomLensCurrentPosition, 0xffa9669c)
// Best match: 64%
NSTUB(IsStrobeChargeCompleted, 0xff8db30c)
NSTUB(LocalTime, 0xff8871a8)
// Best match: 93%
NSTUB(LockMainPower, 0xff895274)
// ERROR: Lseek is not found!
// Best match: 92%
NSTUB(MakeDirectory_Fut, 0xff835380)
// Best match: 57%
NSTUB(MoveFocusLensToDistance, 0xffb030c8)
// Best match: 58%
NSTUB(MoveZoomLensWithPoint, 0xffaa0a5c)
// Best match: 62%
NSTUB(NewTaskShell, 0xff88d08c)
NSTUB(Open, 0xff835928)
// ERROR: PT_PlaySound is not found!
// Best match: 86%
NSTUB(PostLogicalEventForNotPowerType, 0xff8930a0)
// Best match: 92%
NSTUB(PostLogicalEventToUI, 0xff8930ec)
NSTUB(Read, 0xff81ab78)
NSTUB(ReadFastDir, 0xffa8416c)
// ERROR: RefreshPhysicalScreen is not found!
// ERROR: Remove is not found!
// Best match: 53%
NSTUB(RenameFile_Fut, 0xff835444)
// ALT: NSTUB(RenameFile_Fut, 0xffa70478) // 8/7
// ALT: NSTUB(RenameFile_Fut, 0xffa704c8) // 8/7
// Best match: 93%
NSTUB(SetAutoShutdownTime, 0xff8952e8)
// Best match: 81%
NSTUB(SetCurrentCaptureModeType, 0xff89ca38)
// Best match: 55%
NSTUB(SetFileTimeStamp, 0xff94a7f8)
// Best match: 64%
NSTUB(SetLogicalEventActive, 0xff894fc4)
// Best match: 68%
NSTUB(SetParameterData, 0xff9966e4)
// Best match: 89%
NSTUB(SetPropertyCase, 0xff88d4dc)
// Best match: 92%
NSTUB(SleepTask, 0xff839070)
// Best match: 60%
NSTUB(TakeSemaphore, 0xff838d38)
// ERROR: TurnOffBackLight is not found!
// ERROR: TurnOnBackLight is not found!
// ERROR: UIFS_WriteFirmInfoToFile is not found!
// Best match: 93%
NSTUB(UnlockMainPower, 0xff8951c8)
NSTUB(UpdateMBROnFlash, 0xff813f74)
NSTUB(VbattGet, 0xff831e08)
NSTUB(Write, 0xff835a10)
NSTUB(_log, 0xffb3dd88)
NSTUB(_log10, 0xffb3cccc)
NSTUB(_pow, 0xffb3ce3c)
NSTUB(_sqrt, 0xffb3f0f0)
NSTUB(close, 0xff81a990)
NSTUB(closedir, 0xffa83ff4)
// Best match: 71%
NSTUB(closefastdir, 0xffa84308)
// Best match: 95%
NSTUB(free, 0xff814138)
// Best match: 86%
NSTUB(kbd_p1_f, 0xff8335d0)
// Best match: 86%
NSTUB(kbd_p1_f_cont, 0xff8335dc)
// Best match: 86%
NSTUB(kbd_p2_f, 0xff832e90)
// Best match: 51%
NSTUB(kbd_pwr_off, 0xff8603ec)
// ERROR: kbd_pwr_on is not found!
// Best match: 84%
NSTUB(kbd_read_keys, 0xff833554)
// Best match: 78%
NSTUB(kbd_read_keys_r2, 0xff85fb68)
// ALT: NSTUB(kbd_read_keys_r2, 0xff85fb4c) // 17/5
NSTUB(lseek, 0xff835a9c)
NSTUB(malloc, 0xff8140dc)
NSTUB(memcmp, 0xff8203ec)
NSTUB(memcpy, 0xff83e9ec)
NSTUB(memset, 0xffa1389c)
NSTUB(mkdir, 0xff835df4)
NSTUB(mktime_ext, 0xff8aaf6c)
NSTUB(open, 0xff81a8e0)
NSTUB(opendir, 0xffa84038)
// ERROR: openfastdir is not found!
NSTUB(qsort, 0xffaf37d8)
// Best match: 95%
NSTUB(rand, 0xff8204f4)
NSTUB(read, 0xff81ab78)
// ERROR: readfastdir is not found!
// ERROR: rename is not found!
// Best match: 95%
NSTUB(srand, 0xff8204e8)
NSTUB(stat, 0xff835ad8)
// ALT: NSTUB(stat, 0xff86d074) // 30/0
// Best match: 61%
NSTUB(strcat, 0xff813f38)
// Best match: 56%
NSTUB(strchr, 0xff813fc0)
NSTUB(strcmp, 0xff8203a8)
NSTUB(strcpy, 0xff820390)
NSTUB(strftime, 0xff8aa974)
NSTUB(strlen, 0xff81400c)
NSTUB(strncmp, 0xff813f74)
// Best match: 73%
NSTUB(strncpy, 0xff813f38)
// Best match: 71%
NSTUB(strrchr, 0xff83e9c4)
// ALT: NSTUB(strrchr, 0xff8aa73c) // 18/8
// Best match: 96%
NSTUB(strtol, 0xff83eccc)
NSTUB(strtolx, 0xff83ead0)
// Best match: 86%
NSTUB(time, 0xff887720)
NSTUB(vsprintf, 0xff820354)
NSTUB(write, 0xff81abd8)

stubs_entry_2.S
Code: [Select]
#include "stubs_asm.h"
//FOUND
NHSTUB(TurnOffBackLight, 0xFF8A3FD0)
NHSTUB(TurnOnBackLight,  0xFF8A3FE8)
NHSTUB(EnterToCompensationEVF, 0xFF836D0C)
NHSTUB(ExitFromCompensationEVF, 0xFF836D50)
NHSTUB(Lseek, 0xFF835530)
NHSTUB(PT_PlaySound, 0xFF88173C)
NHSTUB(RefreshPhysicalScreen, 0xFFA08E40)
NHSTUB(Remove, 0xFF835418)
NHSTUB(UIFS_WriteFirmInfoToFile, 0xFF97E91C)
NHSTUB(kbd_pwr_off, 0xFF86089C)
NHSTUB(openfastdir, 0xFFA7D510)
NHSTUB(readfastdir, 0xFFA7D644)
NHSTUB(rename, 0xFF8354C0)
NHSTUB(LEDDrive, 0xFF85D5F8)
NHSTUB(SetScriptMode, 0xFF810EE4) //not definite, recheck later
NHSTUB(apex2us, 0xFFA0D734)
NHSTUB(MakeAFScan, 0xFF9645F0)
NHSTUB(ExpCtrlTool_StartContiAE, 0xFF8446CB)
NHSTUB(WriteSDCard, 0xFF94A478)
NHSTUB(UnlockAF, 0xFF836BA0)
NHSTUB(DoAFLock, 0xFF836B68)
NHSTUB(UnsetZoomForMovie, FF8A0DC0)

//NOTFOUND - nullsub

NHSTUB(kbd_pwr_on, 0xFF810B04)//cannot locate
NHSTUB(rewinddir, 0xFF810B04)//cannot locate
NHSTUB(SetZoomActuatorSpeedPercent, 0xFF810B04)//cannot locate
NHSTUB(Unmount_FileSystem, 0xFF810B04)//cannot locate
NHSTUB(Mount_FileSystem, 0xFF810B04)//cannot locate
//NHSTUB(platformsub_kbd_fetch_data, 0xFF833350)

stubs_min.S
Code: [Select]
#include "stubs_asm.h"

DEF(physw_status, 0x330d8)                
DEF(physw_run, 0x1C38 + 0x0C)            
DEF(FlashParamsTable,0xFFBEFB70)      
DEF(zoom_busy, 0x7a00)          
DEF(focus_busy, 0x78d4 + 8)              
DEF(canon_menu_active, 0x3034 + 4)        
DEF(canon_shoot_menu_active, 0x8944 + 1)  
DEF(recreview_hold, 0x8944)    
DEF(zoom_status, 0x8A84)                  
DEF(movie_status, 0x7ab0 + 0x38)        
DEF(enabled_refresh_physical_screen, 0xa36c)
DEF(playrec_mode, 0x2d60+0x4)        
DEF(some_flag_for_af_scan, 0x7FF4)    
DEF(led_table, 0x24AC + 0x04)            
DEF(levent_table,0xFFB95D20) //uncertain

lib.c and boot.c is pretty much done. need to look at movie_rec and capt_seq still then move on to other stuff.
« Last Edit: 07 / February / 2010, 00:26:19 by rachelkitty »

Offline Microfunguy

  • Developers
  • Guru Member
  • ****
  • Posts: 3027
    • StereoData Maker
Re: S90 Porting Thread
« Reply #49 on: 07 / February / 2010, 02:19:27 »
It is a lot of work and we are all so busy with our brief lives.
Good to see you getting back to this  :)

Remember, ERR99 now has all the time in the World and I am sure would be only too happy to advise !



David

Offline MauricioRPP

  • Rookie
  • *
  • Posts: 38
Re: S90 Porting Thread
« Reply #50 on: 11 / February / 2010, 07:27:32 »
can I help in some way?? I know I can't code in ASM, but I could test your code Rachelkitty when it becomes a file that I can load in the camera. thanks for your efforts!

Offline rachelkitty

  • Rookie
  • *
  • Posts: 19
Re: S90 Porting Thread
« Reply #51 on: 12 / February / 2010, 05:08:40 »
So, bootup is runnign with a fallover late on, seems to be when screen would normally be initialising, need to take a look at that.

Offline Microfunguy

  • Developers
  • Guru Member
  • ****
  • Posts: 3027
    • StereoData Maker
Re: S90 Porting Thread
« Reply #52 on: 12 / February / 2010, 05:48:47 »
Are any folders created ?

Try commenting-out most of the spytask functions and then enable them one-by-one.


David

Offline ERR99

  • Sr. Member
  • ****
  • Posts: 325
Re: S90 Porting Thread
« Reply #53 on: 12 / February / 2010, 14:41:23 »
If commenting out the spytask does not help, comment out the kbd task also and start the original kbd-task instead.
I dont know how the S90 works, but on the G11 i had to change the "usual" code in kbd.c,
because with the standard implementation, display&key lightning are switched off and the camera "looks" dead/off, but it wasnt.

Also disable all chdk hook tasks (capture, movie, etc.). There are not so important now, chdk will run also without them.
You can activate them later, after you are sure that spytask and kbd task are running stable.

Another pitfall, which often crashes the g11 during startup, was the spytask config loading. If fixed that in the G11 port. I expect that you also need the other chdk core changes for the new dryos, so maybe you also have to set the CAM_DRYOS_2_3_R39 define in camera.h. For that, you need the actual chdk code (with g11 port included).

CHDK Forum

Re: S90 Porting Thread
« Reply #53 on: 12 / February / 2010, 14:41:23 »

Offline rachelkitty

  • Rookie
  • *
  • Posts: 19
Re: S90 Porting Thread
« Reply #54 on: 12 / February / 2010, 21:13:42 »
Run into a bit of an issue, can't locate ScreenLock and ScreenUnlock. Anyone else that could have a look through the dump and see if they can find?

Offline Microfunguy

  • Developers
  • Guru Member
  • ****
  • Posts: 3027
    • StereoData Maker
Re: S90 Porting Thread
« Reply #55 on: 12 / February / 2010, 21:44:11 »
Are the G11 and SX200IS the best firmwares to compare the S90 with ?


Offline rachelkitty

  • Rookie
  • *
  • Posts: 19
Re: S90 Porting Thread
« Reply #56 on: 12 / February / 2010, 21:49:05 »
The G11 hardware is almost identical to the S90, except for the bigger body, so it's a pretty good choice for comparisons. I've run through a whole bunch of firmwares so far, but those 2 functions are the ones that are eluding me.

Offline Microfunguy

  • Developers
  • Guru Member
  • ****
  • Posts: 3027
    • StereoData Maker
Re: S90 Porting Thread
« Reply #57 on: 12 / February / 2010, 23:37:33 »
OK, I will try to find them after my tea.


Offline rachelkitty

  • Rookie
  • *
  • Posts: 19
Re: S90 Porting Thread
« Reply #58 on: 12 / February / 2010, 23:40:37 »
Thanks very much, I appreciate any help :)

Offline Microfunguy

  • Developers
  • Guru Member
  • ****
  • Posts: 3027
    • StereoData Maker
Re: S90 Porting Thread
« Reply #59 on: 13 / February / 2010, 01:58:36 »
Assuming that the first firmware dump you made available is OK, the addresses are :-

NHSTUB(ScreenLock, 0xFFA0A10C)
NHSTUB(ScreenUnlock,0xFFA0A134)

Just to confirm, I have :-

ROM:FFA0A10C                 STMFD   SP!, {R4,LR}
ROM:FFA0A110                 BL      sub_FFA0A2EC


David

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal