CHDK Development : Which files do what?


This wiki page describes every file used in CHDK development that might need to be customized for a port to a new camera. Each entry briefly describes what information the file contains, has a little bit about where to find that information and some pointers to what might go wrong if those values are wrong. At some point this will probably need to be broken across several pages.

Files Customized for each Firmware Version of a Camera

(in trunk/platform/cameraname/sub/fwversion)


This file is used to for all the addresses that are not discovered automatically during the CHDK build process. In the build process, a "find signature" routine is used to examine a dumped file for the camera firmware called "primary.bin". It looks for matches to know code sequences for routines in the camera ROM that CHDK wants to use. If it does not find such a match, or finds a poor match, then the correct address needs to be entered in stubs_entry_2.S. You need to examine stubs_entry.S and find replacements for any routine not identied 100% or satisfy yourself that the found routine is correct.

There may also be addresses not included in stubs_entry.S that need to be added to stubs_entry_2.S - typrically because they are for routines not needed when the original "find signature" code was written.


This file contains constant values and addresses related to the camera's LCD size, the image sensor size and the buffers used by the camera to hold image data. These values are used to scale the CHDK GUI and to enable RAW&DNG capture and motion detection.


This file contains addresses or offsets in camera RAM when the camera maintains values related to its operation. There are also two values pointing to locations in ROM>


This file contains the code for three CHDK task - boot, PhySw and file_modules. The boot task is the first code executed by CHDK after it is loaded into RAM by the boot loader. In addition to setting up CHDK, it initiates the task hooks for the other CHDK tasks. The PhySw task intercepts camera key presses, allowing CHDK to respond to them before the Canon firmware sees them. The file_modules task adds FAT32 capability to CHDK.

Code for these task is dissassembled from the camera firmware and CHDK specific hooks are inserted.

Files Customized for all Firmware Versions of a Camera

(in trunk/platform/cameraname)


(in trunk/loader/cameraname/)


(in trunk/loader/cameraname/resetcode)

Files Customized in Main Code Files for Specific Cameras


  • short cut key buttons - adjustable ALT button - raw exceptions


  • customized menu space


  • ZSTEP_TABLE_SIZE, nTxtbl if camera supports syncable remote
  • custom shoot processing


  • customized dump_memory for IXUS65 only


  • customize gammma value calculations for sx30 & G12


  • customize USB_MASK (belongs elsewhere)


  • customized shooting_get_drive_mode() for some cameras
  • custom hacks for iris control of sx30 & g12
  • strange vague hack for CAMERA_ixus800_sd700


  • assorted hacks for functions not found in stubs_entry.S for G12, SX30, S95

Files Customize to Add a New Camera or Firmware Version to CHDK

Community content is available under CC-BY-SA unless otherwise noted.