Adding new cameras, applying patches into trunk (with source code prepared)

  • 1479 Replies
  • 180162 Views
Advertisements
Patch to fix a problem with the code generated by GCC 4.4.0 when compiling the readdir function in platform/generic/wrappers.c.
@philmoz : This appears to break the file browser when CHDK is compiled with gcc3.4.6  (at least I've tracked that problem to this patch for the SD940)

*

Offline reyalp

  • ******
  • 10055
Look closely at the original code generated by GCC 4.4.0 - it is passing R4+52 as the address to _ReadFastDir and is then checking the value at R4+52; but it returns R4.
This is clearly wrong, the code when generated correctly uses the same address for all three uses of 'de', hen passed to _ReadFastDir, when tested after that call and as the return value of the function.
No, it isn't:
Code: [Select]
18634c: e5f40034 ldrb r0, [r4, #52]!
The exclamation means update R4.

It's returning the same value it passes to _ReadFastDir

My guess is that the size of dirent has increased.
Don't forget what the H stands for.

Patch for IXUS120-SD940 using CAM_DATE_FOLDER_NAMING as used but CHDKLover in the CHDK-DE forum.  Allows RAW and DNG files to be save in the same folders as their corresponging JPG's.



*

Offline reyalp

  • ******
  • 10055
Patch for IXUS120-SD940 using CAM_DATE_FOLDER_NAMING as used but CHDKLover in the CHDK-DE forum.  Allows RAW and DNG files to be save in the same folders as their corresponging JPG's.
Added, changset 1157
Don't forget what the H stands for.


*

Offline philmoz

  • *****
  • 2936
    • Photos
Look closely at the original code generated by GCC 4.4.0 - it is passing R4+52 as the address to _ReadFastDir and is then checking the value at R4+52; but it returns R4.
This is clearly wrong, the code when generated correctly uses the same address for all three uses of 'de', hen passed to _ReadFastDir, when tested after that call and as the return value of the function.
No, it isn't:
Code: [Select]
18634c: e5f40034 ldrb r0, [r4, #52]!
The exclamation means update R4.

It's returning the same value it passes to _ReadFastDir

My guess is that the size of dirent has increased.

That makes a lot more sense - glad it's sorted properly now.
Apologies for sending things off in the wrong direction.

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)

*

Offline reyalp

  • ******
  • 10055
That makes a lot more sense - glad it's sorted properly now.
Apologies for sending things off in the wrong direction.
No problem. You wouldn't be the first one to convince yourself some blob of assembler was doing something it didn't  :-[

I'm pretty sure the size of dirent was the problem, but if you can verify that the current autobuild does work correctly on g12 and sx30, that would be appreciated.
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 2936
    • Photos
That makes a lot more sense - glad it's sorted properly now.
Apologies for sending things off in the wrong direction.
No problem. You wouldn't be the first one to convince yourself some blob of assembler was doing something it didn't  :-[

I'm pretty sure the size of dirent was the problem, but if you can verify that the current autobuild does work correctly on g12 and sx30, that would be appreciated.

Confirmed latest autobuild (1160) working on G12 (1.00c) and SX30 (1.00h).

Just out of curiosity, why did you use _malloc and _free in opendir and closedir?
Wouldn't malloc and free be preferable in case exmem is enabled?

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)

*

Offline reyalp

  • ******
  • 10055
Just out of curiosity, why did you use _malloc and _free in opendir and closedir?
Wouldn't malloc and free be preferable in case exmem is enabled?
Yes (although the amount of memory is pretty trivial...) I used the _ version just to avoid some warnings, with the intention of switching it after I made stdlib.h include cleanly. Then I forgot when I did clean up stdlib.h ;)
Don't forget what the H stands for.


*

Offline philmoz

  • *****
  • 2936
    • Photos
Patch for SX130 IS to stop get_effective_focal_length value from overflowing and displaying negative values.
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)

*

Offline reyalp

  • ******
  • 10055
Patch for SX130 IS to stop get_effective_focal_length value from overflowing and displaying negative values.
Added, changeset 1161
Don't forget what the H stands for.

 

Related Topics