Powershot SX150 IS Porting Thread - General Discussion and Assistance - CHDK Forum supplierdeeply

Powershot SX150 IS Porting Thread

  • 279 Replies
  • 114326 Views
Powershot SX150 IS Porting Thread
« on: 18 / October / 2011, 11:13:33 »
Advertisements
Newbie here kicking off the SX150 IS porting process.  I'll take all the help I can get.

For firmware 1.00A, I found the d4b key is located at 0x7E3514 and the d4b IV at 0x457C14.

Got the firmware loaded in IDA with all DryOs extensions / CHDK.idc scripts.

Will tackle the LED addresses next, followed by generating the stubs_entry_2.S file.  Any suggestions/help is appreciated.


sgtrum

Re: Powershot SX150 IS Porting Thread
« Reply #1 on: 18 / October / 2011, 19:13:43 »
Will tackle the LED addresses next, followed by generating the stubs_entry_2.S file.  Any suggestions/help is appreciated.
Generation of entries for stubs_entry_2.S is pretty much automatic now with the new signature finder introduced several months ago.  Although technically,  it puts the stubs into stubs_entry.S now.  It gets most of them 100% corrrect on the  first try so your work will be much easier than what earlier ports needed.  Typically there will only be a couple that you need to find and put into stub_entry_2.S.     The "how to" documentation is a bit out of date on that I'm afraid.

The generated stub_entry.S also contains a bunch of other useful information for lib.c, stubs_min.S, kbd.c and others.

The SX150 is pretty new so I'm not sure there are any cameras released at the same time that have been ported to CHDK.  This can make things a little harder.  However,  you can probably copy the boot loader code from the SX130is as a starting point.

Your next big task will be generating the CHDK task in boot.c, capt_seq.c and movie_rec.c   You might want to look at CHDK-PT and the instructions for using it    I would again suggest using the SX130is as your reference port when using that tool.

If you get stuck, posting here is good.  The IRC channel can work as well - especially after 9 PM in the USA. Sometimes there are people there to help - sometimes its all zombies.  Look for reyalp,  philmoz or me - although there are often others who can help.

Have fun !



Ported :   A1200    SD940   G10    Powershot N    G16

Re: Powershot SX150 IS Porting Thread
« Reply #2 on: 24 / October / 2011, 14:22:20 »
Here is what I have done so far.

The following was done using trunk rev 1385 which includes changes by philmoz to support DryOS R49:

1. Copied loader/sx130is directory to loader/sx150is and platform/sx130is to platform/sx150is
2. Deleted platform/sx150is/sub/101c and platform/sx150is/sub/101d directories
3. Renamed platform/sx150is/sub/101f directory to 100a and copied PRIMARY.BIN firmware dump
4. Modified /platform/sx150is/sub/100a/makefile.inc PLATFORMID to 12852
5. Added sx150is ALPHA 100a entry to camera_list.csv
6. Added "defined(CAMERA_sx150is)" to core/kbd.c Line 105 to add ZSTEP_TABLE_SIZE 7 define (required to compile)
7. Emptied stubs_entry_2.S file
8. Compiled to generate stubs_entry.S file (see attachment)
9. Modified platform_camera.h, kbd.c, stubs_min.S and lib.c based on stubs_entry.S generated output
10. Added 6 missing STUB entries pointing to a Null pointer in stubs_entry_2.S for the following functions:
kbd_pwr_on, FreeUncacheableMemory, SetZoomActuatorSpeedPercent, UnlockAndRefresh, LockAndRefresh, UpdateMBROnFlash
11. Re-compiled, copied code to SD card.  Camera does not appear to turn on when attempting to boot CHDK.
11) Ran a CBASIC script to identify LED addresses (http://chdk.setepontos.com/index.php?topic=5691.msg57636#msg57636).  I was able to confirm that both 0xC0220010 and 0xC0220014 turn on the back Green LED but could not find the address for the front Orange LED.

I have attached the generated stubs_entry.S file.

What should be done next?  Does the boot.c file need to be modified to specifically support the SX150?  Where should I put in LED blinking code during the boot process to monitor where the camera is crashing?

Also, does anyone know if 6 functions that were not found are actually needed?  I have loaded the firmware dump in IDA using the CHDK.idc script files but didn't get anywhere attempting to find them.

sgtrum

Re: Powershot SX150 IS Porting Thread
« Reply #3 on: 24 / October / 2011, 14:36:14 »
What should be done next?  Does the boot.c file need to be modified to specifically support the SX150?  Where should I put in LED blinking code during the boot process to monitor where the camera is crashing?
Sounds like you are off to a great start !    You need to create boot.c,  capt_seq.c and movie_rec.c specifically for the sx150 before this is going to work for you.  If you use the sx130 as a reference, you can use CHDK-PT to help make those files.  Instructions are at : CHDK-PT

Quote
Also, does anyone know if 6 functions that were not found are actually needed?  I have loaded the firmware dump in IDA using the CHDK.idc script files but didn't get anywhere attempting to find them.
You probably need to find everything but kbd_pwr_on().

Ported :   A1200    SD940   G10    Powershot N    G16


Re: Powershot SX150 IS Porting Thread
« Reply #4 on: 24 / October / 2011, 15:54:55 »
Thanks for the tips waterwingz.

I attempted to follow the CHDK-PT steps and am stuck at "Converting the C language CHDK task files".

The CHDK-PT tool was able to find FreeUncacheableMemory, LockAndRefresh and UnlockAndRefresh using SX130 1.01f as a reference ROM.  I have attached the generated files.

CHDK-PT generated the stubs_entry C file for both the SX130 1.01f reference ROM and the SX150is 1.00a one.  I compared both files and there was quite a bit of overlap.

Not sure how to proceed to generate the required addresses.txt file to generate the boot.c, movie_rec.c and capt_set.c files.  Will try to seek help on IRC.

BTW, I recompiled CHDK with the modified stubs_entry_2.S addresses and the camera still won't boot (probably to be expected).  However, UpdateMBROnFlash and SetZoomActuatorSpeedPercent still point to a Null stub.


sgtrum

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Powershot SX150 IS Porting Thread
« Reply #5 on: 24 / October / 2011, 16:13:56 »
According to ERR9 the SX40HS has a new 'dancingbits' value, the SX150 may be the same.

This value is used to encode the diskboot.bin file, if it is wrong the camera will lock up when you try to boot.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Powershot SX150 IS Porting Thread
« Reply #6 on: 24 / October / 2011, 18:07:37 »
I attempted to follow the CHDK-PT steps and am stuck at "Converting the C language CHDK task files".
These posts might help (and save me typing them all over again :) )

http://chdk.setepontos.com/index.php?topic=6367.msg72436#msg72436
http://chdk.setepontos.com/index.php?topic=5051.msg73571#msg73571

Quote
BTW, I recompiled CHDK with the modified stubs_entry_2.S addresses and the camera still won't boot (probably to be expected).  However, UpdateMBROnFlash and SetZoomActuatorSpeedPercent still point to a Null stub.
There are usually one or two addresses early in the boot.c code that are specific to a particular firmware and camera version.  If those are wrong,  the camera will never seems to boot.  The UpdateMBROnFlash and SetZoomActuatorSpeedPercent functions won't affect anything until you start playing with the zoom in a script or try formatting an SD card from CHDK.  And they probably won't cause a crash - the just won't work.


Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Powershot SX150 IS Porting Thread
« Reply #7 on: 25 / October / 2011, 05:42:20 »
I've updated dancingbits.c in SVN with the new 'dancing bits' values - use NEED_ENCODED_DISKBOOT=7 in the makefile.inc file.

You will need to make some other changes in makefile.inc from the SX130 version initially.
- remove the overrides for OPT_EXMEM_MALLOC and OPT_CHDK_IN_EXMEM. you can add these back later once you work out the EXMEM memory addresses.
- set MEMISOSTART=0x175CE0 (in the else section)

The first thing to get working is to put code to blink an LED into the loader/main.c my_restart function - put it in an infinite loop so you can see it working. Until you can get the diskboot.bin to load and this code to blink an LED you won't be able to get much further.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


Re: Powershot SX150 IS Porting Thread
« Reply #8 on: 25 / October / 2011, 16:26:04 »
Phil, I can confirm that your dancingbits mod worked on my sx150.  I did have to change the VITALY constant to 7 on line 15 of dancingbits.c file to get it to compile.  I assume you overlooked this in your trunk commit.

I flashed the green LED in an infinite loop in loader/main.c as you suggested and this indeed worked.  I also confirmed the d4b offsets I have found by booting via the firmware upgrade method.

I'll now build the addresses.txt file so that CHDK-PT generates the 3 C files for me and will proceed to move the LED blinking code further down the boot process to see how far I can get. 


sgtrum

Re: Powershot SX150 IS Porting Thread
« Reply #9 on: 25 / October / 2011, 17:59:09 »
I'll now build the addresses.txt file so that CHDK-PT generates the 3 C files for me and will proceed to move the LED blinking code further down the boot process to see how far I can get. 
Using the address.txt file, CHDK-PT will find the task code you need from your firmware dump.  You need to fold in the CHDK mods - a good file diff editor like Notepad++ is priceless at this point.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics