SX110IS - howto start porting

  • 573 Replies
Re: SX110IS - howto start porting
« Reply #30 on: 25 / February / 2009, 16:58:07 »
should be LDR R3,=task_CaptSeqTask_my
Shame on me!!  :D I was very tired.
To forgive me, I post all the functions that I found with a very high grade of confidence.
But I confirm you that there's the necessity to find someone much more experienced than me to do the porting.  :(
However I still try to work on this job.


#include "stubs_asm.h"

NSTUB(AllocateMemory, 0xFFE08340)
NSTUB(AllocateUncacheableMemory, 0xFFC17828)
NSTUB(Close, 0xFFC13348)
NSTUB(CreateTask, 0xFFC0B8C0)
NSTUB(DeleteFile_Fut, 0xFFC12BF4)
NSTUB(EnterToCompensationEVF, 0xFFC15318)  // "ExpComp On"
NSTUB(ExecuteEventProcedure, 0xFFC5B5B8)
NSTUB(ExitFromCompensationEVF, 0xFFC1535C)  // "ExpComp Off"
NSTUB(ExitTask, 0xFFC0BB50)
NSTUB(Fclose_Fut, 0xFFC12D70)
NSTUB(Feof_Fut, 0xFFC12F5C)
NSTUB(Fflush_Fut, 0xFFC12F98)
NSTUB(Fgets_Fut, 0xFFC12EC4)
NSTUB(Fopen_Fut, 0xFFC12D30)
NSTUB(Fread_Fut, 0xFFC12E1C)
NSTUB(FreeMemory, 0xFFE08338)
NSTUB(FreeUncacheableMemory, 0xFFC17868)
NSTUB(Fseek_Fut, 0xFFC12F10)
NSTUB(Fwrite_Fut, 0xFFC12E70)
NSTUB(GetBatteryTemperature, 0xFFC3885C)
NSTUB(GetCCDTemperature, 0xFFC387EC)
NSTUB(GetCurrentAvValue, 0xFFD0F3D4)
NSTUB(GetCurrentTargetDistance, 0xFFD0D8D4)
NSTUB(GetDrive_ClusterSize, 0xFFC44DCC)
NSTUB(GetDrive_FreeClusters, 0xFFC44E34)
NSTUB(GetFocusLensSubjectDistance, 0xFFE047A4)
NSTUB(GetOpticalTemperature, 0xFFC388CC)
NSTUB(GetParameterData, 0xFFD38978)
NSTUB(GetPropertyCase, 0xFFC5F2A0)
NSTUB(GetSystemTime, 0xFFE08398)
NSTUB(GetZoomLensCurrentPoint, 0xFFD12370)
NSTUB(GetZoomLensCurrentPosition, 0xFFE02890)
NSTUB(IsStrobeChargeCompleted, 0xFFC92E08)
NSTUB(LocalTime, 0xFFC595BC)
NSTUB(LockMainPower, 0xFFC63DA0)
NSTUB(Lseek, 0xFFC13488)
NSTUB(MakeDirectory_Fut, 0xFFC12C68)
NSTUB(MoveFocusLensToDistance, 0xFFE5B264)
NSTUB(MoveZoomLensWithPoint, 0xFFE0507C)
NSTUB(NewTaskShell, 0xFFC5ED48)
NSTUB(Open, 0xFFC13320)
NSTUB(Read, 0xFFC0A138)
NSTUB(ReadFastDir, 0xFFDF35B8)
NSTUB(Remove, 0xFFC13390)
NSTUB(RenameFile_Fut, 0xFFC12BA0)
NSTUB(SetAutoShutdownTime, 0xFFC63E14)
NSTUB(SetFileTimeStamp, 0xFFC13624)
NSTUB(SetParameterData, 0xFFD388E8)
NSTUB(SetPropertyCase, 0xFFC5F198)
NSTUB(SleepTask, 0xFFC176AC)
NSTUB(TakeSemaphore, 0xFFC0B74C)
NSTUB(TurnOffBackLight, 0xFFC6F9FC)
NSTUB(TurnOnBackLight, 0xFFC6F9E4)
NSTUB(UIFS_WriteFirmInfoToFile, 0xFFD2D3A0)
NSTUB(UnlockMainPower, 0xFFC63CF4)
NSTUB(UpdateMBROnFlash, 0xFFC44C0C)
NSTUB(VbattGet, 0xFFC10314)
NSTUB(Write, 0xFFC133F4)
NSTUB(_log, 0xFFE90410)
NSTUB(_log10, 0xFFE8F354)
NSTUB(_pow, 0xFFE8F4C4)
NSTUB(_sqrt, 0xFFE91778)
NSTUB(close, 0xFFC09F50)
NSTUB(closedir, 0xFFDF3688)
NSTUB(closefastdir, 0xFFDF3688)
NSTUB(free, 0xFFC03A80)
NSTUB(kbd_p1_f, 0xFFC114F4)
NSTUB(kbd_p1_f_cont, 0xFFC11500)
NSTUB(kbd_p2_f, 0xFFC10D04)
NSTUB(kbd_read_keys, 0xFFC113F0)
NSTUB(kbd_read_keys_r2, 0xFFC35D7C)
NSTUB(lseek, 0xFFC13488)
NSTUB(malloc, 0xFFC039AC)
NSTUB(memcmp, 0xFFC0D8B4)
NSTUB(memcpy, 0xFFC74B70)
NSTUB(memset, 0xFFD8FF54)
NSTUB(mkdir, 0xFFC136EC)
NSTUB(mktime_ext, 0xFFC753DC)
NSTUB(open, 0xFFC09EA0)
NSTUB(opendir, 0xFFDF3524)
NSTUB(openfastdir, 0xFFDF3524)
NSTUB(qsort, 0xFFD9045C)
NSTUB(rand, 0xFFC0D9BC)
NSTUB(read, 0xFFC0A138)
NSTUB(readfastdir, 0xFFDF35B8)
NSTUB(rename, 0xFFC1341C)
NSTUB(srand, 0xFFC0D9B0)
NSTUB(stat, 0xFFC13554)
NSTUB(strcat, 0xFFC74984)
NSTUB(strchr, 0xFFC74A0C)
NSTUB(strcmp, 0xFFC0D84C)
NSTUB(strcpy, 0xFFC0D834)
NSTUB(strftime, 0xFFC74DE4)
NSTUB(strlen, 0xFFC0D890)
NSTUB(strncmp, 0xFFC749C0)
NSTUB(strncpy, 0xFFC1D254)
NSTUB(strrchr, 0xFFD8FF2C)
NSTUB(strtol, 0xFFC1D48C)
NSTUB(time, 0xFFC59470)
NSTUB(vsprintf, 0xFFC0D7F8)
NSTUB(write, 0xFFC0A198)

Re: SX110IS - howto start porting
« Reply #31 on: 27 / February / 2009, 07:08:24 »
A question about the file "stubs_entry_2.S": I collected a list of functions from the platform "SX100IS", but I can't understand wich functions are really used by CHDK, and wich functions instead are there only for other (historical?) reasons. So for now I put the address of a nullsub for every function.
But can someone tell me for wich functions of the following list I must find the true address and wich functions I can delete without any problem?
Thanks very much.

#include "stubs_asm.h"

// Not found, so pointer to nullsub for immediate return
// nullsub_1: 0xFFC00940

NHSTUB(ints_disable, 0xFFC00940)
NHSTUB(ints_enable, 0xFFC00940)
NHSTUB(kbd_pwr_on, 0xFFC00940)
NHSTUB(kbd_pwr_off, 0xFFC00940)
NHSTUB(platformsub_kbd_fetch_data, 0xFFC00940)
NHSTUB(taskcreate_jogDial, 0xFFC00940)
NHSTUB(SetZoomActuatorSpeedPercent, 0xFFC00940)
NHSTUB(strstr, 0xFFC00940)
NHSTUB(UnsetZoomForMovie, 0xFFC00940)
NHSTUB(PostLEDMessage, 0xFFC00940)
NHSTUB(TurnOnMic, 0xFFC00940)
NHSTUB(TurnOffMic, 0xFFC00940)
NHSTUB(ExpCtrlTool_StopContiAE, 0xFFC00940)
NHSTUB(ExpCtrlTool_StartContiAE, 0xFFC00940)
NHSTUB(MakeAFScan, 0xFFC00940)
NHSTUB(GiveSemaphore, 0xFFC00940)
NHSTUB(dumpMemoryToFile, 0xFFC00940)
NHSTUB(RefreshPhysicalScreen, 0xFFC00940)
NHSTUB(utime, 0xFFC00940)
NSTUB(memPartAlloc, 0xFFC00940)
NSTUB(memPartFindMax, 0xFFC00940)
NSTUB(taskCreateHookAdd, 0xFFC00940)
NSTUB(taskDeleteHookAdd, 0xFFC00940)
NSTUB(taskIdListGet, 0xFFC00940)
NSTUB(taskLock, 0xFFC00940)
NSTUB(taskUnlock, 0xFFC00940)
NSTUB(Mount_FileSystem, 0xFFC00940)
NSTUB(Unmount_FileSystem, 0xFFC00940)
NSTUB(rewinddir, 0xFFC00940)
NSTUB(CreatePhysicalVram, 0xFFC00940)
NSTUB(CreateTaskStrict, 0xFFC00940)
NSTUB(DisableDispatch, 0xFFC00940)
NSTUB(DisplayImagePhysicalScreen, 0xFFC00940)
NSTUB(EnableDispatch, 0xFFC00940)
NSTUB(GetFocusLensSubjectDistanceFromLens, 0xFFC00940)
NSTUB(MakeDirectory, 0xFFC00940)
NSTUB(PhySw_testgpio, 0xFFC00940)
NSTUB(ProtectFile, 0xFFC00940)
NSTUB(chdir, 0xFFC00940)
NSTUB(ioctl, 0xFFC00940)
NSTUB(iosDevAdd, 0xFFC00940)
NSTUB(iosDrvInstall, 0xFFC00940)
NSTUB(isalpha, 0xFFC00940)
NSTUB(isdigit, 0xFFC00940)
NSTUB(islower, 0xFFC00940)
NSTUB(isspace, 0xFFC00940)
NSTUB(isupper, 0xFFC00940)
NSTUB(localtime, 0xFFC00940)
NSTUB(readdir, 0xFFC00940)
NSTUB(strpbrk, 0xFFC00940)
NSTUB(taskCreateHookAdd, 0xFFC00940)
NSTUB(taskDeleteHookAdd, 0xFFC00940)
NSTUB(taskIdListGet, 0xFFC00940)
NSTUB(taskName, 0xFFC00940)
NSTUB(taskResume, 0xFFC00940)
NSTUB(taskSuspend, 0xFFC00940)
NHSTUB(PT_PlaySound, 0xFFC00940)
NHSTUB(DoAFLock, 0xFFC00940)
NHSTUB(UnlockAF, 0xFFC00940)
NHSTUB(WriteSDCard, 0xFFC00940)


Offline reyalp

  • ******
  • 10016
Re: SX110IS - howto start porting
« Reply #32 on: 27 / February / 2009, 15:03:41 »
You need:
1) every entry point which is not found correctly in stubs_entry.S (either not found at all, or found, but matching the wrong function)
2) A handful of functions that are not automatically found.
3) A few functions that must be defined in order to link, even though they don't actually exist (or have never been found) in dryos.

The exact set of functions you need depends on which features you enable in camera.h

For 2) and 3), I would just compile and add until it works. Doing that on the SD990, I ended up with
Code: [Select]
// not in sig_ref
NHSTUB(UnsetZoomForMovie, 0xFF9689EC) // string "ZoomCon_UnsetZoomForMovie"
NHSTUB(PT_PlaySound,0xFF863970) // search on PT_PlaySound
NHSTUB(PutInNdFilter,0xFFA46ED0) // string TurnOnNdFilter ? TODO!
NHSTUB(PutOutNdFilter,0xFFA46EF4) // string TurnOffNdFilter ? TODO!
NHSTUB(DoAFLock,0xFF863A80) // PT_DoAFLock
NHSTUB(UnlockAF,0xFF863A90) // PT_UnlockAF

// These don't exist/aren't found in dryos
NHSTUB(Mount_FileSystem,0xFF81093C) // NULLSUB
NHSTUB(Unmount_FileSystem,0xFF81093C) // NULLSUB
NHSTUB(rewinddir,0xFF81093C) // NULLSUB
NHSTUB(SetZoomActuatorSpeedPercent,0xFF81093C) // NULLSUB
As noted above, your mileage may vary depending on what features you have enabled.

Note that stubs_entry_2.s should contain NHSTUB not NSTUB.

It's a good idea to look at a few different cameras when you are trying to figure out what to do. Different people with varying levels of understanding have done different ports. You might want to refer to sd1100 100c for this one. Also beware that while many are commented like I have above, entry points have been added at the end of most of the stubs_entry_2.S files without regard to the comments ;)
Don't forget what the H stands for.

Re: SX110IS - howto start porting
« Reply #33 on: 15 / March / 2009, 15:20:06 »
Hey Nomi ... just so you know, some of us here are lurking, and rooting for you!

I have an SX110 and periodically check here on progress.  I would LOVE to see you succeed with a port, it would make this camera sooo much better! 

I appreciate your effort!  Keep at it!   


Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #34 on: 16 / March / 2009, 16:06:38 »
Hi Nomi,

I'm working on a port for the sx110 (1.00b) for a few weeks now - more or less. Anyway.. hope we will get it as soon as possible. I didn't spend all of my time for having fun with camera ports ;-)

I can confirm all of the entry points for the functions mentioned in stubs_entry.S above.

It seems to me that RefreshPhysicalScreen is located at 0xFFD8FC00 (not 100% safe)--> NHSTUB(RefreshPhysicalScreen, 0xFFD8FC00). I had analyzed functions at superior levels and followed the function calls and ended up with 0xFFD8FC00.

Couldn't find code for kbd_power_off an kbd_power_on so far and I think these functions are not implemented and should be pointed to nullsubs:
NHSTUB(kbd_pwr_off, 0xFFC00940)
NHSTUB(kbd_pwr_on, 0xFFC00940)

I didn't make any changes to stubs_entry.S and put all into stubs_entry_2.S

Kind regards.


Offline reyalp

  • ******
  • 10016
Re: SX110IS - howto start porting
« Reply #35 on: 16 / March / 2009, 22:51:37 »
kbd_pwr_* are missing from some other cams, so this is probably OK.
Don't forget what the H stands for.


Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #36 on: 18 / March / 2009, 15:48:54 »
..or even not ;-)
As far as I can see kbd_pwr_* is called by kbd_read_keys only (compared to a720 as an example). In sx110 kbd_read_keys executes two functions (and more) and each calls another function. And those other functions looking alike kbd_pwr_* in a720.
Frankly, it's the same as looking into a crystal ball...

NHSTUB(kbd_pwr_on, 0xFFC3642C)
NHSTUB(kbd_pwr_off, 0xFFC36444)
« Last Edit: 18 / March / 2009, 15:51:26 by chdkj »


Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #37 on: 19 / March / 2009, 16:38:24 »
found some other functions needed by chdk compile process, partly questionable:
NHSTUB(DoAFLock, 0xFFC15048)
NHSTUB(ExpCtrlTool_StartContiAE, 0xFFC20894)
NHSTUB(ExpCtrlTool_StopContiAE, 0xFFC209D8)
NHSTUB(GiveSemaphore, 0xFFC0B81C)
NHSTUB(MakeAFScan, 0xFFD19824)   //differ from other cams
NHSTUB(PostLEDMessage, 0xFFC357C8 ) //questionable, might be wrong...
NHSTUB(PT_PlaySound, 0xffc4dcf0) //questionable, might be wrong...
NHSTUB(SetZoomActuatorSpeedPercent, 0xFFC00940) //nullsub, there are things like SetZoomActuatorSpeedPPS in fw
NHSTUB(TurnOffMic, 0xFFC36DD8)
NHSTUB(UnlockAF, 0xFFC1509C)
NHSTUB(UnsetZoomForMovie, 0xFFD3E944)
NHSTUB(WriteSDCard, 0xFFD02B30)



Offline chdkj

  • ***
  • 140
Re: SX110IS - howto start porting
« Reply #38 on: 19 / March / 2009, 16:50:58 »
... compile is running straight through but the cam don't like DISKBOOT.BIN. Cam feigns death. The SD card is write protected. A few changes to DISKBOOT.BIN by a simple editor lead to a "card is write protected" message. Seems that code from DISKBOOT.BIN is terribly wrong. Checked boot.c, lib.c, main.c and others and I will do this again.

Re: SX110IS - howto start porting
« Reply #39 on: 20 / March / 2009, 02:15:39 »
chdkj do you have akready spoken with nomi_68k ? Maybe he can give you the code and you can finish the work.

For all developers please keep this: actual.
« Last Edit: 20 / March / 2009, 02:25:02 by Obihoernchen »
Canon PowerShot SX110 IS
CHDK: at Autobuild now
Wiki: SX110IS


Related Topics