A1000IS porting... - page 29 - DryOS Development - CHDK Forum

A1000IS porting...

  • 297 Replies
  • 145798 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: A1000IS porting...
« Reply #280 on: 03 / July / 2011, 03:08:45 »
Advertisements
(Mods, if there are no double posting rules on this forum, please forgive me! Rest assured that my intentions are good  :D )

I just downloaded waterwingz's CHDK-PT tool to see if I could get it to make an a1000 100a version off of the source code I just posted for a 100b version (which is the modified German trunk695.)  I am not able to get this to work :(

First off, I used the Dumper Canon Basic Script to get the PRIMARY.BIN files for both the 100a and 100b (since I have one of each.)  I am confused to find that they are both 4096 KB and they both show a date modified of 12/31/1999 11:00 PM.  When I start running them through CHDK-PT and comparing the output, I can't find much at all that is different.  About the only noticeable difference I've encountered so far is in the address.txt file for the each version.

100a:
line 78 "   LDR   R0, =0xFFEEAFD0 \n"       

100b:
line 77 "   LDR   R0, =0xFFEEAE90 \n"     

When I try to run Convert -> Address List nothing seems to happen - it thinks for a little bit and shows "analyzing... 0 lines" then finishes and there is nothing in the text box area and when I hit Save it just saves a blank file.  I don't know what this means.

On a random sidenote, perhaps info from these address.txt files could help fix video recording in CHDK?  So far as I know, none of the video recording features of CHDK are available for the a1000 so far (in this most recent build or any other build for that matter.)  Maybe the info here could help with that, I'm not sure.

Anyways, here are links to both PRIMARY.BIN files (renamed so you can tell them apart :P) - Note that I would have just attached these to this post but they are too big =/

http://www.mediafire.com/?5sxdemtamb682

The dumper script doesn't set the date correctly on the PRIMARY.BIN file which is why they are both the same date, they should both be the same size.

I use my new address finder (http://chdk.setepontos.com/index.php?topic=6560.0) on both versions and the only differences I can see are for levent_table and FlashParamsTable. The changes only seem to be in the data segment so probably just translated text corrections.

The changes values for stubs_min.S for 1.00a are:
levent_table = 0xffeab5b8
FlashParamsTable = 0xffeca0bc

To use CHDK-PT you need to supply it with the addresses and lengths of the functions you want to port in the original version and then it tries to extract the equivalent stuff from the new version. Since the code segment seems to be the same in these two versions you probably don't need this.

Phil.


CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: A1000IS porting...
« Reply #281 on: 03 / July / 2011, 12:15:11 »
The dumper script doesn't set the date correctly on the PRIMARY.BIN file which is why they are both the same date, they should both be the same size.

I use my new address finder (http://chdk.setepontos.com/index.php?topic=6560.0) on both versions and the only differences I can see are for levent_table and FlashParamsTable. The changes only seem to be in the data segment so probably just translated text corrections.

The changes values for stubs_min.S for 1.00a are:
levent_table = 0xffeab5b8
FlashParamsTable = 0xffeca0bc

To use CHDK-PT you need to supply it with the addresses and lengths of the functions you want to port in the original version and then it tries to extract the equivalent stuff from the new version. Since the code segment seems to be the same in these two versions you probably don't need this.

Phil.


Thanks, that is reassuring :)  I changed my 100a subs folder's stubs_min.S file to use the values you gave for levent_table and FlashParamsTable.  I am still getting the same error I was getting when I try to compile it in CHDK-Shell.  Here is that error:

========== C:\CHDK\DE\TRUNK\TRUNK695\BIN\LOGS\ERR-A1000-100A.TXT ==========

Time to generate stubs 7.25 seconds
../platform/a1000/libplatform.a(wrappers.o): In function `remount_filesystem':
wrappers.c:(.text+0x120): undefined reference to `_Unmount_FileSystem'
wrappers.c:(.text+0x124): undefined reference to `_Mount_FileSystem'
../platform/a1000/libplatform.a(wrappers.o): In function `rewinddir':
wrappers.c:(.text+0x46c): undefined reference to `_rewinddir'
collect2: ld returned 1 exit status
C:\CHDK\gcc451\bin\gmake.exe[1]: *** [main.elf] Error 1
gmake: *** [all-recursive] Error 1


Just to make sure I didn't break something, I compiled the 100b version again and it seemed to compile just fine.  I have attached the full log for my attempt to compile 100a to this post in case it might have some useful info.  For comparison, I also attached the log from my successful 100b attempt.
« Last Edit: 03 / July / 2011, 12:19:01 by Qanthelas »

Re: A1000IS porting...
« Reply #282 on: 03 / July / 2011, 13:02:58 »
In 100b stubs_entry_2.s,

NSTUB(Unmount_FileSystem,         0xFFC00940)
NSTUB(Mount_FileSystem,            0xFFC00940)
NHSTUB(UnsetZoomForMovie,         0xFFC00940)
NSTUB(rewinddir,               0xFFC00940)

is obviously incorrect and NSTUB should be NHSTUB.

I can only assume CHDK does not use those functions.
You need to set to a NULLSUB address.

*

Offline reyalp

  • ******
  • 14080
Re: A1000IS porting...
« Reply #283 on: 03 / July / 2011, 14:36:43 »
FFC00940 is a nullsub addres ;)
Don't forget what the H stands for.


Re: A1000IS porting...
« Reply #284 on: 03 / July / 2011, 15:14:28 »
FFC00940 is a nullsub addres ;)

Fair enough, but in the CHDK source that I used there was no mention of that ... unusually.

Re: A1000IS porting...
« Reply #285 on: 03 / July / 2011, 22:00:30 »
In 100b stubs_entry_2.s,

NSTUB(Unmount_FileSystem,         0xFFC00940)
NSTUB(Mount_FileSystem,            0xFFC00940)
NHSTUB(UnsetZoomForMovie,         0xFFC00940)
NSTUB(rewinddir,               0xFFC00940)

is obviously incorrect and NSTUB should be NHSTUB.

I can only assume CHDK does not use those functions.
You need to set to a NULLSUB address.

Ah thanks, I see what is going on now.  I added in the items you mentioned to the 100a stubs_entry_2.S (and changed them to NHSTUB instead of NSTUB), tried to compile, and got this error:

========== C:\CHDK\DE\TRUNK\TRUNK695\BIN\LOGS\ERR-A1000-100A.TXT ==========

Time to generate stubs 7.21 seconds
../platform/a1000/sub/100a/libplatformsub.a(stubs_entry_2.o): In function `_qsort':
(.text+0xb0): undefined reference to `NULL_STUB'
collect2: ld returned 1 exit status
C:\CHDK\gcc451\bin\gmake.exe[1]: *** [main.elf] Error 1
gmake: *** [all-recursive] Error 1


The line in stubs_entry_2.S for qsort is basically the same for both the 100a and the 100b.

For the 100a:
NHSTUB(qsort, 0xffe2bbec)  

For the 100b:
NHSTUB(qsort,                       0xffe2bbec) //SDM

I don't see anything related to qsort and NULL_STUB - only the three items I just added (Unmount_FileSystem, Mount_FileSystem, and rewinddir) are NULL_STUB in stubs_entry_2.S for the 100a.  I gotta get going now but I'll poke at this later.  If any of you have an idea on what the problem might be please post :)

EDIT: I saw reyalp's post about FFC00940 being a null address so I changed "NULL_STUB" for "FFC00940" in my 100a stubs_entry_2.S file and now I get this error:

========== C:\CHDK\DE\TRUNK\TRUNK695\BIN\LOGS\ERR-A1000-100A.TXT ==========

Time to generate stubs 7.21 seconds
../platform/a1000/sub/100a/libplatformsub.a(stubs_entry_2.o): In function `_qsort':
(.text+0xb0): undefined reference to `FFC00940'
collect2: ld returned 1 exit status
C:\CHDK\gcc451\bin\gmake.exe[1]: *** [main.elf] Error 1
gmake: *** [all-recursive] Error 1



This leads me to think that it's one of the 3 NHSTUB entries that I just added for the 100a that is causing this to error out (even though it talks about '_qsort', presumably one of these 3 is called by qsort.)  In the past (on other small programming-ish tweaking projects) I've missed some little thing when copy/pasting (like a tab or a space) and that breaks the world.  I'm gonna fiddle with things a bit and see if perhaps the values are right I just copy/pasted them wrong.

ANOTHER EDIT: To see if I could isolate if it's just 1 of the 3 new lines I added that is breaking, I changed NHSTUB(rewinddir, FFC00940)   to NHSTUB(rewinddir, NULL_STUB)   and then I get this error on compiling:

========== C:\CHDK\DE\TRUNK\TRUNK695\BIN\LOGS\ERR-A1000-100A.TXT ==========

Time to generate stubs 7.21 seconds
../platform/a1000/sub/100a/libplatformsub.a(stubs_entry_2.o): In function `_qsort':
(.text+0xb0): undefined reference to `FFC00940'
../platform/a1000/sub/100a/libplatformsub.a(stubs_entry_2.o): In function `_qsort':
(.text+0xc4): undefined reference to `NULL_STUB'
collect2: ld returned 1 exit status
C:\CHDK\gcc451\bin\gmake.exe[1]: *** [main.elf] Error 1
gmake: *** [all-recursive] Error 1


So nuts, looks like either way it doesn't know what this null stub thing is :P

EDIT ONCE MORE, WITH FEELING: Derp! I just realized that I forgot the "0x" at the begging of "FFC00940" and also that the 100b version of stubs_entry_2.S that I was looking at had this line near the top "#define NULL_STUB 0xFFC00940".  After adding that define line to my 100a file and changing the 3 references to NULL_STUB, it compiled!
« Last Edit: 03 / July / 2011, 22:18:39 by Qanthelas »

Re: A1000IS porting...
« Reply #286 on: 03 / July / 2011, 22:25:37 »
I feel like I've edited that last post enough.  Now I am at a loss for what to do next.  I finally got the 100a CHDK version to compile so I loaded it up on a card, stuck it in my 100a camera, and it won't turn on.  Just out of curiosity, I then put it in my 100b camera and it does turn on.  (I took a picture and ran it through ACID.jar just to be sure that was indeed my 100b camera and indeed it is.)  So apparently I've missed something important, but I don't know what.  I'm attaching my whole a1000 folder to this post in a .zip - if you have any ideas, let me know :)  I've also attached the full compiled '100a' (which is apparently really a 100b) version .zip folder to this, too, just as a 'for what it is worth'.  (Note, I had the PRIMARY.BIN file for the 100a in the sub/100a folder but I took it out before I zipped this since the file would be to big to post on the forums otherwise.  On a sidenote, am I not supposed to have that PRIMARY.BIN file in there?  It looks like the trunk sub/100b folder just has an empty file called PRIMARY.BIN at 0KB.)
« Last Edit: 03 / July / 2011, 22:33:41 by Qanthelas »

Re: A1000IS porting...
« Reply #287 on: 04 / July / 2011, 00:24:29 »
I feel like I've edited that last post enough.  Now I am at a loss for what to do next.  I finally got the 100a CHDK version to compile so I loaded it up on a card, stuck it in my 100a camera, and it won't turn on.  Just out of curiosity, I then put it in my 100b camera and it does turn on.

It looks like just using the tasks .C files from the 100b for the 100a is not going to work.  Your earlier comment about :

Quote
100a:
line 78 "   LDR   R0, =0xFFEEAFD0 \n"       

100b:
line 77 "   LDR   R0, =0xFFEEAE90 \n"     

should have been a clue.  The files really need to be translated - CHDK-PT can help with that but it still a couple of hours work for someone who knows what they are doing.


Quote
  On a sidenote, am I not supposed to have that PRIMARY.BIN file in there?  It looks like the trunk sub/100b folder just has an empty file called PRIMARY.BIN at 0KB.)

This is normal - the 0KB version of the file prevents the signature finder from running each time a compile is done. The output of that step - the stubs_entry.S file should never change for a given primary.bin file and doing this results in  a considerable time savings when building the entire trunk of all cameras.  It also cuts the size of the source download as the 4M & 8M promary.bin files are not distributed.



Ported :   A1200    SD940   G10    Powershot N    G16


Re: A1000IS porting...
« Reply #288 on: 04 / July / 2011, 00:44:01 »
It looks like just using the tasks .C files from the 100b for the 100a is not going to work. ... The files really need to be translated - CHDK-PT can help with that but it still a couple of hours work for someone who knows what they are doing.
Well nuts, figures it couldn't be quite as easy as I might have hoped ;)  I really am not sure what all is different between the two firmware versions so I think I'm just out of my league with this whole conversion thing.

This is normal - the 0KB version of the file prevents the signature finder from running each time a compile is done. The output of that step - the stubs_entry.S file should never change for a given primary.bin file and doing this results in  a considerable time savings when building the entire trunk of all cameras.  It also cuts the size of the source download as the 4M & 8M promary.bin files are not distributed.
Ah OK, that makes sense and it's good to know. It also explains why compiling my '100a version' (which is apparently really a 100b version) took longer than I thought it normally did to complete.

Re: A1000IS porting...
« Reply #289 on: 04 / July / 2011, 15:43:27 »
I feel like I've edited that last post enough.  Now I am at a loss for what to do next. 

@Qanthelas : here are two things you can try.

100a:
line 78 "   LDR   R0, =0xFFEEAFD0 \n"       

100b:
line 77 "   LDR   R0, =0xFFEEAE90 \n"     
These specify different start addresses for the data space.  It possible the 1.00b boot.c code will be alright for the 1.00a if you simply change the value on line 33 from 0xFFEEAE90 to 0xFFEEAFD0.

I went through the rest of the boot.c file and flagged anything that was different than what's in the 1.00a primary.bin file (other than the CHDK required mods). File attached - there were 10 things different between the 1.00b and 1.00a - marked //** different than 1.00b in the attached file.

See if that will compile and run ?




Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics