SX10 Shutter Speeds - page 3 - General Discussion and Assistance - CHDK Forum

SX10 Shutter Speeds

  • 47 Replies
  • 18610 Views
*

Offline reyalp

  • ******
  • 14087
Re: SX10 Shutter Speeds
« Reply #20 on: 06 / October / 2009, 22:08:01 »
Advertisements
How would I setup a debug on the function, can that be done through the CHDK debug menu, or would it be in the core code and I would need to compile it?
You would need to write whatever code is required to reveal the information you are after, and compile a CHDK build to try it out.

My thoughts on how to approach this:
- apex2us is called deep in the canon code, in the middle of the shooting process. You don't want to try to write a file or display something here. If you want to get information out of it, without risking disrupting the process, the simplest way is to just set some global variables you can inspect later.
- There is already code in place to make it easy to display arbitrary values. In core/gui.c look for gui_draw_debug_vals_osd. Replace one of the default variables with your own, and you are good to go. This display is enabled in debug->show misc vals
- There are 3 values you want to capture: the original TV96 set by the original override, the TV96 sent to apex2us, and the output value of canons apex2us. The first you can capture at the end of shooting_expo_param_override by querying the propcase. The second two you can capture by modifying CHDKs apex2us.

An alternative approach is just to dive into the firmware disassembly and try to figure it out that way.

You should familiarize yourself with the APEX system or the APEX*96 values the camera works in, if you aren't already comfortable with them.

If you want to discuss this in slightly more real time, I'm frequently in the CHDK IRC channel: #CHDK on irc.freenode.net
Don't forget what the H stands for.

Re: SX10 Shutter Speeds
« Reply #21 on: 07 / October / 2009, 08:48:29 »
Wow.  All I can say is you guys have done a great job setting this stuff up.
I DLed CHDKShell and was able to compile (A570 101a, don't have my SX10 here).

One further question on this.  I got it to save the ELF objdump.  Does this contain everything that is available within the firmware?  Or would there I need to do any further disassembly of the firmware?

-tgq

BTW I just got apex2us = "apex to microseconds" with the "u" representing mu for micro...

Re: SX10 Shutter Speeds
« Reply #22 on: 07 / October / 2009, 17:06:03 »
A curious thing.  I got the compiler working and tried to do some debug type testing.  One of the things I ended up trying was in the apex2us function, rather than using:
 #if (apex_tv<-576)
    return 1000000.0*pow(2.0, -apex_tv/96.0);
 #else
    return _apex2us(apex_tv);
 #endif
I hardwired them to:
 #if (apex_tv<-576)
    return 500000.0;
 #else
    return 5000000.0;
 #endif
So any exposure over 64s (-576) should come out as 0.5s, any other shot as 5s.  When I ran the compiled version, EVERY shot I took was 5s, even for overrides > 64s (ie it was ignoring the first section of the if statement).  I'll try some more experiments on it later when I get home.

*

Offline whim

  • ******
  • 2046
  • A495/590/620/630 ixus70/115/220/230/300/870 S95
Re: SX10 Shutter Speeds
« Reply #23 on: 07 / October / 2009, 18:19:14 »
@barberofcivil
Are you sure you don't mean code instead of compiler #ifdef 's ?
I mean, shouldn't your test code be:
Quote
if (apex_tv<-576)
    return 500000.0;
else
    return 5000000.0;
endif

cheers,

wim
« Last Edit: 07 / October / 2009, 18:21:51 by whim »


*

Offline reyalp

  • ******
  • 14087
Re: SX10 Shutter Speeds
« Reply #24 on: 07 / October / 2009, 20:43:30 »
One further question on this.  I got it to save the ELF objdump.  Does this contain everything that is available within the firmware?  Or would there I need to do any further disassembly of the firmware?
I'm not clear what you are talking about. An ELF objdump of what ? If you want to know what is in the canon firmware, you obviously have to disassemble the firmware dump.

And like whim, I'm confused by your use of #if ?
Don't forget what the H stands for.

Re: SX10 Shutter Speeds
« Reply #25 on: 07 / October / 2009, 20:55:26 »
One further question on this.  I got it to save the ELF objdump.  Does this contain everything that is available within the firmware?  Or would there I need to do any further disassembly of the firmware?
I'm not clear what you are talking about. An ELF objdump of what ? If you want to know what is in the canon firmware, you obviously have to disassemble the firmware dump.

And like whim, I'm confused by your use of #if ?

Sorry, I'm not really up to speed on all this so I'm trying to learn as I go along.  I haven't done much C coding and it's been a while since I've done heavy BASIC coding so I'm not necessarily up with the current syntax and conventions.  I didn't realize there was a difference between if and #if.  I will try with if statements again.

As for the ELF dump, this is how it was referred to for GPL disassembly of the raw firmware binary dump (http://chdk.wikia.com/wiki/Gpl_Disassembling).  I noted that there is an option in CHDK shell to keep and save the disassembly.elf used, which is what I am referring to.

*

Offline reyalp

  • ******
  • 14087
Re: SX10 Shutter Speeds
« Reply #26 on: 07 / October / 2009, 21:08:29 »
Sorry, I'm not really up to speed on all this so I'm trying to learn as I go along.  I haven't done much C coding and it's been a while since I've done heavy BASIC coding so I'm not necessarily up with the current syntax and conventions.  I didn't realize there was a difference between if and #if.  I will try with if statements again.
You really need a bit more C than that to accomplish what you are trying to do here. I strongly suggest you spend a bit of time reading and doing some basic C tutorials that you can run and debug on your PC. Trying to learn C from hacking CHDK isn't jumping in at the deep end, it's more like jumping into a class 5 rapid.
Quote
As for the ELF dump, this is how it was referred to for GPL disassembly of the raw firmware binary dump (http://chdk.wikia.com/wiki/Gpl_Disassembling).  I noted that there is an option in CHDK shell to keep and save the disassembly.elf used, which is what I am referring to.
I don't use CHDK shell, so I'm not sure of the exact capabilities. If you are referring to "keep objdumps" in http://chdk.wikia.com/wiki/File:Chdk_shell_gui.gif I'd expect that to be CHDK objdumps. If there's an interface to disassembling the firmware, I don't see any mention of it (but that doesn't mean there isn't, as I said, I don't use it)
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14087
Re: SX10 Shutter Speeds
« Reply #27 on: 07 / October / 2009, 21:09:11 »
Gah, that was supposed to be an edit, not a reply, but anyway: BTW, I'm not trying to flame or discourage you here, just trying to be realistic.
Don't forget what the H stands for.


Re: SX10 Shutter Speeds
« Reply #28 on: 07 / October / 2009, 21:20:08 »
You really need a bit more C than that to accomplish what you are trying to do here. I strongly suggest you spend a bit of time reading and doing some basic C tutorials that you can run and debug on your PC. Trying to learn C from hacking CHDK isn't jumping in at the deep end, it's more like jumping into a class 5 rapid.
I do understand that.  I don't have no coding experience, just not experience in current C.  I usually tend to pick up and learn things quickly, mostly by doing what I'm doing, open and take apart what has already been created.  I'm probably not going to be accomplishing any of the great advances that have been made by others, I just want to be able to do a little debugging and tracing down of my current problem (SX10 shutter speeds) without bugging others to do it for me, espescially since you don't have access to the camera and from the responses I've gotten, nobody else has really been following up on it.

Quote
I don't use CHDK shell, so I'm not sure of the exact capabilities. If you are referring to "keep objdumps" in http://chdk.wikia.com/wiki/File:Chdk_shell_gui.gif I'd expect that to be CHDK objdumps. If there's an interface to disassembling the firmware, I don't see any mention of it (but that doesn't mean there isn't, as I said, I don't use it)
The newer version of the GUI has it labbelled as ELF objdump  "Keep disassembly of main.elffor each cam..."

Don't worry about sounding discouraging, I may be a bit of a newb at this, but I do understand what I'm getting into and my own limitations on it.

Re: SX10 Shutter Speeds
« Reply #29 on: 07 / October / 2009, 21:25:33 »
The .elf dump is about 3.2MB and contains info such as:

Code: [Select]
main.elf:     file format elf32-littlearm



Disassembly of section .text:



000a6c30 <_start>:

   a6c30: e3a00002 mov r0, #2 ; 0x2

   a6c34: e3300002 teq r0, #2 ; 0x2

   a6c38: e3a0dc19 mov sp, #6400 ; 0x1900

   a6c3c: e3a0b000 mov fp, #0 ; 0x0

   a6c40: ea0045c0 b b8348 <startup>



000a6c44 <fselect_sort_nothumb>:

   a6c44: e52de004 push {lr} ; (str lr, [sp, #-4]!)

   a6c48: eb00a8d3 bl d0f9c <__fselect_sort_from_arm>

   a6c4c: e49de004 pop {lr} ; (ldr lr, [sp], #4)

   a6c50: e12fff1e bx lr



000a6c54 <core_hook_task_create>:

   a6c54: 4770      bx lr

   a6c56: 46c0      nop (mov r8, r8)



000a6c58 <core_get_noise_reduction_value>:

   a6c58: 4b01      ldr r3, [pc, #4] (a6c60 <core_get_noise_reduction_value+0x8>)

   a6c5a: 6b58      ldr r0, [r3, #52]

   a6c5c: 4770      bx lr

   a6c5e: 46c0      nop (mov r8, r8)

   a6c60: 000e520c .word 0x000e520c



I suppose what youare saying is that this is the disassembled CHDK binary, not the firmware binary.
If that's the case then I'm not too much on disassembly the dump binary yet (was hoping that was a shortcut...), that'll be a project for another day.  For now I'll keep mucking with the CHDK trunk now that I've figured out some of it.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal