Adding new cameras, applying patches into trunk (with source code prepared) - page 11 - General Discussion and Assistance - CHDK Forum

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

  • 1685 Replies
  • 847652 Views
*

Offline ultimA

  • ***
  • 137
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #100 on: 04 / October / 2010, 16:51:40 »
Advertisements
Oops, sorry - warnings, not errors for ixus100_sd780 ...

Phew... so scared the **** out of me, don't do that again! :D
Yeah, those warnings are there but they were there before too. I did not investigate any of them yet, although to be honest, I'm not sure I will.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #101 on: 04 / October / 2010, 17:21:19 »
It was just an ill-timed low cafeine level, i guess  :D
Now that that's fixed, I'll try and figure out how the edge overlay disable fixes work out,
never use it anyways (although I usually load vanilla builds on my cams)

wim


*

Offline ultimA

  • ***
  • 137
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #102 on: 06 / October / 2010, 19:43:26 »
I refreshed the patch from my 04.okt. post. It fixes all the warnings for the ixus100, and also fixes some other warnings. Some are still left, because I don't have these cameras, so I only took on the trivial fixes as I have no possibility to test. Many of the remaining warnings would have needed me to dive into firmware disassembly. Changes have been compile-tested on GCC 4.4 and 4.5.1.

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #103 on: 14 / October / 2010, 05:15:29 »
Some small changes I'm proposing to trunk can be found at http://drop.io/hidden/jlqkjtgpqd29rhy/asset/cGF0Y2g5NTMtZGlmZi0y
Changelog:
- Fix: Make the A2000, G11 and ixus100_sd780 ports compatible with GCC 4.5. Apparently GCC 4.4 was too forgiving and still built the code, but GCC 4.5.1 errored out on them. This patch fixes the ASM so that these cams can be built successfully. The changes were not actually tested, but the fixes are trivial. As a result, all stable ports can be built using GCC 4.5.1 now. Credit also goes to whim who noticed these cams failing to build and he also suggested the first set of fixes.
- Shut up some (not all) warnings from ixus100_sd780, ixus40_sd300, ixus65_sd630, s5is, ixus60_sd600
- Fix: Make edge overlay respect OPT_EDGEOVERLAY. Previously, generated binary size did not get significantly smaller even when OPT_EDGEOVERLAY was undefined, because undefining it only resulted in the overlay being excluded from the menu, but still being built. Excluding edge overlay now saves appr. 3Kbytes.
- Fix: Edge overlay erroneously depended on OPT_DEBUGGING. Builds failed when OPT_DEBUGGING was not defined previously.
I refreshed the patch from my 04.okt. post. It fixes all the warnings for the ixus100, and also fixes some other warnings. Some are still left, because I don't have these cameras, so I only took on the trivial fixes as I have no possibility to test. Many of the remaining warnings would have needed me to dive into firmware disassembly. Changes have been compile-tested on GCC 4.4 and 4.5.1.
Thx ultimA !  ... added to the trunk, changeset #955.

*

Offline reyalp

  • ******
  • 14126
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #104 on: 16 / October / 2010, 18:16:39 »
A note on the last "cleanup"

Code: [Select]
BL      0xFFC0BD98
BL      0xFFC0BB50
This is wrong. It does NOT jump to the given address, because B and BL only take 24 bit PC relative offsets. It will crash.  The "correction"
Code: [Select]
BL      =0xFFC0BD98
BL      =0xFFC0BB50
Is also wrong. In this case, it doesn't matter much because it's an assert anyway.

Explanation: http://chdk.wikia.com/wiki/CHDK_Coding_Guidelines#Calling_original_ROM_functions

There are several correct ways do do this
#1)
BL sub_<address>
CHDK build process will automatically put the correct shim in stubs_auto.S
edit: Note, this only applies to platform files mentioned in STUBS_AUTO_DEPS

#2)
MOV LR, PC
LDR PC, =<address>
for a BL, or just the LDR for a B

#3)
Add a stub to stubs_entry_2.S, and use B/BL <name>

B/BL <constant> is not something that you are ever likely to want to do.

edit:
and ADR should should generally be translated to the appropriate LDR =constant, although AFAIK ADRL will do the right thing if it assembles at all.

Random debugging code (e.g.  ixus100 boot.c) should be #if 0'd out to save memory.

I'm going to grep the code for all the B/BL [0=]0x* and fix them. Something to look out for when adding ports, it seems to be a common mistake.
« Last Edit: 16 / October / 2010, 19:31:29 by reyalp »
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #105 on: 30 / December / 2010, 23:20:14 »
I would like to get the SX30 and G12 ports added to the main trunk.
I'd like to do this in stages rather than trying to do a big bang as there are a lot of changes required in various files.

The first patch is attached.
This contains:
- new propset file (propset4.h)
- updated CHDK\Makefile to build propset4.lua
- updated platform.h with new propset include
- updated camera.h with SX30 & G12 sections, plus some new #defines for the functional changes in other code
- updated gui_draw.h with a new palette (#7)
- updated reversebytes.S for the DNG double buffer optimisation (platform.h is configured so that the existing calls to reverse_bytes_order are mapped to the new function name reverse_bytes_order2 so that existing code will still compile and work). I needed to include this to cover all the changes in platform.h

None of this should break any existing code (fingers crossed).

First time I've done this so I hope I haven't made too much of a mess :)
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)

*

Offline reyalp

  • ******
  • 14126
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #106 on: 30 / December / 2010, 23:43:33 »
First time I've done this so I hope I haven't made too much of a mess :)
Quite the opposite  :D

Added in changeset 1007
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #107 on: 31 / December / 2010, 06:48:33 »
Part 2 for SX30 & G12 attached.

This includes updates for the files below based on the new #defines. There are also a few camera specific bits (e.g. nTxtbl).

- core\edgeoverlay.c
- core\gui.c
- core\gui_osd.c
- core\histogram.c
- core\kbd.c
- core\motion_detector.c
- core\raw.c
- include\keyboard.h
- include\modelist.h
- makefile.inc
- platfom\generic\wrappers.c

Finally there are the new loader and platform directories for sx30 and g12 (hopefully I haven't left anything out here).

Phil.

[Update: broken patch removed]
« Last Edit: 31 / December / 2010, 16:01:37 by philmoz »
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)

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #108 on: 31 / December / 2010, 08:12:35 »
hi phil

just patched 1007, edited Makefile and compiled under GCC 4.5.1 / Win 7

all 4 cam/firms say:
Quote
stubs_entry_2.S:2:29: fatal error: stubs_entry_ida.S: No such file or directory
compilation terminated.
C:\CHDK\gcc451-pmmx\bin\gmake.exe[4]: *** [stubs_entry_2.o] Error 1
C:\CHDK\gcc451-pmmx\bin\gmake.exe[3]: *** [all-recursive] Error 1
C:\CHDK\gcc451-pmmx\bin\gmake.exe[2]: *** [all-recursive] Error 1
C:\CHDK\gcc451-pmmx\bin\gmake.exe[1]: *** [all-recursive] Error 1
gmake: *** [all-recursive] Error 1

HTH,

wim

PS attached modded root Makefile removed
« Last Edit: 08 / January / 2011, 10:35:10 by whim »

Re: Adding new cameras, applying patches into trunk (with source code prepared)
« Reply #109 on: 31 / December / 2010, 09:39:18 »
Hi phil,
the eventproc_export_* functions are missing.

CHDKLover

 

Related Topics


SimplePortal © 2008-2014, SimplePortal