Canon 40D

Started by dichterDichter, July 18, 2012, 08:55:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

naegelejd

Hi everyone, I just discovered Magic Lantern for the first time and I'm interested in getting involved. I have a 40D and I'm a software engineer by profession. I'm not sure exactly where to start, i.e. what's the status on 40D support, what needs to be done, etc? I can download the code and build it but I don't want to brick my camera right off the bat. If anyone can point me in the right direction it'd be great!

nikfreak

Source to use:
https://bitbucket.org/hudson/magic-lantern/src/7d67bc6f378a8e7f607369a374f617491f32d2c5/platform/unmaintained/40D.111/stubs.S?at=unified&fileviewer=file-view-default

Check also "Qeen Mum's" thread:
http://www.magiclantern.fm/forum/index.php?topic=1010.0

eduperez has also 400plus running which is not ML but they share some stuff:
https://github.com/400plus/400plus


  • Preferrably you would fork the unified branch from ML on bitbucket
  • Move the initial linked 40D platform out of unmaintained
  • Strip down code or uncomment stuff which produces compile errors while first trying to #define CONFIG_HELLO_WORLD
  • regarding your brick question: comment out #define CONFIG_PROP_REQUEST_CHANGE from internals.h and you are good to go
  • You would need the 40D.111 firmware dump (anyone?) to find stubs and consts. Remember: dumps have to be kept private. No public posting.
  • You would need a way to enable bootloader (is there any installer (ML-SETUP.FIR) available already?)
  • for state objects check: http://a1ex.bitbucket.io/ML/states/index.html
  • Prepare yourself for endless hours of work  and try to catch a1ex on IRC if you need help with the bootloader :P
[size=8pt]70D.112 & 100D.101[/size]

wigyori

Hi all,

Do you accept pull requests for unmaintained (f.e. this very 40D) platforms? Instead of someone hacking on his/her own and later possibly dropping the whole thing for losing interest, or for not able to finish it, without telling anyone how far he/she got, it could make sense.

Thanks,
-w-

AOK

Now and then someone is posting something here. Now we have a some source files at our disposal, but how to run them on the Canon 40D?

Please could anyone explain.

Thank you in advance who ever you might be.

vnd

Hi,

I checked out changeset 8159 (the last one with 40d changes) and compiled it with arm toolchain 4.6.2. It went without problems, I did not try any newer version)

Then I took the 5D installer from installer/5DC.111, replaced the addresses of LEDs and write_bootflag/read_bootflag functions with the ones found on the first page of this thread, compiled and created installer firmware with dissect_fw3 and assemble_fw tools. There is no known address for write_card_bootflag so I formatted the card manually.

Then It successfully enabled the bootflag and the camera is able to boot the built magic lantern, which works good enough to show menu. Then I dumped the fw and run ARM-console on it. Too bad that I don't understand the ARM assembler much.

I wanted the fps override function for night focusing, but I could not find anything like shadow registers, so I ended with a hack that writes hardcoded value to fps register from ISO prop handler each time when iso is set to 1600.

Also I noticed that the camera is rather unstable and crashes after several shots. I disabled everything except boot code and finally found that it gets fixed by calling cache_unlock() from ml_hijack_create_task_cmd_shell() in  platform/40D.111/init.c.

Then I just re-enabled the ISO prop hack.

The camera now provides all the functionality that I need and is quite stable, so I don't plan to work on it further,


a1ex

Sounds good!

Do you mind sending me a copy of your ROM, for trying it in QEMU? The one I have is incomplete.

AOK

It would be lovely if a usable version could be made before I buy the 5D M4.

If I can make use of the huge ML features 
- Auto ETTR and
- RAW histogram
- dual ISO (if possible).

That would make quite an awesome old camera.

rufustfirefly

I've been plugging away at trying to replicate vnd's success with a modern version of ML -- which has been complicated by most of the VxWorks code being relatively unmaintained (from what I can see).

I'm most of the way through getting it to compile, although there are some deficiencies I've been trying to hack around. If anyone's interested in jumping in:

https://bitbucket.org/rufustfirefly/magic-lantern

(I'd be more than happy to either accept pull requests or grant full access to the repository, if anyone else wants to work on it.)
EOS 5Dmk3 | EOS 40D
EF 70-200mm f/2.8 IS II ; 50mm f/1.4 ; 24-104mm kit lens ; 135mm f/2.8 SF | FD 28mm f/2.0 ; 55mm f/1.2 ; 300mm f/4 | Nikkor 55mm f/1.2 | Other : Rokinon Cine 14mm, 24mm, 35mm, 85mm ; Juplen M42 135mm f/2.8 ; ... etc ...
http://jbuchbinder.com/

rufustfirefly

For a quick update:

I've got everything compiling, but I'm pretty sure some of my functions aren't defined in the right places, etc, so it's failing to link properly -- but otherwise it looks as though it's doable to get this working with the modern ML codebase, assuming that I (or someone else a bit better at this) untangle a few of the bad references and definitions in there.

That's as of this commit:

https://bitbucket.org/rufustfirefly/magic-lantern/commits/da9358bcac3caf54a0572be07cad611ee0922b3d
EOS 5Dmk3 | EOS 40D
EF 70-200mm f/2.8 IS II ; 50mm f/1.4 ; 24-104mm kit lens ; 135mm f/2.8 SF | FD 28mm f/2.0 ; 55mm f/1.2 ; 300mm f/4 | Nikkor 55mm f/1.2 | Other : Rokinon Cine 14mm, 24mm, 35mm, 85mm ; Juplen M42 135mm f/2.8 ; ... etc ...
http://jbuchbinder.com/

rufustfirefly

Update:

I've got it compiling and linking, although there's some serious hackery involved, as well as a bunch of functions which have been dummied up, since I'm not sure where they map on the 40D's OS.

https://bitbucket.org/rufustfirefly/magic-lantern/commits/4a738f3938437566f93fd1def8ff7168ffc90847
EOS 5Dmk3 | EOS 40D
EF 70-200mm f/2.8 IS II ; 50mm f/1.4 ; 24-104mm kit lens ; 135mm f/2.8 SF | FD 28mm f/2.0 ; 55mm f/1.2 ; 300mm f/4 | Nikkor 55mm f/1.2 | Other : Rokinon Cine 14mm, 24mm, 35mm, 85mm ; Juplen M42 135mm f/2.8 ; ... etc ...
http://jbuchbinder.com/

Ant123

Quote from: rufustfirefly on October 01, 2016, 11:13:50 PM
I've got it compiling and linking
Did you try to run it on your camera?

Ant123

Quote from: vnd on September 25, 2016, 07:58:34 PM
There is no known address for write_card_bootflag so I formatted the card manually.

For 40D111 it should be 0xFFFF43A0.

a1ex

Some small progress that also applies to 40D:

Quote from: a1ex on November 01, 2016, 08:45:51 PM
Added the 450D and 40D changes to the vxworks branch in the main repo. Did some minor cleanups (compiler warnings), had some attempts at emulating it in QEMU, but didn't really check any deeper yet.

For reverse engineering, I've adapted the dm-spy-experiments branch as vxworks-dm-spy (tested in qemu).

AOK

So is it working? :-) Sorry not quite clear for me  :-[

AOK

Nobody knows.... as it seems. A dead end :/

Morbius

Is ML for the 40D working? Are there any other alternatives? Does 400Plus work on the 40D or is only for the 400D as the documentation implies.

Thanks

eduperez

Quote from: Morbius on August 16, 2017, 02:48:46 PM
Is ML for the 40D working? Are there any other alternatives? Does 400Plus work on the 40D or is only for the 400D as the documentation implies.

Thanks

As the documentation for 400plus clearly states, "It is designed specifically for the Canon 400D/XTi and will not work with other camera models".

AOK

Even after all this time.... Here things are as stuck as they are on the 5D4. Why do I pick the wrong for ML camera :/

Theta Sigma

Is there anyone currently working on porting ML to the 40D? If not, is that primarily due to the age of the camera, the difficulty, or the devs lacking 40Ds on hand?

Audionut

Quote from: Theta Sigma on December 02, 2017, 03:46:39 PM
is that primarily due to the age of the camera, the difficulty, or the devs lacking 40Ds on hand?

Likely all three.

Theta Sigma


a1ex

Good news - 40D boots the GUI in QEMU, just like most other EOS models!



The last screen looks a bit odd - how does it look on a real camera?

Also compiled ML from the rufustfirefly repository and got a half-working Space Invaders clone (menu appears when pressing delete, navigation keys are working, fonts don't seem to work):


What does this mean? Porting ML on this camera is no longer difficult at all - it's just a matter of fixing the remaining issues (you've just got a very powerful tool for that) and bringing the source tree up to date with the mainline code. All the changes from rufustfirefly are also in our vxworks branch, but there are a few stubs missing; still, it shouldn't be hard to fix them and get this working in the emulator.

For the impatient: QEMU guide, installation video for Ubuntu, for Mac and guide for Windows.
Next steps: dfort's porting tutorial the EOS M2 walkthrough and the 450D port as reference.

As mentioned earlier - the camera is capable to record video (both MJPEG and RAW).

Want to help? Please follow the above links and confirm you can get the same results (screenshots) on your system. Proof-reading the QEMU guide is also very welcome.

Happy hacking!

goldenchild9to5

@a1ex WOW.. you are putting in work.  By the way happy holidays.

kyrobb

Possible MJPEG? Is this something unique to the 40D or have I missed out on some more recent developments?