Windows GUI for CHDK porting - General Discussion and Assistance - CHDK Forum

Windows GUI for CHDK porting

  • 98 Replies
  • 143817 Views
Windows GUI for CHDK porting
« on: 07 / May / 2011, 15:46:30 »
Advertisements
CHDK-PT                      updated 2013-02-07
This thread supports CHDK-PT, a Windows GUI tool for porting CHDK between firmware versions on the same camera.



    Link to CHDK-PT Wiki Page :  CHDK-PT Wiki Page

    Link to CHDK-PT Executable :  CHDK-PT download

    Link to  CHDK-PT SVN site :   CHDK-PT assembla SVN Site

Cameras Originally Ported :
  G10  1.02A, 1.03B, 1.04A
  IXUS120-SD940  1.03c to 1.00e & 1.01a
  IXUS105-SD1300 1.00d to  1.00c  (with microfunguy)
  S95 fw 1.00h to 1.00i  & 1.00k
  A490
  A495 fw 1.00f to 1.00d & 1.00e (with philmoz)
  IXUS200-SD980 1.00c to 1.01c (with philmoz)  1.01c to 1.01d (by gbit)
  IXUS100-SD780 1.00c to 1.00b

 .. and since then many more ..

Background
The CHDK-PT program was created to simplify porting CHDK between different firmware versions on a supported Canon camera. Porting to a new camera is hard - really hard. And porting between firmware versions is not trivial either.  But it is somewhat easier.  Hardware addresses, dancing bits, memory maps, and the CHDK loader have all been resolved.  Not to mention that there is proof that a port is possible at all.  While CHDK-PT will not port automatically for you,  it should simplify the process once you understand the basics of CHDK programming.

CHDK-PT supports the following functions :
1) Generic ARM dissassembler.  Point it at a camera dump primary.bin file, pick the address you want to dissassemble from, the number of words to dissassemble and click on the Load button. It will produce gcc compatabile "C" code suitable for use in CHDK builds.

2) Generic ARM dissassembler for CHDK stubs_entry.S or stubs_entry_2.S files. Point it at a camera dump primary.bin file, select a related stub_entry.S or stubs_entry_2.S (from the CHDK build process) and use the List Load -> Stubs button. It will produce gcc compatabile "C" code of each routine referenced by the stubs.S file.

3) Generic ARM dissassembler for a list of addresses from a file.  Select a formated address.txt file (sample include) with the List Load -> Addresses button. It will produce gcc compatabile "C" code of each routine referenced by the address.txt file.

4) Converting tool for CHDK stubs_entry.S and stubs_entry_2.S  files. Point it at a reference camera dump primary.bin file and its associated stubs_entry.S or stubs_entry_2.S file. Then point it at the dump from a different firmware version of the same camera.  It will produce a stubs_entry.S or stubs_entry_2.S file from the new firmware version based on matching code from the reference port.

5) Converting tool for CHDK "C" task files.  Point it at a reference camera dump primary.bin file and a list of addresses for the various related "C" task files (boot.c, capt_set.c, movie_rec.c). Then point it at the dump from a different firmware version of the same camera.  It will produce set of "C" routines from the new firmware version based on matching code from the reference port.

6) (future) Will optionally create a new signatures.h file for the reference port which can then be edited and converted to a customized stubs_entry_2.S file.
   
Save the resulting output from the steps listed above using the Save button.

Initial Release
I have a list of changes & updates that I will implement prior to declaring a 1.0 release status.  Other input, feedback, bugs reports, and feature requests all welcome on this forum thread.



« Last Edit: 22 / June / 2013, 10:24:03 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Windows GUI for firmware porting tools
« Reply #1 on: 07 / May / 2011, 18:10:13 »
Current "To Do" list for CHDK-PT
1) Pre-load all addresses when in Address load mode so that sub_ or loc_ is set correctly across subroutines.
2) When dereferencing DCD data,  add sub_  or loc_ if value is in ROM.
3) After each DCD word,  if no branch target at next address then next address is also a DCD. Use that as a rule.
4) Add a string search function.
5) When DCD values are valid ASCII, show in comment area.  <- tried it - looks ugly and not much help.
6) Convert the List Load functions to use a single dialog box rather than cascading file selection windows.
7) Fix assembler bug with STRD instruction
8) Make the camera selection persistent (add to ini file).
9) Check for other running instances of the program when closing - currently closing the second instance also closed files needed by the first instance.
« Last Edit: 22 / May / 2011, 15:59:04 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Windows GUI for CHDK porting tools
« Reply #2 on: 17 / May / 2011, 18:55:00 »
I have just used CHDK-PT to port IXUS105 100C to SDM.

Unlike most recent cameras, the memory starts at 0xFFC00000 so in the CAMERA tab I selected 'A series'.
After selecting PRIMARY.BIN and stubs_entry_2.s for the reference firmware, I selected PRIMARY.BIN for the 100c firmware.

CHDK-PTP generated a new stubs file.
I did not bother to check it with the disassembly.

I then created a text file with a list of the tasks and subroutines in the reference build together with their addresses (prefixed with '0x') and the code length in units of 32-bit words.
It is better for the code length to be longer than necessary rather than too short.

I then selected "List Convert" -> "Addresses" button  and it asked  for the reference primary.bin file, the addresses text file and then the primary.bin file for the new port.

New 'C' code was generated, the only hiccup caused by the STRD instruction, one of the newer ARM version 4 family instructions.

It was then necessary to compare the new code with the reference and add the CHDK/SDM 'hacks'.
File comparison using Notepad++ or ProjectDiff was slightly tedious because formatting differences mean that nearly every single line was marked as a change.

Some subroutines had capital letters rather than lower case that caused complilation problems.

You also had to be careful to change some, but not all, 'loc_'  to 'sub_'.

I did not check or change stubs_min.s.

Eventually, the port compiled.

Once I remembered to include the new stubs_entry_2.s file the camera booted and works fine.


CHDK-PT certainly saved a lot of time and avoided the need for asmify.sh that I could not get to work on my Windows machine.

It is still a lot of work and I will not be doing any more ports, I will wait until the CHDK version is available.


David
« Last Edit: 17 / May / 2011, 18:56:48 by Microfunguy »

Re: Windows GUI for CHDK porting tools
« Reply #3 on: 22 / May / 2011, 16:04:29 »
Just posted V1.00.   Reworked the UI for each of the buttons, hopefully making them easier to understand. Made all selections persistent and fixed the STRD bug in the dissassembler. At this point,  its probably got everything I wanted to put into it.  Used it to complete another port to a different IXUS120-SD940 firmware version - no IDA or GCC dissassembly used at all.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Windows GUI for CHDK porting tools
« Reply #4 on: 24 / May / 2011, 05:57:12 »
Updated to version 1.01.  Fixed a bug where the .ini file was not always saved in the same directory as the .exe file.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Windows GUI for CHDK porting tools
« Reply #5 on: 28 / May / 2011, 08:20:07 »

Re: Windows GUI for CHDK porting tools
« Reply #6 on: 28 / May / 2011, 10:22:38 »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Windows GUI for CHDK porting tools
« Reply #7 on: 29 / May / 2011, 08:23:43 »

Re: Windows GUI for CHDK porting tools
« Reply #8 on: 29 / May / 2011, 10:38:58 »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Windows GUI for CHDK porting tools
« Reply #9 on: 29 / May / 2011, 11:07:56 »
First i have to thank you for your reply !

The actual Beta/Alpha for the 495f seems to make good work - in the german-board are some people who get this thing work good. (scipts included)

What do you mean with "create build environment" in the chdk-shell ?

I were able to setup the chdk-shell and have now the 100D ; 100E ; and 100F firmwares for the A495 Cam.

I can compile in CHDK-Shell the 100D and 100F without any errors.
Hope that this is what you mean.

Would be great if you can help me, and if there is something i can do - just tel me - i try my best :)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal