G11 porting - page 14 - DryOS Development - CHDK Forum

G11 porting

  • 530 Replies
  • 249764 Views
*

Offline reyalp

  • ******
  • 14126
Re: G11 porting
« Reply #130 on: 31 / December / 2009, 15:43:02 »
Advertisements
Many of these are not needed right away (for example apex2us is only needed when you implement extra long exposure support, and the address will be found as part of this process). However, I suggest using an address that points to a BX LR rather than 0x123...

You also need to verify functions that are found, but without a 100% match (or with a 100% match but multiple alternatives).

Great work so far :)
Don't forget what the H stands for.

Re: G11 porting
« Reply #131 on: 31 / December / 2009, 16:42:58 »
for example apex2us is only needed when you implement extra long exposure support,


Why is the branch to an address in the Canon code replaced by the same address as the value of apex2us  ?

For some reason, with my various builds the compiler always complains it cannot find apex2us so I just leave the original branch to an address.

@ERR99
The compiler will only complain if certain stub values are missing.

If you provide a list (or a number of lists) of what addresses you want to find I will certainly try by comparing with the G11.
I may need guidance on how to find certain values.

If you have a number of lists maybe people can volunteer to work on each one.

It is very useful that you describe your progress step-by-step, it will help other porters in the future.


*

Offline reyalp

  • ******
  • 14126
Re: G11 porting
« Reply #132 on: 31 / December / 2009, 17:22:21 »
Why is the branch to an address in the Canon code replaced by the same address as the value of apex2us  ?
In CHDK, the call in expdrvtask goes to the CHDK version (apex2us in wrappers.c, no _), which in turn either sets the override value, or simply calls on to the original canon _apex2us that was found in the original expdrvtask.
Don't forget what the H stands for.

Re: G11 porting
« Reply #133 on: 01 / January / 2010, 10:18:44 »
(accessing the forum is becoming a bit of a pain, it is unavailable for long periods).

@ERR99

Here are some stubs for you :-

Code: [Select]
NHSTUB(rewinddir, 0xFF849478)                                 // null_sub, not needed
NHSTUB(Unmount_FileSystem,0xFF849478)                 // null_sub, not needed
NHSTUB(WriteSDCard, 0xFF94B750)                           // below "SdDrv.c"
NHSTUB(UnlockAF, 0xFF837190)                                 // 'AFUL'
NHSTUB(DoAFLock, 0xFF837158)                                // 'AFL'
NHSTUB(SetZoomActuatorSpeedPercent, 0xFF849478)  // nullsub
NHSTUB(GetKbdState, 0xFF860430)
NHSTUB(UnsetZoomForMovie,0xFF99CE28)
NHSTUB(PutInNdFilter, 0xFFB00F1C)
NHSTUB(PutOutNdFilter, 0xFFB00F54)
NHSTUB(GiveSemaphore, 0xFF838E38)

Can I suggest that you post packages (A,B, C etc) each containing four of five stubs that you would like found.

Volunteers can then confirm they will work with a particular package.

This will save duplication of effort.

If any stub cannot be found in a reasonable amount of time, it can be transferred to a special package that people will know requires a bit more effort.

So, name your next packages !
« Last Edit: 01 / January / 2010, 17:25:45 by Microfunguy »

*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #134 on: 01 / January / 2010, 18:40:29 »
Hello,

thanks for the stubs, i added them to my g11 implementation.

So, status is: I followed the steps in "Implementing the CHDK boot process" wiki and reimplement the first couple of functions for the G11 boot loader (boot.c and resetcode/main.c) and i think it was sucessfull. With CHDK spy task disabled, the camera reacts now as in the wiki decribed: " Once you have got the boot code ready, the camera should boot normally again. (Only difference is probably that a short press on the power-button gives you the review mode now. )  ".

Then i added the spytask hooks in boot.c (CreateTask_spytask();). But then i got trouble, the core_spytask() function
seems to crash and the camera switches off automaticaly. If i make end endless loop with a little led blinker code in this function before the call of conf_restore(); the camera stays on an blinks. But at execution of conf_restore() the system chrashes. If find out that if have something to do with conf_info.func() in conf.c. Some one of this callbacks must lead to a exception, because when i comment the function call out, conf_restore() does not crash. But even then the core_spytask() crashes in one of the next function calls behind of conf_restore().

So the good think is, the CHDK Task starts to run on the G11 (at least a little bit ;) ), but there must be a error in the configuration or somethin like that.
Something seems to be wrong, but currently i have no clue what it is. Maybe a wrong function signature?
reyalp said: "You also need to verify functions that are found, but without a 100% match (or with a 100% match but multiple alternatives)."
So task A could be to check the stubs_entry.S functions which does not have a 100% match:

Code: [Select]
// !!! THIS FILE IS GENERATED. DO NOT EDIT. !!!
#include "stubs_asm.h"

NSTUB(AllocateMemory, 0xffaa353c)
NSTUB(AllocateUncacheableMemory, 0xff83941c)
NSTUB(Close, 0xff8359b0)
NSTUB(CreateTask, 0xff81e5b4)
NSTUB(DeleteFile_Fut, 0xff83533c)
// ERROR: EnterToCompensationEVF is not found!
NSTUB(ExecuteEventProcedure, 0xff88997c)
// ERROR: ExitFromCompensationEVF is not found!
// Best match: 57%
NSTUB(ExitTask, 0xff81e844)
NSTUB(Fclose_Fut, 0xff8354b8)
NSTUB(Feof_Fut, 0xff8356a4)
NSTUB(Fflush_Fut, 0xff8356e0)
NSTUB(Fgets_Fut, 0xff83560c)
NSTUB(Fopen_Fut, 0xff835478)
NSTUB(Fread_Fut, 0xff835564)
NSTUB(FreeMemory, 0xffaa3534)
// Best match: 91%
NSTUB(FreeUncacheableMemory, 0xff83945c)
NSTUB(Fseek_Fut, 0xff835658)
NSTUB(Fwrite_Fut, 0xff8355b8)
// Best match: 52%
NSTUB(GetBatteryTemperature, 0xff8635d8)
// Best match: 52%
NSTUB(GetCCDTemperature, 0xff863564)
// Best match: 85%
NSTUB(GetCurrentAvValue, 0xff95c230)
NSTUB(GetDrive_ClusterSize, 0xff86fc80)
NSTUB(GetDrive_FreeClusters, 0xff86fce0)
NSTUB(GetDrive_TotalClusters, 0xff86fcb4)
// Best match: 64%
NSTUB(GetFocusLensSubjectDistance, 0xff95a804)
NSTUB(GetFocusLensSubjectDistanceFromLens, 0xff95ac4c)
// Best match: 96%
NSTUB(GetOpticalTemperature, 0xff86364c)
// Best match: 66%
NSTUB(GetParameterData, 0xff99687c)
// Best match: 72%
NSTUB(GetPropertyCase, 0xff88d6b0)
// Best match: 96%
NSTUB(GetSystemTime, 0xffaa3594)
// Best match: 74%
NSTUB(GetZoomLensCurrentPoint, 0xff95ee0c)
NSTUB(GetZoomLensCurrentPosition, 0xffa967a0)
// Best match: 64%
NSTUB(IsStrobeChargeCompleted, 0xff8db3f0)
NSTUB(LocalTime, 0xff887278)
// Best match: 93%
NSTUB(LockMainPower, 0xff895344)
// ERROR: Lseek is not found!
// Best match: 92%
NSTUB(MakeDirectory_Fut, 0xff8353b0)
// Best match: 57%
NSTUB(MoveFocusLensToDistance, 0xffb031cc)
// Best match: 58%
NSTUB(MoveZoomLensWithPoint, 0xffaa0b60)
// Best match: 62%
NSTUB(NewTaskShell, 0xff88d15c)
NSTUB(Open, 0xff835958)
// ERROR: PT_PlaySound is not found!
// Best match: 86%
NSTUB(PostLogicalEventForNotPowerType, 0xff893170)
// Best match: 92%
NSTUB(PostLogicalEventToUI, 0xff8931bc)
NSTUB(Read, 0xff81ab78)
NSTUB(ReadFastDir, 0xffa84270)
// ERROR: RefreshPhysicalScreen is not found!
// ERROR: Remove is not found!
// Best match: 53%
NSTUB(RenameFile_Fut, 0xff835474)
// ALT: NSTUB(RenameFile_Fut, 0xffa7057c) // 8/7
// ALT: NSTUB(RenameFile_Fut, 0xffa705cc) // 8/7
// Best match: 93%
NSTUB(SetAutoShutdownTime, 0xff8953b8)
// Best match: 81%
NSTUB(SetCurrentCaptureModeType, 0xff89cb1c)
// Best match: 55%
NSTUB(SetFileTimeStamp, 0xff94a8dc)
// Best match: 64%
NSTUB(SetLogicalEventActive, 0xff895094)
// Best match: 68%
NSTUB(SetParameterData, 0xff996758)
// Best match: 89%
NSTUB(SetPropertyCase, 0xff88d5ac)
// Best match: 92%
NSTUB(SleepTask, 0xff8390a0)
// Best match: 60%
NSTUB(TakeSemaphore, 0xff838d68)
// ERROR: TurnOffBackLight is not found!
// ERROR: TurnOnBackLight is not found!
// ERROR: UIFS_WriteFirmInfoToFile is not found!
// Best match: 93%
NSTUB(UnlockMainPower, 0xff895298)
NSTUB(UpdateMBROnFlash, 0xff813f74)
NSTUB(VbattGet, 0xff831e08)
NSTUB(Write, 0xff835a40)
NSTUB(_log, 0xffb3de8c)
NSTUB(_log10, 0xffb3cdd0)
NSTUB(_pow, 0xffb3cf40)
NSTUB(_sqrt, 0xffb3f1f4)
NSTUB(close, 0xff81a990)
NSTUB(closedir, 0xffa840f8)
// Best match: 71%
NSTUB(closefastdir, 0xffa8440c)
// Best match: 95%
NSTUB(free, 0xff814138)
// Best match: 86%
NSTUB(kbd_p1_f, 0xff833600)
// Best match: 86%
NSTUB(kbd_p1_f_cont, 0xff83360c)
// Best match: 86%
NSTUB(kbd_p2_f, 0xff832ec0)
// Best match: 51%
NSTUB(kbd_pwr_off, 0xff86043c)
// ERROR: kbd_pwr_on is not found!
// Best match: 84%
NSTUB(kbd_read_keys, 0xff833584)
// Best match: 78%
NSTUB(kbd_read_keys_r2, 0xff85fbb8)
// ALT: NSTUB(kbd_read_keys_r2, 0xff85fb9c) // 17/5
NSTUB(lseek, 0xff835acc)
NSTUB(malloc, 0xff8140dc)
NSTUB(memcmp, 0xff8203ec)
NSTUB(memcpy, 0xff83ea1c)
NSTUB(memset, 0xffa13910)
NSTUB(mkdir, 0xff835e24)
NSTUB(mktime_ext, 0xff8ab050)
NSTUB(open, 0xff81a8e0)
NSTUB(opendir, 0xffa8413c)
// ERROR: openfastdir is not found!
NSTUB(qsort, 0xffaf38dc)
// 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, 0xff835b08)
// ALT: NSTUB(stat, 0xff86d0c4) // 30/0
// Best match: 61%
NSTUB(strcat, 0xff813f38)
// Best match: 56%
NSTUB(strchr, 0xff813fc0)
NSTUB(strcmp, 0xff8203a8)
NSTUB(strcpy, 0xff820390)
NSTUB(strftime, 0xff8aaa58)
NSTUB(strlen, 0xff81400c)
NSTUB(strncmp, 0xff813f74)
// Best match: 73%
NSTUB(strncpy, 0xff813f38)
// Best match: 71%
NSTUB(strrchr, 0xff83e9f4)
// ALT: NSTUB(strrchr, 0xff8aa820) // 18/8
// Best match: 96%
NSTUB(strtol, 0xff83ecfc)
NSTUB(strtolx, 0xff83eb00)
// Best match: 86%
NSTUB(time, 0xff8877f0)
NSTUB(vsprintf, 0xff820354)
NSTUB(write, 0xff81abd8)

Re: G11 porting
« Reply #135 on: 01 / January / 2010, 18:56:14 »
Can you comment-out nearly all of the body of spytask ?
I vaguely remember doing this recently when I had problems with a camera that crashed on startup.

In fact, in a call to some gui refresh code the address of a single firmware function was incorrect in the CHDK build but not used by it.

SDM did use that function.


*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #136 on: 02 / January / 2010, 06:51:47 »
I tracked down the crash to this position:
Code: [Select]
static void gui_handle_splash(void) {
static char *logo = NULL;
    static int logo_size;
    if (gui_splash) {
static int need_logo=1; // don't use logo ptr, since we don't want to keep re-trying
if(need_logo) {
     const char *logo_name="A/CHDK/DATA/logo.dat";
            FILE *fd;
            struct stat st;
need_logo=0;

            if (stat(logo_name,&st) == 0) {
logo_size=st.st_size;
logo=malloc(logo_size);
if(logo) {
fd = fopen(logo_name, "rb");

It looks like that the first file access try: fopen(logo_name, "rb") crashes this funktion.

One question: Is it important for the CHDK boot on a 2GB FAT card that a comleted modified "init_file_modules_task".
is hooked in taskCreateHook()? I am currently dissambled this function only to the point where ""BL      core_spytask_can_start\n" has to be added. But i leaved out DataGhost's FAT32 autodection code, because i think it is not necessary now.

But obviously, the filesystem access is not working properly.
« Last Edit: 02 / January / 2010, 07:03:57 by ERR99 »

Re: G11 porting
« Reply #137 on: 02 / January / 2010, 07:59:28 »
Is it important for the CHDK boot on a 2GB FAT card that a comleted modified "init_file_modules_task".
is hooked in taskCreateHook()?

Don't know.
Others will know.


Quote
filesystem access is not working properly.

I would comment-out the splashscreen and load configs for now.

Are any folders created on startup (assuming you start with no folders on the card) ?

*

Offline ERR99

  • ****
  • 339
Re: G11 porting
« Reply #138 on: 02 / January / 2010, 08:35:32 »
Good hint.
I commented out the splash_screen and config loading stuff and the G11 stays now ON and does not crash.
The G11 behaves now so after press of the ON/OFF button:
- Boot takes a little more time as started without CHDK and some LEDs are blinking during boot. :)
- Camera starts in Play/Review mode (shows "No Image" screen) and shows for a few seconds "card locked" message.
- I cant take any pictures, because card is locked in record mode.
Do you know in which part of the CHDK is the write to SD card re-enabled, so i can get rif of the "card lock" message?
Also, no other sign of a running CHDK is visible on the display, camera display shows only the "srtandard" controls.

I also started my build without a CHDK folder and after startup, there a no folders created. So the mkdir("A/CHDK");
calls in main.c are not working now. But at least, they doesnt crash.  ;)
(I think this is caused by the "locked" read-only state of the sd-card and so write access for mkdir is disabled)
« Last Edit: 02 / January / 2010, 08:39:12 by ERR99 »

Re: G11 porting
« Reply #139 on: 02 / January / 2010, 08:46:16 »

Do you know in which part of the CHDK is the write to SD card re-enabled

It is in platform\g11\kbd.c.

For the G9 :-

#define SD_READONLY_FLAG (0x20000)


    if (conf.remote_enable) {
       physw_status[2] = physw_status[2] & ~(SD_READONLY_FLAG | USB_MASK);
    }
    else
       physw_status[2] = physw_status[2] & ~SD_READONLY_FLAG;



You need to know the physw_status bit position for the SD card, or just guess.
I am not familiar with CHDK (as opposed to SDM) but somewhere you can uncomment some code to display the Misc values.

These show physw_status[0], physw_status[1] and  physw_status[2].
You will need to display it anyway to map the keys.

Quote
the mkdir("A/CHDK");
calls in main.c are not working now. But at least, they doesnt crash.
(I think this is caused by the "locked" read-only state of the sd-card and so write access for mkdir is disabled)

Yes, that is likely.

If the keyboard task is not hooked you cannot enter the menus  .....
Hmm , you cannot anyway because the keys are not mapped yet.
« Last Edit: 02 / January / 2010, 08:49:30 by Microfunguy »

 

Related Topics


SimplePortal © 2008-2014, SimplePortal