SD940 (IXUS120) porting thread - page 2 - DryOS Development - CHDK Forum

SD940 (IXUS120) porting thread

  • 542 Replies
  • 201414 Views
*

Offline waldo

  • ***
  • 238
Re: SD940 rev 103c porting thread (IXUS120)
« Reply #10 on: 27 / November / 2010, 23:01:37 »
Advertisements
I ported the S95 to a firmware version that I did not own.  From others' comments, it appears to work about the same as the original, but having the camera in hand obviously makes debugging easier.

I found most of the addresses and the patched the code in boot.c, but the camera kept crashing in record mode and I moved on to other things.  If you can post your source code, I could pretty quickly drop my stuff into your code and see how that goes. 

*

Offline reyalp

  • ******
  • 14080
Re: SD940 rev 103c porting thread (IXUS120)
« Reply #11 on: 27 / November / 2010, 23:03:49 »
Don't forget what the H stands for.

*

Offline waldo

  • ***
  • 238
Re: SD940 rev 103c porting thread (IXUS120)
« Reply #12 on: 27 / November / 2010, 23:08:53 »
BTW, the firmware dump for SD940 1.02C from last year is corrupt.  Here is a link to a proper version:

http://www.zshare.net/download/8322887271f67fd4/

Re: SD940 rev 103c porting thread (IXUS120)
« Reply #13 on: 27 / November / 2010, 23:29:46 »
I found most of the addresses and the patched the code in boot.c, but the camera kept crashing in record mode and I moved on to other things.  If you can post your source code, I could pretty quickly drop my stuff into your code and see how that goes.  
I'm sure it will be no surprise with a newbie doing a first port if I confess that my source code at this point is a mess. Starting from scratch, I've had to tinker to understand how this all comes together.  I think that I now understand the build structure basics.  The ground rules are to not change stuff in the trunkNNN core, include and lib directories.   I'm not so sure about how to treat the platform/generic directory - some of the files have duplicate names with the ones under platform/ixus120_SD940.  But the build process seems to sort that out - some don't get compiled and some do despite the name conflict.  Not sure how that magic happens yet.  In any case, at some point I'll take a day and clean up so that the changes I made in the common files all migrate over to the version specific files.

Any chance you could send me your lib.c, stubs_entry_2.S and stubs_min.S ?  I parsed the stub_entry.s version from the SD980 in a spreadsheet and the labels show up in the same order in memory for the SD940 and SD980.  Initially they used the same addresses but gradually spread apart.  I calculated the average spread at the point where the SD980 stubs_entry_2.S were found and used that as a starting point for finding the SD940 equivalents. Brute force.

Also, I have not started on the capt_seq.c or movie_rec.c so getting a look at yours would help.  

You are welcome to any of my files or maybe you'd rather wait until I get a little farther along and I'll just zip up the whole build ?

Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14080
Re: SD940 rev 103c porting thread (IXUS120)
« Reply #14 on: 27 / November / 2010, 23:35:59 »
The stuff in generic is *included*, for reasons that escape me. Not all ports include all of the generic items.

Some functions also have __attribute__((weak)) versions in the generic code, which may be overridden in camera code. In this case, the weak and non-weak versions must not appear in the same file via includes.

All of this stuff is begging for cleanup :-[
Don't forget what the H stands for.

Re: SD940 rev 103c porting thread (IXUS120)
« Reply #15 on: 27 / November / 2010, 23:56:13 »
Some functions also have __attribute__((weak)) versions in the generic code, which may be overridden in camera code. In this case, the weak and non-weak versions must not appear in the same file via includes.
So the linker is smart enough to resolve which function to use when two functions have the same name, as long as one of them is tagged __attribute__((weak)).   That is slick - I've learned another new thing today.  (I assume you can't duplicate names in the same file - the compiler would choke as you've suggested.)

All of this stuff is begging for cleanup :-[
I know what you mean.  I went through the makefiles trying to figure out how to convince it not to recompile everything from scratch every time.  I have a slow computer.   But I soon gave that up - although I caught your tip about hiding PRIMARY.BIN.  Still, maybe we could capture some of the stuff I've tried to describe in this forum in the wikia sections on building for a new camera ?  I could draft it but will need help getting it accurate.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: SD940 rev 103c porting thread (IXUS120)
« Reply #16 on: 28 / November / 2010, 00:12:05 »
Some functions also have __attribute__((weak)) versions in the generic code, which may be overridden in camera code. In this case, the weak and non-weak versions must not appear in the same file via includes.
So the linker is smart enough to resolve which function to use when two functions have the same name, as long as one of them is tagged __attribute__((weak)).   That is slick - I've learned another new thing today.  (I assume you can't duplicate names in the same file - the compiler would choke as you've suggested.)
Right. This is a GCC extension. stubs_entry.S and stubs_entry_2.s also depend on this: the NSTUB macro (used in stubs_entry.S) makes a weak symbol, and the NHSTUB macro makes a normal one.
Quote
I know what you mean.  I went through the makefiles trying to figure out how to convince it not to recompile everything from scratch every time.
If you are using make directly (not CHDK shell) you can just do "make fir" and it will do an incremental build. You have to be aware that it won't necessarily rebuild everything when it should. Generally, changing C files should be OK, but changing headers or compile time options is not. You always want to do a make clean if you change which camera you are building.

Quote
Still, maybe we could capture some of the stuff I've tried to describe in this forum in the wikia sections on building for a new camera ?  I could draft it but will need help getting it accurate.
Sure. If you think what you have is too inaccurate/incomplete to have on the main page, you can always throw it somewhere under your user page on the wiki (like I did with http://chdk.wikia.com/wiki/User:ReyalP/EventProcNotes ), and then move the content when it's cleaned up.
Don't forget what the H stands for.

Re: SD940 rev 103c porting thread (IXUS120)
« Reply #17 on: 28 / November / 2010, 00:33:57 »
If you are using make directly (not CHDK shell) you can just do "make fir" and it will do an incremental build.
I've gotten lazy and have been using CHDK_Shell on my WinXP laptops (work & home) rather than my main Linux box. As result,  there are no path / environment variables setup to allow me to just run "make fir".  One more thing to work on I guess.
-
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: SD940 rev 103c porting thread (IXUS120)
« Reply #18 on: 28 / November / 2010, 05:25:07 »
Quote
I've gotten lazy and have been using CHDK_Shell on my WinXP laptops (work & home) rather than my main Linux box. As result,  there are no path / environment variables setup to allow me to just run "make fir".  One more thing to work on I guess.

In CHDK-Shell, click the 'cmdline icon', and type "gmake fir"
In cmdline mode the shell will adjust the PATH for you.
You have to edit makefile.inc to set your cam/firm as the default first, though, by uncommenting
the PLATFORM and PLATFORMSUB macro's for your cam/firmware (and assuring all the others are #ed)

While checking this, I also noticed it only works if you've already compiled at least once (which
assures a /bin directory is created) Will correct in next version.

HTH,

wim

edit: BTW: trunk991 makefile.inc is set to compile ixus95_sd1200-100c by default, a version that's
                not 'officially' supported (as in: no entries in root Makefile)    :D
« Last Edit: 28 / November / 2010, 05:52:37 by whim »

Re: SD940 rev 103c porting thread (IXUS120)
« Reply #19 on: 28 / November / 2010, 09:36:49 »
In CHDK-Shell, click the 'cmdline icon', and type "gmake fir"
Wow - that works great. :D I guess that I thought the little command line icon was part of the window wallpaper. I didn't realize it actually did something.

So I clicked on the SD card icon and it does something too !  Then I held my breath and clicked on the CHDK icon - nothing happened.  Oh well,   two out of three is pretty good.

Funny how you only start to learn the good tricks after hours of doing things the hard way.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics