SX20 102b porting (help requested) - DryOS Development - CHDK Forum

SX20 102b porting (help requested)

  • 8 Replies
  • 8678 Views
SX20 102b porting (help requested)
« on: 03 / April / 2010, 21:27:14 »
Advertisements
I've just started work on attempting to port CHDK to the 102b firmware based on neszt's beta builds.

My current progress is as follows:
* Decompiled firmware with IDA following the wiki
* Updated makefile.inc defines
* Found a few of the many symbols required (not all yet)
* Compiled sample code
* Booted camera with new firmware
* Camera rebooted and running code in boot(), checked with LED blinking
* Camera finally boots and runs with CHDK loading code commented out
* CHDK GUI loads, keyboard code seems to work.

Status: Trying to figure out why the CHDK menu doesn't refresh properly.
« Last Edit: 05 / April / 2010, 15:14:07 by acid2000 »

Re: SX20 102b porting (help requested)
« Reply #1 on: 03 / April / 2010, 21:32:32 »
Still stuck but a little further forward now. Looks like some discrepancies between IDA and the 100f port.

sub_FF815E34_my is called and the camera boots for a second. I'll continue checking every line against IDA and see what else has changed. I suspect that one of the function calls I looked up is wrong.

*

Offline reyalp

  • ******
  • 14080
Re: SX20 102b porting (help requested)
« Reply #2 on: 03 / April / 2010, 21:49:06 »
* If I put "B 0xFF81000C" as the first line in boot() I would expect the camera to start normally but it doesn't
That is not the correct way to jump to an arbitrary address. B (and BL) take a signed, 24 bit PC relative offset. The GNU toolchain interprets what you have done above as specifying this offset directly. If this value overflows (as in your example), it simply accepts it and silently makes the value fit. You might think this would be a warning, but it's not.

If you use "B sub_FF81000C" and the CHDK build process will generate the appropriate veneer for you, or you can use
LDR PC,=0xFF81000C

If you haven't already, you may want to look at http://chdk.wikia.com/wiki/Adding_support_of_a_new_firmware_version
Don't forget what the H stands for.

Re: SX20 102b porting (help requested)
« Reply #3 on: 04 / April / 2010, 17:07:54 »
Thanks I think I understand what is up now. After sleeping a going through the subs again with IDA i've found a few errors which when fixed caused the camera to boot correctly.


Re: SX20 102b porting (help requested)
« Reply #4 on: 10 / April / 2010, 20:52:01 »
Now i'm trying to get capt_seq_task() to work. To debug I'm just setting the first instruction to be:

"BL sub_FF87CD40\n"

My boot.c contains  if (p[0]==0xFF87CD40)  p[0]=(int)capt_seq_task;

When my camera boots with the if statement commented out it runs fine. When commented in it crashes after a second or so.
Why is this occurring. Surely I'm just jumping straight to the real code! capt_seq_task() is a naked function.

Can anyone help?

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: SX20 102b porting (help requested)
« Reply #5 on: 10 / April / 2010, 23:43:25 »
"BL sub_FF87CD40\n"
"B sub_FF87CD40\n" ?

Quote
if (p[0]==0xFF87CD40)  p[0]=(int)capt_seq_task;

IMO,
Code: (c) [Select]
if(!_strcmp(tcb->name, "CaptSeqTask"))     tcb->entry = (void*)capt_seq_task; is more readable.

Re: SX20 102b porting (help requested)
« Reply #6 on: 11 / April / 2010, 06:04:00 »
That does look better, do you have a reference port which uses this style?

Re: SX20 102b porting (help requested)
« Reply #7 on: 11 / April / 2010, 06:38:40 »
This issue turned out to be the CHDK config files, removing them and the camera doesn't crash. Still investigating why.


*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: SX20 102b porting (help requested)
« Reply #8 on: 11 / April / 2010, 06:54:37 »
That does look better, do you have a reference port which uses this style?

A480.

 

Related Topics