A2100IS Porting

  • 62 Replies
A2100IS Porting
« on: 14 / January / 2012, 19:16:13 »
Update from Jan 28, 2012:

Current state: Beta for FW 1.00A ready. CHDK works on that camera! Keyboard works, alt-mode works, CHDK OSD Works, Everything else - should be tested.

List of project files and their progress:


main.c - completed;
kbd.c - completed;
lib.c - completed;
platform_camera.h - completed;
shooting.c - completed (the same as for A2000IS);
wrappers.c - not needed;


boot.c - almost completed (except fat32 loader; movie_rec tasks commented);
lib.c - completed;
capt_seq.c - completed;
movie_rec.c - in progress;

Message below is just for history :)
Hi Everyone!

As there was no CHDK Port available for my camera, I've decided to port it on my own.
I was able to find a lot of doc on wiki/forum,but unfortunately not all questions have answers.

Currently I have the following done:

0) A1100 was chosen as most appropriate example for porting
1) FW dumped. My camera has 1.00A firmware version, which was successfully dumped with a help of dump script.
2) IDA 5.2 Project with parsed dump + chdk.idc and A720 sign applied
3) Fixed a lot of addresses at boot.c
4) Fixed ( PLATFORMID=12734 and MEMISOSTART=0x12EDB4 )

Everything compiled successfully using CHDK-Shell for windows. There is no errors, but, unfortunately camera doesn't want to boot up :( It's just staying OFF and ignoring PLAYBACK / PowerON while SD Card is Locked.

So I'm asking for help on this issue.

I found that LED address is 0xC0220000 and tried to insert test in my_restart() and in the beginning of boot.c - but with no luck, seems camera just don't want to recognize new firmware.

Code for LED:

LDR     R1, =0xC0220000
ROM:FFC21BC4                 MOV     R0, #0x44
ROM:FFC21BC8                 STR     R0, [R1]

Please, put me in the right direction - where to find our why camera ignores new build.

Thanks in advance!

« Last Edit: 28 / January / 2012, 17:36:37 by ac.n1bs »


Offline reyalp

  • ******
  • 10069
Re: A2100IS Porting
« Reply #1 on: 14 / January / 2012, 20:13:00 »
Hello and welcome ac.n1bs

First off all, I would not suggest using a1100 as your main reference port. That port had troubled development (stop and start development by multiple people who didn't really know what they were doing) and probably still has a lot of stuff broken. In general, you should refer to several ports of a similar generation to the camera you are trying to port. The dryos revision is a better measure of similarity than the model name. That doesn't mean you need to start over, you have to check/correct every platform file no matter what, but a1100 is probably not a good example of how things should work.

A2100 looks like it will probably be a dryos R31 camera. My D10 port is from this version and reasonably complete and well commented, so it may be helpful. I'd also suggest philmoz ports (G12, SX30, SX40) as ones that were likely to be good examples.

I don't see a firmware dump anywhere for this camera. There was a link for one on the wiki, but it just went to some kind of spammy link farm site. If you can post a dump somewhere, that would be helpful.

0xC0220000 seems unlikely for an LED address. You're sure the code you found was for an LED, not some other MMIO ?

I guess you mean loader/camera/main.c my_restart ? That's the earliest C code where you can blink an LED.

If your NEED_ENCODED_DISKBOOT= number is wrong, the camera won't boot at all. You should use the same number as other cameras with the same dryos rev.

If you want more realtime help, you can sometimes find us in the irc channel #chdk on freenode.
Don't forget what the H stands for.

Re: A2100IS Porting
« Reply #2 on: 14 / January / 2012, 20:29:42 »
Thanks for so fast reply! I'll follow your advice and start from scratch with your FW.

Here is link to firmware on dropbox - if you can, please share this link on general page for A2100IS (I hope dropbox will live forever :)):

Unfortunately I don't have a rich experience with disassembling and I'm not a guru on ARM, but previously I was working a lot with AVR MCs - So I hope it's possible to improve my asm knowledge to appropriate level :)

With LED blinking I'm not sure about correct address, but it's the only available from start address that has 0x44 and 0x46 values - it's very similar to camera actions from start - it's blinking 4-5 times. I tried with the following code in loader/main.c without luck:

Code: [Select]
void __attribute__((noreturn)) my_restart()

int i;       
*((volatile int *) 0xC0220000) = 0x46; // Turn on LED
for (i=0; i<0x1000000; i++) // Wait a while
     asm volatile ( "nop\n" );
*((volatile int *) 0xC0220000) = 0x44; // Turn off LED
for (i=0; i<0x1000000; i++) // Wait a while
    asm volatile ( "nop\n" );

I've also tried to change jump-vector to original at loader/resetcode/main.c - the same, no luck:

Code: [Select]
                 "LDR     R0, =0xFFC00000\n"  // original jump-vector
                //      "MOV     R0, %0\n"              // new jump-vector

Camera just doesn't start.

I'll try tomorrow with clean FW, and hope it will help - because today it's already 2.30AM at Montenegro and I'm too tired :)

One more question:

What is the fastest way to check LEDs ? May be it's better to use empty stubs for all .c files and put only LED code into loader/main.c ?
« Last Edit: 14 / January / 2012, 20:35:19 by ac.n1bs »


Offline fe50

  • ******
  • 3038
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: A2100IS Porting
« Reply #3 on: 15 / January / 2012, 03:25:23 »
ac.n1bs - thanks for the dump...
Added the
  • A2100 1.00A
full 4MB dump (dumped with cBasic udumper) provided by ac.n1bs from this forum post to the repository.

Re: A2100IS Porting
« Reply #4 on: 15 / January / 2012, 13:39:25 »
Correct LEDs:

Code: [Select]
#define LED_PWD 0xC0220014   // A2100IS Green - power led
#define LED_DP  0xC0220018   // A2100IS Blue - Direct Print led
#define LED_AF  0xC022000C   // A2100IS Red - AutoFocus led

Re: A2100IS Porting
« Reply #5 on: 15 / January / 2012, 14:28:28 »

Camera can pass loader and resetcode - tested with led blinking :) It's on G10 basis.

Also I've found that camera has:
DRYOS version 2.3, release #0031

Could someone please check if I updated pages correctly ? (I've changed page with LED addresses for A2100IS and P-ID page with OS version). Just don't want to break anything.

Thanks for help!


Offline reyalp

  • ******
  • 10069
Re: A2100IS Porting
« Reply #6 on: 15 / January / 2012, 17:33:11 »
Could someone please check if I updated pages correctly ? (I've changed page with LED addresses for A2100IS and P-ID page with OS version). Just don't want to break anything.
Looks good, and sounds like you are off to a good start.
Don't forget what the H stands for.

Re: A2100IS Porting
« Reply #7 on: 16 / January / 2012, 09:55:22 »
For some reason I can't pass boot.c completely, it's stuck on sub_FFC00FC4_my - where we assign new:

Code: [Select]
//"LDR     R0, =0x12EDB4\n"    // -
" LDR     R0, =new_sa\n"      // +
" LDR     R0, [R0]\n"         // +

and replace

Code: [Select]
"LDR     R1, =sub_FFC04D38_my\n" //+ ---------->
It just doesn't want to load sub_FFC04D38_my - I've put blink test at the beginning and it's not executing it :(

Re: A2100IS Porting
« Reply #8 on: 16 / January / 2012, 10:18:16 »
Can't get screen be turned on. Please help.

- Fixed all subroutines at boot.c (90% sure that last one is correct, where FAT table read added);
- Fixed platform/sub/lib.c
- Added all hints in all requested files from stubs_entry.S (i.e. defines into lib.c/kbd.c/etc. stubs)

Checked with LED blinks that following tasks can be created during boot:
   CreateTask_spytask();   // +
        CreateTask_PhySw();    // +
   CreateTask_Blinker();   // +

When I press powerOn/PlayMode - camera blinks twice with LED_PWR and just do nothing... If I press it again - camera will do the same one more time, but screen always OFF. Please, who is able, give me advice where to check, or at least, exact boot sequence from start. AFAIK, since I get response from functions of boot.c - everything should be OK, but it's not.

Thanks in advance!
« Last Edit: 16 / January / 2012, 18:32:06 by ac.n1bs »

Re: A2100IS Porting
« Reply #9 on: 17 / January / 2012, 14:31:44 »
Can anyone confirm, if it's enough to fix boot.c to see something on the screen ? Because I don't know in which direction should I move, so please help who is able.

Thanks in advance.


Related Topics