We'll work faster if we'll post what we know. So todays work with 400D firmware:
File structure is [loader]+[firmware pack].
4B: model ID (36 02 00 80 for 400D)
12B: 0?
16B: firmware number (string)
4B: checksum - see below
4B: file offset of the loader
4B: file offset where is the firmware pack (for 400d: 127C90)
4B: 0?
all rest until the firmware pack is the loader code (starting point for the code. propably 0x800000)
Now for the firmware pack.
16B+8B: don't know yet - but one 4B is for table lenght.
next is a table of segments of the pack, with records in form:
4B: don't know yet - mostly #4 propably a flag
4B: offset of the segment (in reference to the begining of the pack)
4B: lenght of the segment
28B: name of the segment (string).
I the 400D pack there are segment like firmware version (5B), model id (4B - is not the USB device ID for 400D).
There are also big segments - firmware, bind_resource (pictures of errors while updating), lens table and so.
my conclusion for today is:
fir is a program with attached resources witch is not loaded permanently to rom, designed to load some of it's data segments to rom (lens table, firmware, and so).
todo for tomorow:
find the checksum's
Mayby even porting the chdk to dslr will be just minor changes and other packing.
I would want to make only a small program, to run on the camera (like the "blinker"). If somebody who wrote something for other camera would help - it would be great.
>news edited:
the checksum for the entire file is:
sum of all bytes without 0x20-0x24 summed with word in 0x20-0x24 will give -1 (0xff ff ff ff).
works for both 400d firmwares.